Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: test/mjsunit/regress/regress-4715.js

Issue 1650493002: [crankshaft] Make the for-in slow path compatible with the other compilers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax --dead-code-elimination --expose-gc
6
7 var training = {};
8 training.a = "nop";
9 training.slow = "nop";
10 delete training.slow; // Dictionary-mode properties => slow-mode for-in.
11
12 var keepalive = {};
13 keepalive.a = "nop"; // Keep a map early in the transition chain alive.
14
15 function GetReal() {
16 var r = {};
17 r.a = "nop";
18 r.b = "nop";
19 r.c = "dictionarize",
20 r.d = "gc";
21 r.e = "result";
22 return r;
23 };
24
25 function SideEffect(object, action) {
26 if (action === "dictionarize") {
27 delete object.a;
28 } else if (action === "gc") {
29 gc();
30 }
31 }
32
33 function foo(object) {
34 for (var key in object) {
35 SideEffect(object, object[key]);
36 }
37 return key;
38 }
39
40 // Collect type feedback for slow-mode for-in.
41 foo(training);
42 SideEffect({a: 0}, "dictionarize");
43 SideEffect({}, "gc");
44
45 // Compile for slow-mode objects...
46 %OptimizeFunctionOnNextCall(foo);
47 // ...and pass in a fast-mode object.
48 assertEquals("e", foo(GetReal()));
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698