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

Side by Side Diff: test/mjsunit/for-in-opt.js

Issue 1075933003: Add basic crankshaft support for slow-mode for-in to avoid disabling optimizations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable for-in-opt for turbofan Created 5 years, 8 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/hydrogen.cc ('k') | test/mjsunit/mjsunit.status » ('j') | 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 2015 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: --harmony-proxies --allow-natives-syntax
6
7 "use strict";
8
9 // Test non-JSObject receiver.
10 function f(o) {
11 var result = [];
12 for (var i in o) {
13 result.push(i);
14 }
15 return result;
16 }
17
18 assertEquals(["0"], f("a"));
19 assertEquals(["0"], f("a"));
20 %OptimizeFunctionOnNextCall(f);
21 assertEquals(["0","1","2"], f("bla"));
22
23 // Test the lazy deopt points.
24 var keys = ["a", "b", "c", "d"];
25 var has_keys = [];
26 var deopt_has = false;
27 var deopt_enum = false;
28
29 var handler = {
30 enumerate: function(target) {
31 if (deopt_enum) {
32 %DeoptimizeFunction(f2);
33 deopt_enum = false;
34 }
35 return keys;
36 },
37
38 getPropertyDescriptor: function(k) {
39 if (deopt_has) {
40 %DeoptimizeFunction(f2);
41 deopt_has = false;
42 }
43 has_keys.push(k);
44 return {value: 10, configurable: true, writable: false, enumerable: true};
45 }
46 };
47
48
49 var proxy = Proxy.create(handler);
50 var o = {__proto__: proxy};
51
52 function f2(o) {
53 var result = [];
54 for (var i in o) {
55 result.push(i);
56 }
57 return result;
58 }
59
60 function check_f2() {
61 assertEquals(keys, f2(o));
62 assertEquals(keys, has_keys);
63 has_keys.length = 0;
64 }
65
66 check_f2();
67 check_f2();
68 // Test lazy deopt after GetPropertyNamesFast
69 %OptimizeFunctionOnNextCall(f2);
70 deopt_enum = true;
71 check_f2();
72 // Test lazy deopt after FILTER_KEY
73 %OptimizeFunctionOnNextCall(f2);
74 deopt_has = true;
75 check_f2();
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698