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

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

Issue 1413923005: Fix deoptimization at ForInStatement::BodyId() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: moar test cases Created 5 years, 1 month 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/full-codegen/x87/full-codegen-x87.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
1 // Copyright 2015 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-proxies --allow-natives-syntax 5 // Flags: --harmony-proxies --allow-natives-syntax --expose-debug-as debug
6 6
7 "use strict"; 7 "use strict";
8 8
9 // Test non-JSObject receiver. 9 // Test non-JSObject receiver.
10 function f(o) { 10 function f(o) {
11 var result = []; 11 var result = [];
12 for (var i in o) { 12 for (var i in o) {
13 result.push(i); 13 result.push(i);
14 } 14 }
15 return result; 15 return result;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 function f3(o) { 77 function f3(o) {
78 for (var i in o) { 78 for (var i in o) {
79 } 79 }
80 } 80 }
81 81
82 f3({__proto__:{x:1}}); 82 f3({__proto__:{x:1}});
83 f3({__proto__:{x:1}}); 83 f3({__proto__:{x:1}});
84 %OptimizeFunctionOnNextCall(f3); 84 %OptimizeFunctionOnNextCall(f3);
85 f3(undefined); 85 f3(undefined);
86 f3(null); 86 f3(null);
87
88 // Reliable repro for an issue previously flushed out by GC stress.
89 var handler2 = {
90 getPropertyDescriptor: function(k) {
91 has_keys.push(k);
92 return {value: 10, configurable: true, writable: false, enumerable: true};
93 }
94 }
95 var proxy2 = Proxy.create(handler2);
96 var o2 = {__proto__: proxy2};
97 var p = {x: "x"}
98
99 function f4(o, p) {
100 var result = [];
101 for (var i in o) {
102 var j = p.x + "str";
103 result.push(i);
104 }
105 return result;
106 }
107 function check_f4() {
108 assertEquals(keys, f4(o, p));
109 assertEquals(keys, has_keys);
110 has_keys.length = 0;
111 }
112 check_f4();
113 check_f4();
114 %OptimizeFunctionOnNextCall(f4);
115 p.y = "y"; // Change map, cause eager deopt.
116 check_f4();
117
118 // Repro for Turbofan equivalent.
119 var x;
120 var count = 0;
121
122 var Debug = debug.Debug;
123
124 function listener(event, exec_state, event_data, data) {
125 if (event == Debug.DebugEvent.Break) {
126 %DeoptimizeFunction(f5);
127 }
128 }
129
130 var handler3 = {
131 enumerate: function(target) {
132 return ["a", "b"];
133 },
134
135 getPropertyDescriptor: function(k) {
136 if (k == "a") count++;
137 if (x) %ScheduleBreak();
138 return {value: 10, configurable: true, writable: false, enumerable: true};
139 }
140 };
141
142 var proxy3 = Proxy.create(handler3);
143 var o3 = {__proto__: proxy3};
144
145 function f5() {
146 for (var p in o3) {
147 print(p);
148 }
149 }
150
151 x = false;
152
153 f5(); f5(); f5();
154 %OptimizeFunctionOnNextCall(f5);
155 x = true;
156 count = 0;
157 Debug.setListener(listener);
158 f5();
159 Debug.setListener(null);
160 assertEquals(1, count);
OLDNEW
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698