forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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@{nodejs#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
Showing
5 changed files
with
125 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
})(); |