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

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

Issue 1717893002: Remove the Proxy enumerate trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests 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/objects.cc ('k') | test/mjsunit/harmony/debug-stepin-proxies.js » ('j') | 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 --expose-debug-as debug 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) {
(...skipping 10 matching lines...) Expand all
21 %OptimizeFunctionOnNextCall(f); 21 %OptimizeFunctionOnNextCall(f);
22 assertEquals(["0","1","2"], f("bla")); 22 assertEquals(["0","1","2"], f("bla"));
23 23
24 // Test the lazy deopt points. 24 // Test the lazy deopt points.
25 var keys = ["a", "b", "c", "d"]; 25 var keys = ["a", "b", "c", "d"];
26 var has_keys = []; 26 var has_keys = [];
27 var deopt_has = false; 27 var deopt_has = false;
28 var deopt_enum = false; 28 var deopt_enum = false;
29 29
30 var handler = { 30 var handler = {
31 enumerate(target) { 31 ownKeys() {
32 if (deopt_enum) { 32 if (deopt_enum) {
33 %DeoptimizeFunction(f2); 33 %DeoptimizeFunction(f2);
34 deopt_enum = false; 34 deopt_enum = false;
35 } 35 }
36 return keys[Symbol.iterator](); 36 return keys;
37 }, 37 },
38 getOwnPropertyDescriptor() { return { enumerable: true, configurable: true }},
38 39
39 has(target, k) { 40 has(target, k) {
40 if (deopt_has) { 41 if (deopt_has) {
41 %DeoptimizeFunction(f2); 42 %DeoptimizeFunction(f2);
42 deopt_has = false; 43 deopt_has = false;
43 } 44 }
44 has_keys.push(k); 45 has_keys.push(k);
45 return {value: 10, configurable: true, writable: false, enumerable: true}; 46 return true;
46 } 47 }
47 }; 48 };
48 49
49 50
50 var proxy = new Proxy({}, handler); 51 var proxy = new Proxy({}, handler);
51 var o = {__proto__: proxy}; 52 var o = {__proto__: proxy};
52 53
53 function f2(o) { 54 function f2(o) {
54 var result = []; 55 var result = [];
55 for (var i in o) { 56 for (var i in o) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 130
130 var Debug = debug.Debug; 131 var Debug = debug.Debug;
131 132
132 function listener(event, exec_state, event_data, data) { 133 function listener(event, exec_state, event_data, data) {
133 if (event == Debug.DebugEvent.Break) { 134 if (event == Debug.DebugEvent.Break) {
134 %DeoptimizeFunction(f5); 135 %DeoptimizeFunction(f5);
135 } 136 }
136 } 137 }
137 138
138 var handler3 = { 139 var handler3 = {
139 enumerate(target) { 140 ownKeys() { return ["a", "b"] },
140 return ["a", "b"][Symbol.iterator](); 141 getOwnPropertyDescriptor() { return { enumerable: true, configurable: true }},
141 },
142 142
143 has(target, k) { 143 has(target, k) {
144 if (k == "a") count++; 144 if (k == "a") count++;
145 if (x) %ScheduleBreak(); 145 if (x) %ScheduleBreak();
146 return {value: 10, configurable: true, writable: false, enumerable: true}; 146 return true;
147 } 147 }
148 }; 148 };
149 149
150 var proxy3 = new Proxy({}, handler3); 150 var proxy3 = new Proxy({}, handler3);
151 var o3 = {__proto__: proxy3}; 151 var o3 = {__proto__: proxy3};
152 152
153 function f5() { 153 function f5() {
154 for (var p in o3) { 154 for (var p in o3) {
155 print(p); 155 print(p);
156 } 156 }
157 } 157 }
158 158
159 x = false; 159 x = false;
160 160
161 f5(); f5(); f5(); 161 f5(); f5(); f5();
162 %OptimizeFunctionOnNextCall(f5); 162 %OptimizeFunctionOnNextCall(f5);
163 x = true; 163 x = true;
164 count = 0; 164 count = 0;
165 Debug.setListener(listener); 165 Debug.setListener(listener);
166 f5(); 166 f5();
167 Debug.setListener(null); 167 Debug.setListener(null);
168 assertEquals(1, count); 168 assertEquals(1, count);
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/debug-stepin-proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698