Skip to content

Commit 34ef533

Browse files
targosrvagg
authored andcommitted
deps: update V8 to 4.4.63.30
PR-URL: #2482 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent c56aa82 commit 34ef533

File tree

8 files changed

+88
-24
lines changed

8 files changed

+88
-24
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 4
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 63
14-
#define V8_PATCH_LEVEL 26
14+
#define V8_PATCH_LEVEL 30
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/heap/gc-idle-time-handler.cc

+17-3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ bool GCIdleTimeHandler::ShouldDoScavenge(
113113
size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size,
114114
size_t scavenge_speed_in_bytes_per_ms,
115115
size_t new_space_allocation_throughput_in_bytes_per_ms) {
116+
if (idle_time_in_ms >= kMinBackgroundIdleTime) {
117+
// It is better to do full GC for the background tab.
118+
return false;
119+
}
116120
size_t new_space_allocation_limit =
117121
kMaxScheduledIdleTime * scavenge_speed_in_bytes_per_ms;
118122

@@ -185,7 +189,10 @@ bool GCIdleTimeHandler::ShouldDoOverApproximateWeakClosure(
185189
}
186190

187191

188-
GCIdleTimeAction GCIdleTimeHandler::NothingOrDone() {
192+
GCIdleTimeAction GCIdleTimeHandler::NothingOrDone(double idle_time_in_ms) {
193+
if (idle_time_in_ms >= kMinBackgroundIdleTime) {
194+
return GCIdleTimeAction::Nothing();
195+
}
189196
if (idle_times_which_made_no_progress_per_mode_ >=
190197
kMaxNoProgressIdleTimesPerMode) {
191198
return GCIdleTimeAction::Done();
@@ -235,6 +242,13 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
235242
HeapState heap_state) {
236243
Mode next_mode = NextMode(heap_state);
237244

245+
// Immediately go from reduce latency to reduce memory mode in
246+
// background tab.
247+
if (next_mode == kReduceLatency &&
248+
idle_time_in_ms >= kMinBackgroundIdleTime) {
249+
next_mode = kReduceMemory;
250+
}
251+
238252
if (next_mode != mode_) {
239253
mode_ = next_mode;
240254
ResetCounters();
@@ -298,13 +312,13 @@ GCIdleTimeAction GCIdleTimeHandler::Action(double idle_time_in_ms,
298312
if (heap_state.sweeping_completed) {
299313
return GCIdleTimeAction::FinalizeSweeping();
300314
} else {
301-
return NothingOrDone();
315+
return NothingOrDone(idle_time_in_ms);
302316
}
303317
}
304318

305319
if (heap_state.incremental_marking_stopped &&
306320
!heap_state.can_start_incremental_marking && !reduce_memory) {
307-
return NothingOrDone();
321+
return NothingOrDone(idle_time_in_ms);
308322
}
309323

310324
size_t step_size = EstimateMarkingStepSize(

deps/v8/src/heap/gc-idle-time-handler.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ class GCIdleTimeHandler {
231231
size_t scavenger_speed_in_bytes_per_ms,
232232
size_t new_space_allocation_throughput_in_bytes_per_ms);
233233

234+
bool ShouldGrowHeapSlowly() {
235+
return mode() == kDone;
236+
}
237+
234238
enum Mode { kReduceLatency, kReduceMemory, kDone };
235239

236240
Mode mode() { return mode_; }
@@ -244,7 +248,7 @@ class GCIdleTimeHandler {
244248
Mode NextMode(const HeapState& heap_state);
245249
GCIdleTimeAction Action(double idle_time_in_ms, const HeapState& heap_state,
246250
bool reduce_memory);
247-
GCIdleTimeAction NothingOrDone();
251+
GCIdleTimeAction NothingOrDone(double idle_time_in_ms);
248252

249253
int idle_mark_compacts_;
250254
int mark_compacts_;

deps/v8/src/heap/heap.cc

+6
Original file line numberDiff line numberDiff line change
@@ -5407,6 +5407,12 @@ void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size,
54075407
factor = min_factor;
54085408
}
54095409

5410+
const double kConservativeHeapGrowingFactor = 1.3;
5411+
if (gc_idle_time_handler_.ShouldGrowHeapSlowly()) {
5412+
factor = Min(factor, kConservativeHeapGrowingFactor);
5413+
}
5414+
5415+
54105416
idle_factor = Min(factor, idle_max_factor);
54115417

54125418
old_generation_allocation_limit_ =

deps/v8/src/hydrogen.cc

+10-11
Original file line numberDiff line numberDiff line change
@@ -11300,16 +11300,20 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
1130011300
HValue* object_size_constant = Add<HConstant>(initial_map->instance_size());
1130111301

1130211302
PretenureFlag pretenure_flag = NOT_TENURED;
11303-
Handle<AllocationSite> current_site(*site_context->current(), isolate());
11303+
Handle<AllocationSite> top_site(*site_context->top(), isolate());
1130411304
if (FLAG_allocation_site_pretenuring) {
11305-
pretenure_flag = current_site->GetPretenureMode();
11306-
top_info()->dependencies()->AssumeTenuringDecision(current_site);
11305+
pretenure_flag = top_site->GetPretenureMode();
1130711306
}
1130811307

11308+
Handle<AllocationSite> current_site(*site_context->current(), isolate());
11309+
if (*top_site == *current_site) {
11310+
// We install a dependency for pretenuring only on the outermost literal.
11311+
top_info()->dependencies()->AssumeTenuringDecision(top_site);
11312+
}
1130911313
top_info()->dependencies()->AssumeTransitionStable(current_site);
1131011314

1131111315
HInstruction* object = Add<HAllocate>(
11312-
object_size_constant, type, pretenure_flag, instance_type, current_site);
11316+
object_size_constant, type, pretenure_flag, instance_type, top_site);
1131311317

1131411318
// If allocation folding reaches Page::kMaxRegularHeapObjectSize the
1131511319
// elements array may not get folded into the object. Hence, we set the
@@ -11349,9 +11353,8 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
1134911353
HValue* object_elements_size = Add<HConstant>(elements_size);
1135011354
InstanceType instance_type = boilerplate_object->HasFastDoubleElements()
1135111355
? FIXED_DOUBLE_ARRAY_TYPE : FIXED_ARRAY_TYPE;
11352-
object_elements =
11353-
Add<HAllocate>(object_elements_size, HType::HeapObject(),
11354-
pretenure_flag, instance_type, current_site);
11356+
object_elements = Add<HAllocate>(object_elements_size, HType::HeapObject(),
11357+
pretenure_flag, instance_type, top_site);
1135511358
BuildEmitElements(boilerplate_object, elements, object_elements,
1135611359
site_context);
1135711360
Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
@@ -11452,10 +11455,6 @@ void HOptimizedGraphBuilder::BuildEmitInObjectProperties(
1145211455
if (representation.IsDouble()) {
1145311456
// Allocate a HeapNumber box and store the value into it.
1145411457
HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize);
11455-
// This heap number alloc does not have a corresponding
11456-
// AllocationSite. That is okay because
11457-
// 1) it's a child object of another object with a valid allocation site
11458-
// 2) we can just use the mode of the parent object for pretenuring
1145911458
HInstruction* double_box =
1146011459
Add<HAllocate>(heap_number_constant, HType::HeapObject(),
1146111460
pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE);

deps/v8/src/objects.cc

+20-8
Original file line numberDiff line numberDiff line change
@@ -4765,29 +4765,41 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
47654765
}
47664766
}
47674767

4768-
int inobject_props = object->map()->inobject_properties();
4768+
Handle<Map> old_map(object->map(), isolate);
4769+
4770+
int inobject_props = old_map->inobject_properties();
47694771

47704772
// Allocate new map.
4771-
Handle<Map> new_map = Map::CopyDropDescriptors(handle(object->map()));
4773+
Handle<Map> new_map = Map::CopyDropDescriptors(old_map);
47724774
new_map->set_dictionary_map(false);
47734775

4774-
if (object->map()->is_prototype_map()) {
4776+
if (old_map->is_prototype_map() && FLAG_track_prototype_users) {
47754777
DCHECK(new_map->is_prototype_map());
4776-
new_map->set_prototype_info(object->map()->prototype_info());
4777-
object->map()->set_prototype_info(Smi::FromInt(0));
4778+
4779+
Object* maybe_old_prototype = old_map->prototype();
4780+
if (maybe_old_prototype->IsJSObject()) {
4781+
Handle<JSObject> old_prototype(JSObject::cast(maybe_old_prototype));
4782+
bool was_registered =
4783+
JSObject::UnregisterPrototypeUser(old_prototype, old_map);
4784+
if (was_registered) {
4785+
JSObject::LazyRegisterPrototypeUser(new_map, isolate);
4786+
}
4787+
}
4788+
new_map->set_prototype_info(old_map->prototype_info());
4789+
old_map->set_prototype_info(Smi::FromInt(0));
47784790
if (FLAG_trace_prototype_users) {
47794791
PrintF("Moving prototype_info %p from map %p to map %p.\n",
47804792
reinterpret_cast<void*>(new_map->prototype_info()),
4781-
reinterpret_cast<void*>(object->map()),
4793+
reinterpret_cast<void*>(*old_map),
47824794
reinterpret_cast<void*>(*new_map));
47834795
}
47844796
}
47854797

47864798
#if TRACE_MAPS
47874799
if (FLAG_trace_maps) {
47884800
PrintF("[TraceMaps: SlowToFast from= %p to= %p reason= %s ]\n",
4789-
reinterpret_cast<void*>(object->map()),
4790-
reinterpret_cast<void*>(*new_map), reason);
4801+
reinterpret_cast<void*>(*old_map), reinterpret_cast<void*>(*new_map),
4802+
reason);
47914803
}
47924804
#endif
47934805

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

+3
Original file line numberDiff line numberDiff line change
@@ -15010,6 +15010,9 @@ TEST(TestIdleNotification) {
1501015010
(v8::base::TimeTicks::HighResolutionNow().ToInternalValue() /
1501115011
static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) +
1501215012
IdlePauseInSeconds);
15013+
if (CcTest::heap()->mark_compact_collector()->sweeping_in_progress()) {
15014+
CcTest::heap()->mark_compact_collector()->EnsureSweepingCompleted();
15015+
}
1501315016
}
1501415017
intptr_t final_size = CcTest::heap()->SizeOfObjects();
1501515018
CHECK(finished);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2015 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
function Parent() {}
6+
7+
function Child() {}
8+
Child.prototype = new Parent();
9+
var child = new Child();
10+
11+
function crash() {
12+
return child.__proto__;
13+
}
14+
15+
crash();
16+
crash();
17+
18+
// Trigger a fast->slow->fast dance of Parent.prototype's map...
19+
Parent.prototype.__defineSetter__("foo", function() { print("A"); });
20+
Parent.prototype.__defineSetter__("foo", function() { print("B"); });
21+
// ...and collect more type feedback.
22+
crash();
23+
24+
// Now modify the prototype chain. The right cell fails to get invalidated.
25+
delete Object.prototype.__proto__;
26+
crash();

0 commit comments

Comments
 (0)