v8/test/mjsunit/regress/regress-4715.js
Michael Starzinger 05f3b27cdd Reland "[flags] Remove some dead Crankshaft flags."
This is a reland of ec6da23bfe
Original change's description:
> [flags] Remove some dead Crankshaft flags.
> 
> R=bmeurer@chromium.org
> BUG=v8:6408
> 
> Change-Id: I34abbcdc2fc47df44938bac0e59f9982c935c657
> Reviewed-on: https://chromium-review.googlesource.com/569963
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#46631}

Bug: v8:6408
Change-Id: I8a856e25d56e27bccb79588b2e5ee4369d7c5fe5
Reviewed-on: https://chromium-review.googlesource.com/570050
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46637}
2017-07-13 13:15:34 +00:00

49 lines
1.1 KiB
JavaScript

// 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
var training = {};
training.a = "nop";
training.slow = "nop";
delete training.slow; // Dictionary-mode properties => slow-mode for-in.
var keepalive = {};
keepalive.a = "nop"; // Keep a map early in the transition chain alive.
function GetReal() {
var r = {};
r.a = "nop";
r.b = "nop";
r.c = "dictionarize",
r.d = "gc";
r.e = "result";
return r;
};
function SideEffect(object, action) {
if (action === "dictionarize") {
delete object.a;
} else if (action === "gc") {
gc();
}
}
function foo(object) {
for (var key in object) {
SideEffect(object, object[key]);
}
return key;
}
// Collect type feedback for slow-mode for-in.
foo(training);
SideEffect({a: 0}, "dictionarize");
SideEffect({}, "gc");
// Compile for slow-mode objects...
%OptimizeFunctionOnNextCall(foo);
// ...and pass in a fast-mode object.
assertEquals("e", foo(GetReal()));