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

Side by Side Diff: src/collection.js

Issue 293083005: Allow debugger to step into Map and Set forEach callbacks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/harmony/debug-stepin-collections-foreach.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "use strict"; 5 "use strict";
6 6
7 // This file relies on the fact that the following declaration has been made 7 // This file relies on the fact that the following declaration has been made
8 // in runtime.js: 8 // in runtime.js:
9 // var $Array = global.Array; 9 // var $Array = global.Array;
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 throw MakeTypeError('incompatible_method_receiver', 99 throw MakeTypeError('incompatible_method_receiver',
100 ['Set.prototype.forEach', this]); 100 ['Set.prototype.forEach', this]);
101 } 101 }
102 102
103 if (!IS_SPEC_FUNCTION(f)) { 103 if (!IS_SPEC_FUNCTION(f)) {
104 throw MakeTypeError('called_non_callable', [f]); 104 throw MakeTypeError('called_non_callable', [f]);
105 } 105 }
106 106
107 var iterator = %SetCreateIterator(this, ITERATOR_KIND_VALUES); 107 var iterator = %SetCreateIterator(this, ITERATOR_KIND_VALUES);
108 var entry; 108 var entry;
109 var stepping = %_DebugCallbackSupportsStepping(f);
109 while (!(entry = %SetIteratorNext(iterator)).done) { 110 while (!(entry = %SetIteratorNext(iterator)).done) {
111 if (stepping) %DebugPrepareStepInIfStepping(f);
110 %_CallFunction(receiver, entry.value, entry.value, this, f); 112 %_CallFunction(receiver, entry.value, entry.value, this, f);
111 } 113 }
112 } 114 }
113 115
114 116
115 // ------------------------------------------------------------------- 117 // -------------------------------------------------------------------
116 118
117 function SetUpSet() { 119 function SetUpSet() {
118 %CheckIsBootstrapping(); 120 %CheckIsBootstrapping();
119 121
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 throw MakeTypeError('incompatible_method_receiver', 210 throw MakeTypeError('incompatible_method_receiver',
209 ['Map.prototype.forEach', this]); 211 ['Map.prototype.forEach', this]);
210 } 212 }
211 213
212 if (!IS_SPEC_FUNCTION(f)) { 214 if (!IS_SPEC_FUNCTION(f)) {
213 throw MakeTypeError('called_non_callable', [f]); 215 throw MakeTypeError('called_non_callable', [f]);
214 } 216 }
215 217
216 var iterator = %MapCreateIterator(this, ITERATOR_KIND_ENTRIES); 218 var iterator = %MapCreateIterator(this, ITERATOR_KIND_ENTRIES);
217 var entry; 219 var entry;
220 var stepping = %_DebugCallbackSupportsStepping(f);
218 while (!(entry = %MapIteratorNext(iterator)).done) { 221 while (!(entry = %MapIteratorNext(iterator)).done) {
222 if (stepping) %DebugPrepareStepInIfStepping(f);
219 %_CallFunction(receiver, entry.value[1], entry.value[0], this, f); 223 %_CallFunction(receiver, entry.value[1], entry.value[0], this, f);
220 } 224 }
221 } 225 }
222 226
223 227
224 // ------------------------------------------------------------------- 228 // -------------------------------------------------------------------
225 229
226 function SetUpMap() { 230 function SetUpMap() {
227 %CheckIsBootstrapping(); 231 %CheckIsBootstrapping();
228 232
229 %SetCode($Map, MapConstructor); 233 %SetCode($Map, MapConstructor);
230 %FunctionSetPrototype($Map, new $Object()); 234 %FunctionSetPrototype($Map, new $Object());
231 %SetProperty($Map.prototype, "constructor", $Map, DONT_ENUM); 235 %SetProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
232 236
233 %FunctionSetLength(MapForEach, 1); 237 %FunctionSetLength(MapForEach, 1);
234 238
235 // Set up the non-enumerable functions on the Map prototype object. 239 // Set up the non-enumerable functions on the Map prototype object.
236 InstallGetter($Map.prototype, "size", MapGetSizeJS); 240 InstallGetter($Map.prototype, "size", MapGetSizeJS);
237 InstallFunctions($Map.prototype, DONT_ENUM, $Array( 241 InstallFunctions($Map.prototype, DONT_ENUM, $Array(
238 "get", MapGetJS, 242 "get", MapGetJS,
239 "set", MapSetJS, 243 "set", MapSetJS,
240 "has", MapHasJS, 244 "has", MapHasJS,
241 "delete", MapDeleteJS, 245 "delete", MapDeleteJS,
242 "clear", MapClearJS, 246 "clear", MapClearJS,
243 "forEach", MapForEach 247 "forEach", MapForEach
244 )); 248 ));
245 } 249 }
246 250
247 SetUpMap(); 251 SetUpMap();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/debug-stepin-collections-foreach.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698