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

Side by Side Diff: src/collection.js

Issue 1266013006: [stubs] Unify (and optimize) implementation of ToObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing support for %_ToObject in TurboFan and Crankshaft. Created 5 years, 4 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/code-stubs-hydrogen.cc ('k') | src/compiler/js-generic-lowering.cc » ('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 var $getHash; 5 var $getHash;
6 var $getExistingHash; 6 var $getExistingHash;
7 var $mapSet; 7 var $mapSet;
8 var $mapHas; 8 var $mapHas;
9 var $mapDelete; 9 var $mapDelete;
10 var $setAdd; 10 var $setAdd;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); 261 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver);
262 } 262 }
263 263
264 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); 264 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES);
265 var key; 265 var key;
266 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); 266 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
267 var value_array = [UNDEFINED]; 267 var value_array = [UNDEFINED];
268 while (%SetIteratorNext(iterator, value_array)) { 268 while (%SetIteratorNext(iterator, value_array)) {
269 if (stepping) %DebugPrepareStepInIfStepping(f); 269 if (stepping) %DebugPrepareStepInIfStepping(f);
270 key = value_array[0]; 270 key = value_array[0];
271 var new_receiver = needs_wrapper ? $toObject(receiver) : receiver; 271 var new_receiver = needs_wrapper ? TO_OBJECT(receiver) : receiver;
272 %_CallFunction(new_receiver, key, key, this, f); 272 %_CallFunction(new_receiver, key, key, this, f);
273 } 273 }
274 } 274 }
275 275
276 // ------------------------------------------------------------------- 276 // -------------------------------------------------------------------
277 277
278 %SetCode(GlobalSet, SetConstructor); 278 %SetCode(GlobalSet, SetConstructor);
279 %FunctionSetLength(GlobalSet, 0); 279 %FunctionSetLength(GlobalSet, 0);
280 %FunctionSetPrototype(GlobalSet, new GlobalObject()); 280 %FunctionSetPrototype(GlobalSet, new GlobalObject());
281 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM); 281 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED; 450 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED;
451 } else if (!IS_UNDEFINED(receiver)) { 451 } else if (!IS_UNDEFINED(receiver)) {
452 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); 452 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver);
453 } 453 }
454 454
455 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); 455 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES);
456 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); 456 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
457 var value_array = [UNDEFINED, UNDEFINED]; 457 var value_array = [UNDEFINED, UNDEFINED];
458 while (%MapIteratorNext(iterator, value_array)) { 458 while (%MapIteratorNext(iterator, value_array)) {
459 if (stepping) %DebugPrepareStepInIfStepping(f); 459 if (stepping) %DebugPrepareStepInIfStepping(f);
460 var new_receiver = needs_wrapper ? $toObject(receiver) : receiver; 460 var new_receiver = needs_wrapper ? TO_OBJECT(receiver) : receiver;
461 %_CallFunction(new_receiver, value_array[1], value_array[0], this, f); 461 %_CallFunction(new_receiver, value_array[1], value_array[0], this, f);
462 } 462 }
463 } 463 }
464 464
465 // ------------------------------------------------------------------- 465 // -------------------------------------------------------------------
466 466
467 %SetCode(GlobalMap, MapConstructor); 467 %SetCode(GlobalMap, MapConstructor);
468 %FunctionSetLength(GlobalMap, 0); 468 %FunctionSetLength(GlobalMap, 0);
469 %FunctionSetPrototype(GlobalMap, new GlobalObject()); 469 %FunctionSetPrototype(GlobalMap, new GlobalObject());
470 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); 470 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 $setFromArray = function(array) { 509 $setFromArray = function(array) {
510 var set = new GlobalSet; 510 var set = new GlobalSet;
511 var length = array.length; 511 var length = array.length;
512 for (var i = 0; i < length; ++i) { 512 for (var i = 0; i < length; ++i) {
513 %_CallFunction(set, array[i], SetAdd); 513 %_CallFunction(set, array[i], SetAdd);
514 } 514 }
515 return set; 515 return set;
516 }; 516 };
517 517
518 }) 518 })
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698