Skip to content

Commit 5b5c8b6

Browse files
isaacspiscisaureus
authored andcommitted
v8: Upgrade to 3.11.10.14
1 parent 3e5139f commit 5b5c8b6

File tree

7 files changed

+93
-28
lines changed

7 files changed

+93
-28
lines changed

deps/v8/build/common.gypi

+4-3
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
'WIN32',
240240
],
241241
'msvs_configuration_attributes': {
242+
'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
242243
'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
243244
'CharacterSet': '1',
244245
},
@@ -270,7 +271,7 @@
270271
'target_conditions': [
271272
['_toolset=="host"', {
272273
'variables': {
273-
'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
274+
'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)',
274275
},
275276
'cflags': [ '<(m32flag)' ],
276277
'ldflags': [ '<(m32flag)' ],
@@ -280,7 +281,7 @@
280281
}],
281282
['_toolset=="target"', {
282283
'variables': {
283-
'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which g++)}}) -m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
284+
'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which g++)}}) -m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)',
284285
},
285286
'cflags': [ '<(m32flag)' ],
286287
'ldflags': [ '<(m32flag)' ],
@@ -323,7 +324,7 @@
323324
},
324325
'conditions': [
325326
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
326-
'cflags': [ '-Wno-unused-parameter',
327+
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
327328
'-Wnon-virtual-dtor', '-Woverloaded-virtual' ],
328329
}],
329330
],

deps/v8/src/heap.cc

+22-4
Original file line numberDiff line numberDiff line change
@@ -5013,7 +5013,11 @@ void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) {
50135013

50145014

50155015
bool Heap::IdleNotification(int hint) {
5016+
// Hints greater than this value indicate that
5017+
// the embedder is requesting a lot of GC work.
50165018
const int kMaxHint = 1000;
5019+
// Minimal hint that allows to do full GC.
5020+
const int kMinHintForFullGC = 100;
50175021
intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4;
50185022
// The size factor is in range [5..250]. The numbers here are chosen from
50195023
// experiments. If you changes them, make sure to test with
@@ -5081,16 +5085,30 @@ bool Heap::IdleNotification(int hint) {
50815085
mark_sweeps_since_idle_round_started_ += new_mark_sweeps;
50825086
ms_count_at_last_idle_notification_ = ms_count_;
50835087

5084-
if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) {
5088+
int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound -
5089+
mark_sweeps_since_idle_round_started_;
5090+
5091+
if (remaining_mark_sweeps <= 0) {
50855092
FinishIdleRound();
50865093
return true;
50875094
}
50885095

50895096
if (incremental_marking()->IsStopped()) {
5090-
incremental_marking()->Start();
5097+
// If there are no more than two GCs left in this idle round and we are
5098+
// allowed to do a full GC, then make those GCs full in order to compact
5099+
// the code space.
5100+
// TODO(ulan): Once we enable code compaction for incremental marking,
5101+
// we can get rid of this special case and always start incremental marking.
5102+
if (remaining_mark_sweeps <= 2 && hint >= kMinHintForFullGC) {
5103+
CollectAllGarbage(kReduceMemoryFootprintMask,
5104+
"idle notification: finalize idle round");
5105+
} else {
5106+
incremental_marking()->Start();
5107+
}
5108+
}
5109+
if (!incremental_marking()->IsStopped()) {
5110+
AdvanceIdleIncrementalMarking(step_size);
50915111
}
5092-
5093-
AdvanceIdleIncrementalMarking(step_size);
50945112
return false;
50955113
}
50965114

deps/v8/src/mark-compact.cc

+25-19
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,10 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
500500
space->identity() == OLD_DATA_SPACE ||
501501
space->identity() == CODE_SPACE);
502502

503+
static const int kMaxMaxEvacuationCandidates = 1000;
503504
int number_of_pages = space->CountTotalPages();
504-
505-
const int kMaxMaxEvacuationCandidates = 1000;
506-
int max_evacuation_candidates = Min(
507-
kMaxMaxEvacuationCandidates,
508-
static_cast<int>(sqrt(static_cast<double>(number_of_pages / 2)) + 1));
505+
int max_evacuation_candidates =
506+
static_cast<int>(sqrt(static_cast<double>(number_of_pages / 2)) + 1);
509507

510508
if (FLAG_stress_compaction || FLAG_always_compact) {
511509
max_evacuation_candidates = kMaxMaxEvacuationCandidates;
@@ -535,17 +533,27 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
535533
intptr_t over_reserved = reserved - space->SizeOfObjects();
536534
static const intptr_t kFreenessThreshold = 50;
537535

538-
if (over_reserved >= 2 * space->AreaSize() &&
539-
reduce_memory_footprint_) {
540-
mode = REDUCE_MEMORY_FOOTPRINT;
536+
if (over_reserved >= 2 * space->AreaSize()) {
537+
// If reduction of memory footprint was requested, we are aggressive
538+
// about choosing pages to free. We expect that half-empty pages
539+
// are easier to compact so slightly bump the limit.
540+
if (reduce_memory_footprint_) {
541+
mode = REDUCE_MEMORY_FOOTPRINT;
542+
max_evacuation_candidates += 2;
543+
}
541544

542-
// We expect that empty pages are easier to compact so slightly bump the
543-
// limit.
544-
max_evacuation_candidates += 2;
545+
// If over-usage is very high (more than a third of the space), we
546+
// try to free all mostly empty pages. We expect that almost empty
547+
// pages are even easier to compact so bump the limit even more.
548+
if (over_reserved > reserved / 3) {
549+
mode = REDUCE_MEMORY_FOOTPRINT;
550+
max_evacuation_candidates *= 2;
551+
}
545552

546-
if (FLAG_trace_fragmentation) {
547-
PrintF("Estimated over reserved memory: %.1f MB (setting threshold %d)\n",
553+
if (FLAG_trace_fragmentation && mode == REDUCE_MEMORY_FOOTPRINT) {
554+
PrintF("Estimated over reserved memory: %.1f / %.1f MB (threshold %d)\n",
548555
static_cast<double>(over_reserved) / MB,
556+
static_cast<double>(reserved) / MB,
549557
static_cast<int>(kFreenessThreshold));
550558
}
551559
}
@@ -554,6 +562,9 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
554562

555563
Candidate candidates[kMaxMaxEvacuationCandidates];
556564

565+
max_evacuation_candidates =
566+
Min(kMaxMaxEvacuationCandidates, max_evacuation_candidates);
567+
557568
int count = 0;
558569
int fragmentation = 0;
559570
Candidate* least = NULL;
@@ -3817,11 +3828,6 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
38173828
bool lazy_sweeping_active = false;
38183829
bool unused_page_present = false;
38193830

3820-
intptr_t old_space_size = heap()->PromotedSpaceSizeOfObjects();
3821-
intptr_t space_left =
3822-
Min(heap()->OldGenPromotionLimit(old_space_size),
3823-
heap()->OldGenAllocationLimit(old_space_size)) - old_space_size;
3824-
38253831
while (it.has_next()) {
38263832
Page* p = it.next();
38273833

@@ -3881,7 +3887,7 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
38813887
}
38823888
freed_bytes += SweepConservatively(space, p);
38833889
pages_swept++;
3884-
if (space_left + freed_bytes > newspace_size) {
3890+
if (freed_bytes > 2 * newspace_size) {
38853891
space->SetPagesToSweep(p->next_page());
38863892
lazy_sweeping_active = true;
38873893
} else {

deps/v8/src/version.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define MAJOR_VERSION 3
3636
#define MINOR_VERSION 11
3737
#define BUILD_NUMBER 10
38-
#define PATCH_LEVEL 12
38+
#define PATCH_LEVEL 14
3939
// Use 1 for candidates and 0 otherwise.
4040
// (Boolean macro values are not supported by all preprocessors.)
4141
#define IS_CANDIDATE_VERSION 0

deps/v8/test/cctest/test-alloc.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
using namespace v8::internal;
3535

3636

37-
static inline void SimulateFullSpace(PagedSpace* space) {
37+
// Also used in test-heap.cc test cases.
38+
void SimulateFullSpace(PagedSpace* space) {
3839
int old_linear_size = static_cast<int>(space->limit() - space->top());
3940
space->Free(space->top(), old_linear_size);
4041
space->SetTop(space->limit(), space->limit());

deps/v8/test/cctest/test-heap.cc

+39
Original file line numberDiff line numberDiff line change
@@ -1898,3 +1898,42 @@ TEST(Regress2143b) {
18981898
CHECK(root->IsJSObject());
18991899
CHECK(root->map()->IsMap());
19001900
}
1901+
1902+
1903+
// Implemented in the test-alloc.cc test suite.
1904+
void SimulateFullSpace(PagedSpace* space);
1905+
1906+
1907+
TEST(ReleaseOverReservedPages) {
1908+
i::FLAG_trace_gc = true;
1909+
InitializeVM();
1910+
v8::HandleScope scope;
1911+
static const int number_of_test_pages = 20;
1912+
1913+
// Prepare many pages with low live-bytes count.
1914+
PagedSpace* old_pointer_space = HEAP->old_pointer_space();
1915+
CHECK_EQ(1, old_pointer_space->CountTotalPages());
1916+
for (int i = 0; i < number_of_test_pages; i++) {
1917+
AlwaysAllocateScope always_allocate;
1918+
SimulateFullSpace(old_pointer_space);
1919+
FACTORY->NewFixedArray(1, TENURED);
1920+
}
1921+
CHECK_EQ(number_of_test_pages + 1, old_pointer_space->CountTotalPages());
1922+
1923+
// Triggering one GC will cause a lot of garbage to be discovered but
1924+
// even spread across all allocated pages.
1925+
HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered for preparation");
1926+
CHECK_EQ(number_of_test_pages + 1, old_pointer_space->CountTotalPages());
1927+
1928+
// Triggering subsequent GCs should cause at least half of the pages
1929+
// to be released to the OS after at most two cycles.
1930+
HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1");
1931+
CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages());
1932+
HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2");
1933+
CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2);
1934+
1935+
// Triggering a last-resort GC should cause all pages to be released
1936+
// to the OS so that other processes can seize the memory.
1937+
HEAP->CollectAllAvailableGarbage("triggered really hard");
1938+
CHECK_EQ(1, old_pointer_space->CountTotalPages());
1939+
}

deps/v8/tools/merge-to-branch.sh

100755100644
File mode changed.

0 commit comments

Comments
 (0)