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

Side by Side Diff: src/collection.js

Issue 1116003005: Remove GetDefaultReceiver, pass in undefined to sloppy-mode functions instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make sure it does TO_OBJECT Created 5 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
« no previous file with comments | « src/array.js ('k') | src/harmony-array.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 (function() { 5 (function() {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 203
204 function SetForEach(f, receiver) { 204 function SetForEach(f, receiver) {
205 if (!IS_SET(this)) { 205 if (!IS_SET(this)) {
206 throw MakeTypeError(kIncompatibleMethodReceiver, 206 throw MakeTypeError(kIncompatibleMethodReceiver,
207 'Set.prototype.forEach', this); 207 'Set.prototype.forEach', this);
208 } 208 }
209 209
210 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); 210 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
211 var needs_wrapper = false; 211 var needs_wrapper = false;
212 if (IS_NULL_OR_UNDEFINED(receiver)) { 212 if (IS_NULL(receiver)) {
213 receiver = %GetDefaultReceiver(f) || receiver; 213 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
214 } else { 214 } else if (!IS_UNDEFINED(receiver)) {
215 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); 215 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver);
216 } 216 }
217 217
218 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); 218 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES);
219 var key; 219 var key;
220 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); 220 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
221 var value_array = [UNDEFINED]; 221 var value_array = [UNDEFINED];
222 while (%SetIteratorNext(iterator, value_array)) { 222 while (%SetIteratorNext(iterator, value_array)) {
223 if (stepping) %DebugPrepareStepInIfStepping(f); 223 if (stepping) %DebugPrepareStepInIfStepping(f);
224 key = value_array[0]; 224 key = value_array[0];
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 393
394 function MapForEach(f, receiver) { 394 function MapForEach(f, receiver) {
395 if (!IS_MAP(this)) { 395 if (!IS_MAP(this)) {
396 throw MakeTypeError(kIncompatibleMethodReceiver, 396 throw MakeTypeError(kIncompatibleMethodReceiver,
397 'Map.prototype.forEach', this); 397 'Map.prototype.forEach', this);
398 } 398 }
399 399
400 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); 400 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
401 var needs_wrapper = false; 401 var needs_wrapper = false;
402 if (IS_NULL_OR_UNDEFINED(receiver)) { 402 if (IS_NULL(receiver)) {
403 receiver = %GetDefaultReceiver(f) || receiver; 403 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
404 } else { 404 } else if (!IS_UNDEFINED(receiver)) {
405 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); 405 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver);
406 } 406 }
407 407
408 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); 408 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES);
409 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); 409 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
410 var value_array = [UNDEFINED, UNDEFINED]; 410 var value_array = [UNDEFINED, UNDEFINED];
411 while (%MapIteratorNext(iterator, value_array)) { 411 while (%MapIteratorNext(iterator, value_array)) {
412 if (stepping) %DebugPrepareStepInIfStepping(f); 412 if (stepping) %DebugPrepareStepInIfStepping(f);
413 var new_receiver = needs_wrapper ? ToObject(receiver) : receiver; 413 var new_receiver = needs_wrapper ? ToObject(receiver) : receiver;
414 %_CallFunction(new_receiver, value_array[1], value_array[0], this, f); 414 %_CallFunction(new_receiver, value_array[1], value_array[0], this, f);
(...skipping 16 matching lines...) Expand all
431 InstallFunctions(GlobalMap.prototype, DONT_ENUM, [ 431 InstallFunctions(GlobalMap.prototype, DONT_ENUM, [
432 "get", MapGet, 432 "get", MapGet,
433 "set", MapSet, 433 "set", MapSet,
434 "has", MapHas, 434 "has", MapHas,
435 "delete", MapDelete, 435 "delete", MapDelete,
436 "clear", MapClearJS, 436 "clear", MapClearJS,
437 "forEach", MapForEach 437 "forEach", MapForEach
438 ]); 438 ]);
439 439
440 })(); 440 })();
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/harmony-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698