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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return %GenericHash(key); | 84 return %GenericHash(key); |
85 } | 85 } |
86 %SetInlineBuiltinFlag(GetHash); | 86 %SetInlineBuiltinFlag(GetHash); |
87 | 87 |
88 | 88 |
89 // ------------------------------------------------------------------- | 89 // ------------------------------------------------------------------- |
90 // Harmony Set | 90 // Harmony Set |
91 | 91 |
92 function SetConstructor(iterable) { | 92 function SetConstructor(iterable) { |
93 if (!%_IsConstructCall()) { | 93 if (!%_IsConstructCall()) { |
94 throw MakeTypeError('constructor_not_function', ['Set']); | 94 throw MakeTypeError(kConstructorNotFunction, "Set"); |
95 } | 95 } |
96 | 96 |
97 %_SetInitialize(this); | 97 %_SetInitialize(this); |
98 | 98 |
99 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 99 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
100 var adder = this.add; | 100 var adder = this.add; |
101 if (!IS_SPEC_FUNCTION(adder)) { | 101 if (!IS_SPEC_FUNCTION(adder)) { |
102 throw MakeTypeError(kPropertyNotFunction, 'add', this); | 102 throw MakeTypeError(kPropertyNotFunction, 'add', this); |
103 } | 103 } |
104 | 104 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 "clear", SetClearJS, | 247 "clear", SetClearJS, |
248 "forEach", SetForEach | 248 "forEach", SetForEach |
249 ]); | 249 ]); |
250 | 250 |
251 | 251 |
252 // ------------------------------------------------------------------- | 252 // ------------------------------------------------------------------- |
253 // Harmony Map | 253 // Harmony Map |
254 | 254 |
255 function MapConstructor(iterable) { | 255 function MapConstructor(iterable) { |
256 if (!%_IsConstructCall()) { | 256 if (!%_IsConstructCall()) { |
257 throw MakeTypeError('constructor_not_function', ['Map']); | 257 throw MakeTypeError(kConstructorNotFunction, "Map"); |
258 } | 258 } |
259 | 259 |
260 %_MapInitialize(this); | 260 %_MapInitialize(this); |
261 | 261 |
262 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 262 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
263 var adder = this.set; | 263 var adder = this.set; |
264 if (!IS_SPEC_FUNCTION(adder)) { | 264 if (!IS_SPEC_FUNCTION(adder)) { |
265 throw MakeTypeError(kPropertyNotFunction, 'set', this); | 265 throw MakeTypeError(kPropertyNotFunction, 'set', this); |
266 } | 266 } |
267 | 267 |
268 for (var nextItem of iterable) { | 268 for (var nextItem of iterable) { |
269 if (!IS_SPEC_OBJECT(nextItem)) { | 269 if (!IS_SPEC_OBJECT(nextItem)) { |
270 throw MakeTypeError('iterator_value_not_an_object', [nextItem]); | 270 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); |
271 } | 271 } |
272 %_CallFunction(this, nextItem[0], nextItem[1], adder); | 272 %_CallFunction(this, nextItem[0], nextItem[1], adder); |
273 } | 273 } |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 function MapGet(key) { | 278 function MapGet(key) { |
279 if (!IS_MAP(this)) { | 279 if (!IS_MAP(this)) { |
280 throw MakeTypeError(kIncompatibleMethodReceiver, | 280 throw MakeTypeError(kIncompatibleMethodReceiver, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |