Skip to content

Commit 3aad4fa

Browse files
bnoordhuisrvagg
authored andcommitted
deps: upgrade v8 to 4.4.63.12
PR-URL: #2092 Reviewed-By: Trevor Norris <[email protected]>
1 parent 6f40b03 commit 3aad4fa

File tree

10 files changed

+146
-52
lines changed

10 files changed

+146
-52
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 9
14+
#define V8_PATCH_LEVEL 12
1515

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

deps/v8/src/hydrogen.cc

+25-14
Original file line numberDiff line numberDiff line change
@@ -9662,15 +9662,7 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
96629662
HObjectAccess::ForMapAndOffset(initial_map,
96639663
JSObject::kElementsOffset),
96649664
empty_fixed_array);
9665-
if (initial_map->inobject_properties() != 0) {
9666-
HConstant* undefined = graph()->GetConstantUndefined();
9667-
for (int i = 0; i < initial_map->inobject_properties(); i++) {
9668-
int property_offset = initial_map->GetInObjectPropertyOffset(i);
9669-
Add<HStoreNamedField>(receiver,
9670-
HObjectAccess::ForMapAndOffset(initial_map, property_offset),
9671-
undefined);
9672-
}
9673-
}
9665+
BuildInitializeInobjectProperties(receiver, initial_map);
96749666
}
96759667

96769668
// Replace the constructor function with a newly allocated receiver using
@@ -9713,6 +9705,20 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
97139705
}
97149706

97159707

9708+
void HOptimizedGraphBuilder::BuildInitializeInobjectProperties(
9709+
HValue* receiver, Handle<Map> initial_map) {
9710+
if (initial_map->inobject_properties() != 0) {
9711+
HConstant* undefined = graph()->GetConstantUndefined();
9712+
for (int i = 0; i < initial_map->inobject_properties(); i++) {
9713+
int property_offset = initial_map->GetInObjectPropertyOffset(i);
9714+
Add<HStoreNamedField>(receiver, HObjectAccess::ForMapAndOffset(
9715+
initial_map, property_offset),
9716+
undefined);
9717+
}
9718+
}
9719+
}
9720+
9721+
97169722
HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) {
97179723
HAllocate* result =
97189724
BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithInternalFields),
@@ -11282,13 +11288,13 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
1128211288
Handle<JSObject> boilerplate_object,
1128311289
AllocationSiteUsageContext* site_context) {
1128411290
NoObservableSideEffectsScope no_effects(this);
11285-
InstanceType instance_type = boilerplate_object->map()->instance_type();
11291+
Handle<Map> initial_map(boilerplate_object->map());
11292+
InstanceType instance_type = initial_map->instance_type();
1128611293
DCHECK(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE);
1128711294

1128811295
HType type = instance_type == JS_ARRAY_TYPE
1128911296
? HType::JSArray() : HType::JSObject();
11290-
HValue* object_size_constant = Add<HConstant>(
11291-
boilerplate_object->map()->instance_size());
11297+
HValue* object_size_constant = Add<HConstant>(initial_map->instance_size());
1129211298

1129311299
PretenureFlag pretenure_flag = NOT_TENURED;
1129411300
Handle<AllocationSite> current_site(*site_context->current(), isolate());
@@ -11313,6 +11319,11 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
1131311319

1131411320
BuildEmitObjectHeader(boilerplate_object, object);
1131511321

11322+
// Similarly to the elements pointer, there is no guarantee that all
11323+
// property allocations can get folded, so pre-initialize all in-object
11324+
// properties to a safe value.
11325+
BuildInitializeInobjectProperties(object, initial_map);
11326+
1131611327
Handle<FixedArrayBase> elements(boilerplate_object->elements());
1131711328
int elements_size = (elements->length() > 0 &&
1131811329
elements->map() != isolate()->heap()->fixed_cow_array_map()) ?
@@ -11351,8 +11362,8 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
1135111362
}
1135211363

1135311364
// Copy in-object properties.
11354-
if (boilerplate_object->map()->NumberOfFields() != 0 ||
11355-
boilerplate_object->map()->unused_property_fields() > 0) {
11365+
if (initial_map->NumberOfFields() != 0 ||
11366+
initial_map->unused_property_fields() > 0) {
1135611367
BuildEmitInObjectProperties(boilerplate_object, object, site_context,
1135711368
pretenure_flag);
1135811369
}

deps/v8/src/hydrogen.h

+3
Original file line numberDiff line numberDiff line change
@@ -2506,6 +2506,9 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
25062506
void BuildInlinedCallArray(Expression* expression, int argument_count,
25072507
Handle<AllocationSite> site);
25082508

2509+
void BuildInitializeInobjectProperties(HValue* receiver,
2510+
Handle<Map> initial_map);
2511+
25092512
class PropertyAccessInfo {
25102513
public:
25112514
PropertyAccessInfo(HOptimizedGraphBuilder* builder,

deps/v8/src/objects-printer.cc

+1
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
415415
<< pre_allocated_property_fields() << "\n";
416416
os << " - unused property fields: " << unused_property_fields() << "\n";
417417
if (is_deprecated()) os << " - deprecated_map\n";
418+
if (is_stable()) os << " - stable_map\n";
418419
if (is_dictionary_map()) os << " - dictionary_map\n";
419420
if (is_prototype_map()) {
420421
os << " - prototype_map\n";

deps/v8/src/objects.cc

+5-7
Original file line numberDiff line numberDiff line change
@@ -2706,6 +2706,9 @@ Handle<Map> Map::ReconfigureProperty(Handle<Map> old_map, int modify_index,
27062706
target_descriptors->GetFieldType(modify_index)));
27072707
}
27082708
#endif
2709+
if (*target_map != *old_map) {
2710+
old_map->NotifyLeafMapLayoutChange();
2711+
}
27092712
return target_map;
27102713
}
27112714

@@ -2959,13 +2962,6 @@ Handle<Map> Map::ReconfigureProperty(Handle<Map> old_map, int modify_index,
29592962
split_kind, old_descriptors->GetKey(split_nof), split_attributes,
29602963
*new_descriptors, *new_layout_descriptor);
29612964

2962-
if (from_kind != to_kind) {
2963-
// There was an elements kind change in the middle of transition tree and
2964-
// we reconstructed the tree so that all elements kind transitions are
2965-
// done at the beginning, therefore the |old_map| is no longer stable.
2966-
old_map->NotifyLeafMapLayoutChange();
2967-
}
2968-
29692965
// If |transition_target_deprecated| is true then the transition array
29702966
// already contains entry for given descriptor. This means that the transition
29712967
// could be inserted regardless of whether transitions array is full or not.
@@ -2976,6 +2972,8 @@ Handle<Map> Map::ReconfigureProperty(Handle<Map> old_map, int modify_index,
29762972
"GenAll_CantHaveMoreTransitions");
29772973
}
29782974

2975+
old_map->NotifyLeafMapLayoutChange();
2976+
29792977
if (FLAG_trace_generalization && modify_index >= 0) {
29802978
PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
29812979
PropertyDetails new_details = new_descriptors->GetDetails(modify_index);

deps/v8/src/runtime/runtime-test.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
179179
base::OS::Sleep(base::TimeDelta::FromMilliseconds(50));
180180
}
181181
}
182-
if (FLAG_always_opt) {
182+
if (FLAG_always_opt || FLAG_prepare_always_opt) {
183183
// With --always-opt, optimization status expectations might not
184184
// match up, so just return a sentinel.
185185
return Smi::FromInt(3); // 3 == "always".

deps/v8/src/runtime/runtime-typedarray.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ void Runtime::SetupArrayBuffer(Isolate* isolate,
2727
array_buffer->set_is_external(is_external);
2828
array_buffer->set_is_neuterable(true);
2929

30-
Handle<Object> byte_length =
31-
isolate->factory()->NewNumberFromSize(allocated_length);
32-
CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber());
33-
array_buffer->set_byte_length(*byte_length);
34-
3530
if (data && !is_external) {
3631
isolate->heap()->RegisterNewArrayBuffer(
3732
isolate->heap()->InNewSpace(*array_buffer), data, allocated_length);
3833
}
34+
35+
Handle<Object> byte_length =
36+
isolate->factory()->NewNumberFromSize(allocated_length);
37+
CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber());
38+
array_buffer->set_byte_length(*byte_length);
3939
}
4040

4141

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

+104-8
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ TEST(ReconfigureAccessorToNonExistingDataField) {
437437

438438
Handle<Map> new_map = Map::ReconfigureProperty(
439439
map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD);
440-
// |map| did not change.
440+
// |map| did not change except marked unstable.
441441
CHECK(!map->is_deprecated());
442-
CHECK(map->is_stable());
442+
CHECK(!map->is_stable());
443443
CHECK(expectations.Check(*map));
444444

445445
expectations.SetDataField(0, NONE, Representation::None(), none_type);
@@ -601,19 +601,22 @@ static void TestGeneralizeRepresentation(
601601
CHECK(expectations.Check(*new_map));
602602

603603
if (is_detached_map) {
604+
CHECK(!map->is_stable());
604605
CHECK(map->is_deprecated());
605606
CHECK_NE(*map, *new_map);
606607
CHECK_EQ(expected_field_type_dependency && !field_owner->is_deprecated(),
607608
info.dependencies()->HasAborted());
608609

609610
} else if (expected_deprecation) {
611+
CHECK(!map->is_stable());
610612
CHECK(map->is_deprecated());
611613
CHECK(field_owner->is_deprecated());
612614
CHECK_NE(*map, *new_map);
613615
CHECK(!info.dependencies()->HasAborted());
614616

615617
} else {
616618
CHECK(!field_owner->is_deprecated());
619+
CHECK(map->is_stable()); // Map did not change, must be left stable.
617620
CHECK_EQ(*map, *new_map);
618621

619622
CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted());
@@ -654,6 +657,12 @@ static void TestGeneralizeRepresentation(
654657
to_type, expected_representation, expected_type, expected_deprecation,
655658
expected_field_type_dependency);
656659
}
660+
661+
// Check that reconfiguration to the very same field works correctly.
662+
Representation representation = from_representation;
663+
Handle<HeapType> type = from_type;
664+
TestGeneralizeRepresentation(-1, 2, representation, type, representation,
665+
type, representation, type, false, false);
657666
}
658667
}
659668

@@ -877,6 +886,7 @@ TEST(GeneralizeRepresentationWithAccessorProperties) {
877886

878887
expectations.SetDataField(i, Representation::Double(), any_type);
879888

889+
CHECK(!map->is_stable());
880890
CHECK(map->is_deprecated());
881891
CHECK_NE(*map, *new_map);
882892
CHECK(i == 0 || maps[i - 1]->is_deprecated());
@@ -962,7 +972,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation(
962972
Handle<Map> new_map =
963973
Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE);
964974

965-
// |map2| should be left unchanged.
975+
// |map2| should be left unchanged but marked unstable.
976+
CHECK(!map2->is_stable());
966977
CHECK(!map2->is_deprecated());
967978
CHECK_NE(*map2, *new_map);
968979
CHECK(expectations2.Check(*map2));
@@ -1047,7 +1058,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial(
10471058
Handle<Map> new_map =
10481059
Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE);
10491060

1050-
// |map2| should be left unchanged.
1061+
// |map2| should be left unchanged but marked unstable.
1062+
CHECK(!map2->is_stable());
10511063
CHECK(!map2->is_deprecated());
10521064
CHECK_NE(*map2, *new_map);
10531065
CHECK(expectations2.Check(*map2));
@@ -1183,6 +1195,8 @@ struct CheckDeprecated {
11831195
struct CheckSameMap {
11841196
void Check(Handle<Map> map, Handle<Map> new_map,
11851197
const Expectations& expectations) {
1198+
// |map| was not reconfigured, therefore it should stay stable.
1199+
CHECK(map->is_stable());
11861200
CHECK(!map->is_deprecated());
11871201
CHECK_EQ(*map, *new_map);
11881202

@@ -1196,6 +1210,21 @@ struct CheckSameMap {
11961210
};
11971211

11981212

1213+
// Checks that given |map| is NOT deprecated and matches expectations.
1214+
// |new_map| is unrelated to |map|.
1215+
struct CheckUnrelated {
1216+
void Check(Handle<Map> map, Handle<Map> new_map,
1217+
const Expectations& expectations) {
1218+
CHECK(!map->is_deprecated());
1219+
CHECK_NE(*map, *new_map);
1220+
CHECK(expectations.Check(*map));
1221+
1222+
CHECK(new_map->is_stable());
1223+
CHECK(!new_map->is_deprecated());
1224+
}
1225+
};
1226+
1227+
11991228
// Checks that given |map| is NOT deprecated, and |new_map| is a result of
12001229
// copy-generalize-all-representations.
12011230
struct CheckCopyGeneralizeAllRepresentations {
@@ -1289,7 +1318,8 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap(
12891318
Handle<Map> new_map =
12901319
Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE);
12911320

1292-
// |map2| should be left unchanged.
1321+
// |map2| should be left unchanged but marked unstable.
1322+
CHECK(!map2->is_stable());
12931323
CHECK(!map2->is_deprecated());
12941324
CHECK_NE(*map2, *new_map);
12951325
CHECK(expectations2.Check(*map2));
@@ -1366,6 +1396,40 @@ TEST(ReconfigureDataFieldAttribute_DataConstantToDataFieldAfterTargetMap) {
13661396
}
13671397

13681398

1399+
TEST(ReconfigureDataFieldAttribute_DataConstantToAccConstantAfterTargetMap) {
1400+
CcTest::InitializeVM();
1401+
v8::HandleScope scope(CcTest::isolate());
1402+
1403+
struct TestConfig {
1404+
Handle<JSFunction> js_func_;
1405+
Handle<AccessorPair> pair_;
1406+
TestConfig() {
1407+
Isolate* isolate = CcTest::i_isolate();
1408+
Factory* factory = isolate->factory();
1409+
js_func_ = factory->NewFunction(factory->empty_string());
1410+
pair_ = CreateAccessorPair(true, true);
1411+
}
1412+
1413+
Handle<Map> AddPropertyAtBranch(int branch_id, Expectations& expectations,
1414+
Handle<Map> map) {
1415+
CHECK(branch_id == 1 || branch_id == 2);
1416+
if (branch_id == 1) {
1417+
return expectations.AddDataConstant(map, NONE, js_func_);
1418+
} else {
1419+
return expectations.AddAccessorConstant(map, NONE, pair_);
1420+
}
1421+
}
1422+
1423+
void UpdateExpectations(int property_index, Expectations& expectations) {}
1424+
};
1425+
1426+
TestConfig config;
1427+
// These are completely separate branches in transition tree.
1428+
CheckUnrelated checker;
1429+
TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker);
1430+
}
1431+
1432+
13691433
TEST(ReconfigureDataFieldAttribute_SameAccessorConstantAfterTargetMap) {
13701434
CcTest::InitializeVM();
13711435
v8::HandleScope scope(CcTest::isolate());
@@ -1382,9 +1446,8 @@ TEST(ReconfigureDataFieldAttribute_SameAccessorConstantAfterTargetMap) {
13821446
return expectations.AddAccessorConstant(map, NONE, pair_);
13831447
}
13841448

1385-
bool UpdateExpectations(int property_index, Expectations& expectations) {
1449+
void UpdateExpectations(int property_index, Expectations& expectations) {
13861450
// Two branches are "compatible" so the |map1| should NOT be deprecated.
1387-
return false;
13881451
}
13891452
};
13901453

@@ -1436,6 +1499,37 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToAccFieldAfterTargetMap) {
14361499
}
14371500

14381501

1502+
TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) {
1503+
CcTest::InitializeVM();
1504+
v8::HandleScope scope(CcTest::isolate());
1505+
1506+
struct TestConfig {
1507+
Handle<AccessorPair> pair_;
1508+
TestConfig() { pair_ = CreateAccessorPair(true, true); }
1509+
1510+
Handle<Map> AddPropertyAtBranch(int branch_id, Expectations& expectations,
1511+
Handle<Map> map) {
1512+
CHECK(branch_id == 1 || branch_id == 2);
1513+
if (branch_id == 1) {
1514+
return expectations.AddAccessorConstant(map, NONE, pair_);
1515+
} else {
1516+
Isolate* isolate = CcTest::i_isolate();
1517+
Handle<HeapType> any_type = HeapType::Any(isolate);
1518+
return expectations.AddDataField(map, NONE, Representation::Smi(),
1519+
any_type);
1520+
}
1521+
}
1522+
1523+
void UpdateExpectations(int property_index, Expectations& expectations) {}
1524+
};
1525+
1526+
TestConfig config;
1527+
// These are completely separate branches in transition tree.
1528+
CheckUnrelated checker;
1529+
TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker);
1530+
}
1531+
1532+
14391533
////////////////////////////////////////////////////////////////////////////////
14401534
// A set of tests checking split map deprecation.
14411535
//
@@ -1487,6 +1581,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
14871581
// transition tree.
14881582
CHECK(map->is_deprecated());
14891583
CHECK(!split_map->is_deprecated());
1584+
CHECK(map2->is_stable());
14901585
CHECK(!map2->is_deprecated());
14911586

14921587
// Fill in transition tree of |map2| so that it can't have more transitions.
@@ -1932,7 +2027,8 @@ struct FieldGeneralizationChecker {
19322027
Handle<Map> updated_map = Map::Update(map1);
19332028
CHECK_EQ(*map2, *updated_map);
19342029

1935-
expectations2.SetDataField(descriptor_, representation_, heap_type_);
2030+
expectations2.SetDataField(descriptor_, attributes_, representation_,
2031+
heap_type_);
19362032
CHECK(expectations2.Check(*map2));
19372033
}
19382034
};

0 commit comments

Comments
 (0)