forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: cherry-pick a814b8a from upstream V8
Original commit message: Merged: [heap] Clear recorded slots for inobject properties when migrating fast object to slow mode. Revision: a814b8aeaf2b56635054c96435972dce90576f62 BUG=chromium:666046 LOG=N NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true R=ulan@chromium.org Review URL: https://codereview.chromium.org/2549803002 . Cr-Commit-Position: refs/branch-heads/5.5@{nodejs#60} Cr-Branched-From: 3cbd5838bd8376103daa45d69dade929ee4e0092-refs/heads/5.5.372@{#1} Cr-Branched-From: b3c8b0ce2c9af0528837d8309625118d4096553b-refs/heads/master@{nodejs#40015} PR-URL: nodejs#10733 Reviewed-By: Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: mhdawson - Michael Dawson <michael_dawson@ca.ibm.com>
- Loading branch information
Showing
3 changed files
with
68 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2016 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 --expose-gc | ||
|
||
function P() { | ||
this.a0 = {}; | ||
this.a1 = {}; | ||
this.a2 = {}; | ||
this.a3 = {}; | ||
this.a4 = {}; | ||
} | ||
|
||
function A() { | ||
} | ||
|
||
var proto = new P(); | ||
A.prototype = proto; | ||
|
||
function foo(o) { | ||
return o.a0; | ||
} | ||
|
||
// Ensure |proto| is in old space. | ||
gc(); | ||
gc(); | ||
gc(); | ||
|
||
// Ensure |proto| is marked as "should be fast". | ||
var o = new A(); | ||
foo(o); | ||
foo(o); | ||
foo(o); | ||
assertTrue(%HasFastProperties(proto)); | ||
|
||
// Contruct a double value that looks like a tagged pointer. | ||
var buffer = new ArrayBuffer(8); | ||
var int32view = new Int32Array(buffer); | ||
var float64view = new Float64Array(buffer); | ||
int32view[0] = int32view[1] = 0x40000001; | ||
var boom = float64view[0]; | ||
|
||
|
||
// Write new space object. | ||
proto.a4 = {a: 0}; | ||
// Immediately delete the field. | ||
delete proto.a4; | ||
|
||
// |proto| must sill be fast. | ||
assertTrue(%HasFastProperties(proto)); | ||
|
||
// Add a double field instead of deleted a4 that looks like a tagged pointer. | ||
proto.boom = boom; | ||
|
||
// Boom! | ||
gc(); |