Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
201c2d9
deps: V8: cherry-pick 516b5d3f9cfe
targos Apr 17, 2021
8e9415c
deps: V8: cherry-pick a59e3ac1d7fa
targos Apr 17, 2021
a8a9562
deps: V8: cherry-pick abb4d0a431c0
targos Apr 17, 2021
7b7d5c1
deps: V8: cherry-pick 33f4064dbad3
targos Apr 17, 2021
a0cd0e6
deps: V8: cherry-pick d724820c1d5d
targos Apr 17, 2021
79cbe4c
deps: V8: cherry-pick 6a4cd97d6691
targos Apr 17, 2021
042ff7b
deps: V8: cherry-pick ed3eedae33d0
targos Apr 17, 2021
3936f4f
deps: V8: cherry-pick 8c725f7b5bbf
targos Apr 17, 2021
df2459d
deps: V8: cherry-pick 3ba21a17ce2f
targos Apr 17, 2021
7249e8c
deps: V8: cherry-pick c449afa1953b
targos Apr 17, 2021
ca4c625
deps: V8: cherry-pick 412ac52d8246
targos Apr 17, 2021
b3307a1
deps: V8: cherry-pick 482e5c7750b3
targos Apr 17, 2021
e319c63
deps: V8: cherry-pick ad2c5dae4688
targos Apr 17, 2021
39627e6
deps: V8: cherry-pick 5c6c99a8dc72
targos Apr 17, 2021
4110028
deps: V8: cherry-pick e527ba4bf8af
targos Apr 17, 2021
6506918
deps: V8: cherry-pick 53c4d057974a
targos Apr 17, 2021
92c9f62
deps: V8: cherry-pick d2283ba066ba
targos Apr 17, 2021
9803b55
deps: V8: cherry-pick 813066946968
targos Apr 17, 2021
14f68be
deps: V8: cherry-pick 5678ebe8f6c4
targos Apr 17, 2021
a461185
deps: V8: cherry-pick 254c7945eea2
targos Apr 17, 2021
022356d
deps: V8: cherry-pick 3066b7b2fcb3
targos Apr 17, 2021
03c1d2e
deps: V8: cherry-pick 1e35f6472510
targos Apr 17, 2021
e7472f1
deps: V8: cherry-pick 8ebd894186ed
targos Apr 17, 2021
c38bbfc
deps: V8: cherry-pick 1a7d55a9a427
targos Apr 17, 2021
695eb84
deps: V8: cherry-pick 93b2105fbe44
targos Apr 17, 2021
dd2fc44
deps: V8: cherry-pick f44fcbf803ac
targos Apr 17, 2021
caca453
deps: V8: cherry-pick 6771d3e31883
targos Apr 17, 2021
02584c6
deps: V8: cherry-pick eddb82330975
targos Apr 17, 2021
3dcf5d8
deps: V8: cherry-pick 4e24c353d812
targos Apr 18, 2021
374a40f
deps: V8: cherry-pick be91c6c50818
targos Apr 18, 2021
6d9800e
build: do not pass mode option to test-v8 command
targos Oct 19, 2020
72d8e9d
deps: V8: cherry-pick bbc59d124ef3
targos Apr 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
deps: V8: cherry-pick 3ba21a17ce2f
Original commit message:

    Merged: [map] Try to in-place transition during map update

    When searching for a target map during map update, attempt to
    update field representations in-place to the more general
    representation, where possible.

    Bug: chromium:1143772
    No-Try: true
    No-Presubmit: true
    No-Tree-Checks: true

    TBR=leszeks@chromium.org, fgm@chromium.org
    (cherry picked from commit 8e3ae62d294818733a0322d8e8abd53d4e410f19)

    Change-Id: I659890c2f08c14d1cf94242fb875c19837df2dbb
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2509599
    Reviewed-by: Francis McCabe <fgm@chromium.org>
    Reviewed-by: Michael Hablich <hablich@chromium.org>
    Reviewed-by: Bill Budge <bbudge@chromium.org>
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Cr-Commit-Position: refs/branch-heads/8.6@{#44}
    Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1}
    Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472}

Refs: v8/v8@3ba21a1
  • Loading branch information
targos committed Apr 27, 2021
commit df2459de276c35293aa3fa32d511aca341968980
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.37',
'v8_embedder_string': '-node.38',

##### V8 defaults for Node.js #####

Expand Down
12 changes: 11 additions & 1 deletion deps/v8/src/objects/map-updater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,17 @@ MapUpdater::State MapUpdater::FindTargetMap() {
}
Representation tmp_representation = tmp_details.representation();
if (!old_details.representation().fits_into(tmp_representation)) {
break;
// Try updating the field in-place to a generalized type.
Representation generalized =
tmp_representation.generalize(old_details.representation());
if (!tmp_representation.CanBeInPlaceChangedTo(generalized)) {
break;
}
Handle<Map> field_owner(tmp_map->FindFieldOwner(isolate_, i), isolate_);
tmp_representation = generalized;
GeneralizeField(field_owner, i, tmp_details.constness(),
tmp_representation,
handle(tmp_descriptors->GetFieldType(i), isolate_));
}

if (tmp_details.location() == kField) {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/objects/map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ void Map::DeprecateTransitionTree(Isolate* isolate) {
transitions.GetTarget(i).DeprecateTransitionTree(isolate);
}
DCHECK(!constructor_or_backpointer().IsFunctionTemplateInfo());
DCHECK(CanBeDeprecated());
set_is_deprecated(true);
if (FLAG_trace_maps) {
LOG(isolate, MapEvent("Deprecate", handle(*this, isolate), Handle<Map>()));
Expand Down
67 changes: 41 additions & 26 deletions deps/v8/test/cctest/test-field-type-tracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,8 @@ namespace {
// where "p2A" and "p2B" differ only in the attributes.
//
void TestReconfigureDataFieldAttribute_GeneralizeField(
const CRFTData& from, const CRFTData& to, const CRFTData& expected) {
const CRFTData& from, const CRFTData& to, const CRFTData& expected,
bool expected_deprecation) {
Isolate* isolate = CcTest::i_isolate();

Expectations expectations(isolate);
Expand Down Expand Up @@ -1121,24 +1122,29 @@ void TestReconfigureDataFieldAttribute_GeneralizeField(
CHECK_NE(*map2, *new_map);
CHECK(expectations2.Check(*map2));

// |map| should be deprecated and |new_map| should match new expectations.
for (int i = kSplitProp; i < kPropCount; i++) {
expectations.SetDataField(i, expected.constness, expected.representation,
expected.type);
}
CHECK(map->is_deprecated());
CHECK(!code_field_type->marked_for_deoptimization());
CHECK(!code_field_repr->marked_for_deoptimization());
CHECK(!code_field_const->marked_for_deoptimization());
CHECK_NE(*map, *new_map);
if (expected_deprecation) {
// |map| should be deprecated and |new_map| should match new expectations.
CHECK(map->is_deprecated());
CHECK(!code_field_type->marked_for_deoptimization());
CHECK(!code_field_repr->marked_for_deoptimization());
CHECK(!code_field_const->marked_for_deoptimization());
CHECK_NE(*map, *new_map);

CHECK(!new_map->is_deprecated());
CHECK(expectations.Check(*new_map));
CHECK(!new_map->is_deprecated());
CHECK(expectations.Check(*new_map));

// Update deprecated |map|, it should become |new_map|.
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
CheckMigrationTarget(isolate, *map, *updated_map);
// Update deprecated |map|, it should become |new_map|.
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
CheckMigrationTarget(isolate, *map, *updated_map);
} else {
CHECK(!map->is_deprecated());
CHECK(expectations.Check(*map));
}
}

// This test ensures that trivial field generalization (from HeapObject to
Expand Down Expand Up @@ -1254,22 +1260,22 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeSmiFieldToDouble) {
TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kConst, Representation::Smi(), any_type},
{PropertyConstness::kConst, Representation::Double(), any_type},
{PropertyConstness::kConst, Representation::Double(), any_type});
{PropertyConstness::kConst, Representation::Double(), any_type}, true);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kConst, Representation::Smi(), any_type},
{PropertyConstness::kMutable, Representation::Double(), any_type},
{PropertyConstness::kMutable, Representation::Double(), any_type});
{PropertyConstness::kMutable, Representation::Double(), any_type}, true);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kMutable, Representation::Smi(), any_type},
{PropertyConstness::kConst, Representation::Double(), any_type},
{PropertyConstness::kMutable, Representation::Double(), any_type});
{PropertyConstness::kMutable, Representation::Double(), any_type}, true);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kMutable, Representation::Smi(), any_type},
{PropertyConstness::kMutable, Representation::Double(), any_type},
{PropertyConstness::kMutable, Representation::Double(), any_type});
{PropertyConstness::kMutable, Representation::Double(), any_type}, true);
}

TEST(ReconfigureDataFieldAttribute_GeneralizeSmiFieldToTagged) {
Expand All @@ -1284,22 +1290,26 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeSmiFieldToTagged) {
TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kConst, Representation::Smi(), any_type},
{PropertyConstness::kConst, Representation::HeapObject(), value_type},
{PropertyConstness::kConst, Representation::Tagged(), any_type});
{PropertyConstness::kConst, Representation::Tagged(), any_type},
!FLAG_modify_field_representation_inplace);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kConst, Representation::Smi(), any_type},
{PropertyConstness::kMutable, Representation::HeapObject(), value_type},
{PropertyConstness::kMutable, Representation::Tagged(), any_type});
{PropertyConstness::kMutable, Representation::Tagged(), any_type},
!FLAG_modify_field_representation_inplace);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kMutable, Representation::Smi(), any_type},
{PropertyConstness::kConst, Representation::HeapObject(), value_type},
{PropertyConstness::kMutable, Representation::Tagged(), any_type});
{PropertyConstness::kMutable, Representation::Tagged(), any_type},
!FLAG_modify_field_representation_inplace);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kMutable, Representation::Smi(), any_type},
{PropertyConstness::kMutable, Representation::HeapObject(), value_type},
{PropertyConstness::kMutable, Representation::Tagged(), any_type});
{PropertyConstness::kMutable, Representation::Tagged(), any_type},
!FLAG_modify_field_representation_inplace);
}

TEST(ReconfigureDataFieldAttribute_GeneralizeDoubleFieldToTagged) {
Expand All @@ -1314,22 +1324,26 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeDoubleFieldToTagged) {
TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kConst, Representation::Double(), any_type},
{PropertyConstness::kConst, Representation::HeapObject(), value_type},
{PropertyConstness::kConst, Representation::Tagged(), any_type});
{PropertyConstness::kConst, Representation::Tagged(), any_type},
FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kConst, Representation::Double(), any_type},
{PropertyConstness::kMutable, Representation::HeapObject(), value_type},
{PropertyConstness::kMutable, Representation::Tagged(), any_type});
{PropertyConstness::kMutable, Representation::Tagged(), any_type},
FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kMutable, Representation::Double(), any_type},
{PropertyConstness::kConst, Representation::HeapObject(), value_type},
{PropertyConstness::kMutable, Representation::Tagged(), any_type});
{PropertyConstness::kMutable, Representation::Tagged(), any_type},
FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace);

TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kMutable, Representation::Double(), any_type},
{PropertyConstness::kMutable, Representation::HeapObject(), value_type},
{PropertyConstness::kMutable, Representation::Tagged(), any_type});
{PropertyConstness::kMutable, Representation::Tagged(), any_type},
FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace);
}

TEST(ReconfigureDataFieldAttribute_GeneralizeHeapObjFieldToHeapObj) {
Expand Down Expand Up @@ -1415,7 +1429,8 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeHeapObjectFieldToTagged) {
TestReconfigureDataFieldAttribute_GeneralizeField(
{PropertyConstness::kMutable, Representation::HeapObject(), value_type},
{PropertyConstness::kMutable, Representation::Smi(), any_type},
{PropertyConstness::kMutable, Representation::Tagged(), any_type});
{PropertyConstness::kMutable, Representation::Tagged(), any_type},
!FLAG_modify_field_representation_inplace);
}

// Checks that given |map| is deprecated and that it updates to given |new_map|
Expand Down
71 changes: 71 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-1143772.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --allow-natives-syntax

(function() {
// Only run this test if doubles are transitioned in-place to tagged.
let x = {};
x.a = 0.1;
let y = {};
y.a = {};
if (!%HaveSameMap(x, y)) return;

// m1: {}
let m1 = {};

// m2: {a:d}
let m2 = {};
assertTrue(%HaveSameMap(m2, m1));
m2.a = 13.37;

// m3: {a:d, b:s}
let m3 = {};
m3.a = 13.37;
assertTrue(%HaveSameMap(m3, m2));
m3.b = 1;

// m4: {a:d, b:s, c:h}
let m4 = {};
m4.a = 13.37;
m4.b = 1;
assertTrue(%HaveSameMap(m4, m3));
m4.c = {};

// m4_2 == m4
let m4_2 = {};
m4_2.a = 13.37;
m4_2.b = 1;
m4_2.c = {};
assertTrue(%HaveSameMap(m4_2, m4));

// m5: {a:d, b:d}
let m5 = {};
m5.a = 13.37;
assertTrue(%HaveSameMap(m5, m2));
m5.b = 13.37;
assertFalse(%HaveSameMap(m5, m3));

// At this point, Map3 and Map4 are both deprecated. Map2 transitions to
// Map5. Map5 is the migration target for Map3.
assertFalse(%HaveSameMap(m5, m3));

// m6: {a:d, b:d, c:d}
let m6 = {};
m6.a = 13.37;
assertTrue(%HaveSameMap(m6, m2));
m6.b = 13.37;
assertTrue(%HaveSameMap(m6, m5));
m6.c = 13.37

// Make m7: {a:d, b:d, c:t}
let m7 = m4_2;
assertTrue(%HaveSameMap(m7, m4));
// Map4 is deprecated, so this property access triggers a Map migration.
// With in-place map updates and no double unboxing, this should end up
// migrating to Map6, and updating it in-place.
m7.c;
assertFalse(%HaveSameMap(m7, m4));
assertTrue(%HaveSameMap(m6, m7));
})();