| OLD | NEW |
| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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]; |
| 225 var new_receiver = needs_wrapper ? $toObject(receiver) : receiver; | 225 var new_receiver = needs_wrapper ? ToObject(receiver) : receiver; |
| 226 %_CallFunction(new_receiver, key, key, this, f); | 226 %_CallFunction(new_receiver, key, key, this, f); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 // ------------------------------------------------------------------- | 230 // ------------------------------------------------------------------- |
| 231 | 231 |
| 232 %SetCode(GlobalSet, SetConstructor); | 232 %SetCode(GlobalSet, SetConstructor); |
| 233 %FunctionSetLength(GlobalSet, 0); | 233 %FunctionSetLength(GlobalSet, 0); |
| 234 %FunctionSetPrototype(GlobalSet, new GlobalObject()); | 234 %FunctionSetPrototype(GlobalSet, new GlobalObject()); |
| 235 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM); | 235 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED; | 403 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED; |
| 404 } else if (!IS_UNDEFINED(receiver)) { | 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); |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 // ------------------------------------------------------------------- | 418 // ------------------------------------------------------------------- |
| 419 | 419 |
| 420 %SetCode(GlobalMap, MapConstructor); | 420 %SetCode(GlobalMap, MapConstructor); |
| 421 %FunctionSetLength(GlobalMap, 0); | 421 %FunctionSetLength(GlobalMap, 0); |
| 422 %FunctionSetPrototype(GlobalMap, new GlobalObject()); | 422 %FunctionSetPrototype(GlobalMap, new GlobalObject()); |
| 423 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); | 423 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); |
| 424 %AddNamedProperty( | 424 %AddNamedProperty( |
| 425 GlobalMap.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY); | 425 GlobalMap.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY); |
| 426 | 426 |
| 427 %FunctionSetLength(MapForEach, 1); | 427 %FunctionSetLength(MapForEach, 1); |
| 428 | 428 |
| 429 // Set up the non-enumerable functions on the Map prototype object. | 429 // Set up the non-enumerable functions on the Map prototype object. |
| 430 $installGetter(GlobalMap.prototype, "size", MapGetSize); | 430 $installGetter(GlobalMap.prototype, "size", MapGetSize); |
| 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 })(); |
| OLD | NEW |