| 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(global, utils) { | 5 (function(global, utils) { |
| 6 "use strict"; | 6 "use strict"; |
| 7 | 7 |
| 8 %CheckIsBootstrapping(); | 8 %CheckIsBootstrapping(); |
| 9 | 9 |
| 10 // ------------------------------------------------------------------- | 10 // ------------------------------------------------------------------- |
| 11 // Imports | 11 // Imports |
| 12 | 12 |
| 13 var GlobalMap = global.Map; | 13 var GlobalMap = global.Map; |
| 14 var GlobalObject = global.Object; | 14 var GlobalObject = global.Object; |
| 15 var GlobalSet = global.Set; | 15 var GlobalSet = global.Set; |
| 16 var hashCodeSymbol = utils.ImportNow("hash_code_symbol"); | 16 var hashCodeSymbol = utils.ImportNow("hash_code_symbol"); |
| 17 var MathRandom; | 17 var MathRandom; |
| 18 var MakeTypeError; | |
| 19 var MapIterator; | 18 var MapIterator; |
| 20 var NumberIsNaN; | 19 var NumberIsNaN; |
| 21 var SetIterator; | 20 var SetIterator; |
| 22 var speciesSymbol = utils.ImportNow("species_symbol"); | 21 var speciesSymbol = utils.ImportNow("species_symbol"); |
| 23 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 22 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
| 24 | 23 |
| 25 utils.Import(function(from) { | 24 utils.Import(function(from) { |
| 26 MathRandom = from.MathRandom; | 25 MathRandom = from.MathRandom; |
| 27 MakeTypeError = from.MakeTypeError; | |
| 28 MapIterator = from.MapIterator; | 26 MapIterator = from.MapIterator; |
| 29 NumberIsNaN = from.NumberIsNaN; | 27 NumberIsNaN = from.NumberIsNaN; |
| 30 SetIterator = from.SetIterator; | 28 SetIterator = from.SetIterator; |
| 31 }); | 29 }); |
| 32 | 30 |
| 33 // ------------------------------------------------------------------- | 31 // ------------------------------------------------------------------- |
| 34 | 32 |
| 35 function HashToEntry(table, hash, numBuckets) { | 33 function HashToEntry(table, hash, numBuckets) { |
| 36 var bucket = ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets); | 34 var bucket = ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets); |
| 37 return ORDERED_HASH_TABLE_BUCKET_AT(table, bucket); | 35 return ORDERED_HASH_TABLE_BUCKET_AT(table, bucket); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return hash; | 118 return hash; |
| 121 } | 119 } |
| 122 %SetForceInlineFlag(GetHash); | 120 %SetForceInlineFlag(GetHash); |
| 123 | 121 |
| 124 | 122 |
| 125 // ------------------------------------------------------------------- | 123 // ------------------------------------------------------------------- |
| 126 // Harmony Set | 124 // Harmony Set |
| 127 | 125 |
| 128 function SetConstructor(iterable) { | 126 function SetConstructor(iterable) { |
| 129 if (IS_UNDEFINED(new.target)) { | 127 if (IS_UNDEFINED(new.target)) { |
| 130 throw MakeTypeError(kConstructorNotFunction, "Set"); | 128 throw %make_type_error(kConstructorNotFunction, "Set"); |
| 131 } | 129 } |
| 132 | 130 |
| 133 %_SetInitialize(this); | 131 %_SetInitialize(this); |
| 134 | 132 |
| 135 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 133 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 136 var adder = this.add; | 134 var adder = this.add; |
| 137 if (!IS_CALLABLE(adder)) { | 135 if (!IS_CALLABLE(adder)) { |
| 138 throw MakeTypeError(kPropertyNotFunction, adder, 'add', this); | 136 throw %make_type_error(kPropertyNotFunction, adder, 'add', this); |
| 139 } | 137 } |
| 140 | 138 |
| 141 for (var value of iterable) { | 139 for (var value of iterable) { |
| 142 %_Call(adder, this, value); | 140 %_Call(adder, this, value); |
| 143 } | 141 } |
| 144 } | 142 } |
| 145 } | 143 } |
| 146 | 144 |
| 147 | 145 |
| 148 function SetAdd(key) { | 146 function SetAdd(key) { |
| 149 if (!IS_SET(this)) { | 147 if (!IS_SET(this)) { |
| 150 throw MakeTypeError(kIncompatibleMethodReceiver, 'Set.prototype.add', this); | 148 throw %make_type_error(kIncompatibleMethodReceiver, 'Set.prototype.add', thi
s); |
| 151 } | 149 } |
| 152 // Normalize -0 to +0 as required by the spec. | 150 // Normalize -0 to +0 as required by the spec. |
| 153 // Even though we use SameValueZero as the comparison for the keys we don't | 151 // Even though we use SameValueZero as the comparison for the keys we don't |
| 154 // want to ever store -0 as the key since the key is directly exposed when | 152 // want to ever store -0 as the key since the key is directly exposed when |
| 155 // doing iteration. | 153 // doing iteration. |
| 156 if (key === 0) { | 154 if (key === 0) { |
| 157 key = 0; | 155 key = 0; |
| 158 } | 156 } |
| 159 var table = %_JSCollectionGetTable(this); | 157 var table = %_JSCollectionGetTable(this); |
| 160 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); | 158 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 180 ORDERED_HASH_TABLE_SET_BUCKET_AT(table, bucket, entry); | 178 ORDERED_HASH_TABLE_SET_BUCKET_AT(table, bucket, entry); |
| 181 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof + 1); | 179 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof + 1); |
| 182 FIXED_ARRAY_SET(table, index, key); | 180 FIXED_ARRAY_SET(table, index, key); |
| 183 FIXED_ARRAY_SET_SMI(table, index + 1, chainEntry); | 181 FIXED_ARRAY_SET_SMI(table, index + 1, chainEntry); |
| 184 return this; | 182 return this; |
| 185 } | 183 } |
| 186 | 184 |
| 187 | 185 |
| 188 function SetHas(key) { | 186 function SetHas(key) { |
| 189 if (!IS_SET(this)) { | 187 if (!IS_SET(this)) { |
| 190 throw MakeTypeError(kIncompatibleMethodReceiver, 'Set.prototype.has', this); | 188 throw %make_type_error(kIncompatibleMethodReceiver, 'Set.prototype.has', thi
s); |
| 191 } | 189 } |
| 192 var table = %_JSCollectionGetTable(this); | 190 var table = %_JSCollectionGetTable(this); |
| 193 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); | 191 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
| 194 var hash = GetExistingHash(key); | 192 var hash = GetExistingHash(key); |
| 195 if (IS_UNDEFINED(hash)) return false; | 193 if (IS_UNDEFINED(hash)) return false; |
| 196 return SetFindEntry(table, numBuckets, key, hash) !== NOT_FOUND; | 194 return SetFindEntry(table, numBuckets, key, hash) !== NOT_FOUND; |
| 197 } | 195 } |
| 198 | 196 |
| 199 | 197 |
| 200 function SetDelete(key) { | 198 function SetDelete(key) { |
| 201 if (!IS_SET(this)) { | 199 if (!IS_SET(this)) { |
| 202 throw MakeTypeError(kIncompatibleMethodReceiver, | 200 throw %make_type_error(kIncompatibleMethodReceiver, |
| 203 'Set.prototype.delete', this); | 201 'Set.prototype.delete', this); |
| 204 } | 202 } |
| 205 var table = %_JSCollectionGetTable(this); | 203 var table = %_JSCollectionGetTable(this); |
| 206 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); | 204 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
| 207 var hash = GetExistingHash(key); | 205 var hash = GetExistingHash(key); |
| 208 if (IS_UNDEFINED(hash)) return false; | 206 if (IS_UNDEFINED(hash)) return false; |
| 209 var entry = SetFindEntry(table, numBuckets, key, hash); | 207 var entry = SetFindEntry(table, numBuckets, key, hash); |
| 210 if (entry === NOT_FOUND) return false; | 208 if (entry === NOT_FOUND) return false; |
| 211 | 209 |
| 212 var nof = ORDERED_HASH_TABLE_ELEMENT_COUNT(table) - 1; | 210 var nof = ORDERED_HASH_TABLE_ELEMENT_COUNT(table) - 1; |
| 213 var nod = ORDERED_HASH_TABLE_DELETED_COUNT(table) + 1; | 211 var nod = ORDERED_HASH_TABLE_DELETED_COUNT(table) + 1; |
| 214 var index = ORDERED_HASH_SET_ENTRY_TO_INDEX(entry, numBuckets); | 212 var index = ORDERED_HASH_SET_ENTRY_TO_INDEX(entry, numBuckets); |
| 215 FIXED_ARRAY_SET(table, index, %_TheHole()); | 213 FIXED_ARRAY_SET(table, index, %_TheHole()); |
| 216 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof); | 214 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof); |
| 217 ORDERED_HASH_TABLE_SET_DELETED_COUNT(table, nod); | 215 ORDERED_HASH_TABLE_SET_DELETED_COUNT(table, nod); |
| 218 if (nof < (numBuckets >>> 1)) %SetShrink(this); | 216 if (nof < (numBuckets >>> 1)) %SetShrink(this); |
| 219 return true; | 217 return true; |
| 220 } | 218 } |
| 221 | 219 |
| 222 | 220 |
| 223 function SetGetSize() { | 221 function SetGetSize() { |
| 224 if (!IS_SET(this)) { | 222 if (!IS_SET(this)) { |
| 225 throw MakeTypeError(kIncompatibleMethodReceiver, | 223 throw %make_type_error(kIncompatibleMethodReceiver, |
| 226 'Set.prototype.size', this); | 224 'Set.prototype.size', this); |
| 227 } | 225 } |
| 228 var table = %_JSCollectionGetTable(this); | 226 var table = %_JSCollectionGetTable(this); |
| 229 return ORDERED_HASH_TABLE_ELEMENT_COUNT(table); | 227 return ORDERED_HASH_TABLE_ELEMENT_COUNT(table); |
| 230 } | 228 } |
| 231 | 229 |
| 232 | 230 |
| 233 function SetClearJS() { | 231 function SetClearJS() { |
| 234 if (!IS_SET(this)) { | 232 if (!IS_SET(this)) { |
| 235 throw MakeTypeError(kIncompatibleMethodReceiver, | 233 throw %make_type_error(kIncompatibleMethodReceiver, |
| 236 'Set.prototype.clear', this); | 234 'Set.prototype.clear', this); |
| 237 } | 235 } |
| 238 %_SetClear(this); | 236 %_SetClear(this); |
| 239 } | 237 } |
| 240 | 238 |
| 241 | 239 |
| 242 function SetForEach(f, receiver) { | 240 function SetForEach(f, receiver) { |
| 243 if (!IS_SET(this)) { | 241 if (!IS_SET(this)) { |
| 244 throw MakeTypeError(kIncompatibleMethodReceiver, | 242 throw %make_type_error(kIncompatibleMethodReceiver, |
| 245 'Set.prototype.forEach', this); | 243 'Set.prototype.forEach', this); |
| 246 } | 244 } |
| 247 | 245 |
| 248 if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); | 246 if (!IS_CALLABLE(f)) throw %make_type_error(kCalledNonCallable, f); |
| 249 | 247 |
| 250 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); | 248 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); |
| 251 var key; | 249 var key; |
| 252 var value_array = [UNDEFINED]; | 250 var value_array = [UNDEFINED]; |
| 253 while (%SetIteratorNext(iterator, value_array)) { | 251 while (%SetIteratorNext(iterator, value_array)) { |
| 254 key = value_array[0]; | 252 key = value_array[0]; |
| 255 %_Call(f, receiver, key, key, this); | 253 %_Call(f, receiver, key, key, this); |
| 256 } | 254 } |
| 257 } | 255 } |
| 258 | 256 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 284 "clear", SetClearJS, | 282 "clear", SetClearJS, |
| 285 "forEach", SetForEach | 283 "forEach", SetForEach |
| 286 ]); | 284 ]); |
| 287 | 285 |
| 288 | 286 |
| 289 // ------------------------------------------------------------------- | 287 // ------------------------------------------------------------------- |
| 290 // Harmony Map | 288 // Harmony Map |
| 291 | 289 |
| 292 function MapConstructor(iterable) { | 290 function MapConstructor(iterable) { |
| 293 if (IS_UNDEFINED(new.target)) { | 291 if (IS_UNDEFINED(new.target)) { |
| 294 throw MakeTypeError(kConstructorNotFunction, "Map"); | 292 throw %make_type_error(kConstructorNotFunction, "Map"); |
| 295 } | 293 } |
| 296 | 294 |
| 297 %_MapInitialize(this); | 295 %_MapInitialize(this); |
| 298 | 296 |
| 299 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 297 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 300 var adder = this.set; | 298 var adder = this.set; |
| 301 if (!IS_CALLABLE(adder)) { | 299 if (!IS_CALLABLE(adder)) { |
| 302 throw MakeTypeError(kPropertyNotFunction, adder, 'set', this); | 300 throw %make_type_error(kPropertyNotFunction, adder, 'set', this); |
| 303 } | 301 } |
| 304 | 302 |
| 305 for (var nextItem of iterable) { | 303 for (var nextItem of iterable) { |
| 306 if (!IS_RECEIVER(nextItem)) { | 304 if (!IS_RECEIVER(nextItem)) { |
| 307 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); | 305 throw %make_type_error(kIteratorValueNotAnObject, nextItem); |
| 308 } | 306 } |
| 309 %_Call(adder, this, nextItem[0], nextItem[1]); | 307 %_Call(adder, this, nextItem[0], nextItem[1]); |
| 310 } | 308 } |
| 311 } | 309 } |
| 312 } | 310 } |
| 313 | 311 |
| 314 | 312 |
| 315 function MapGet(key) { | 313 function MapGet(key) { |
| 316 if (!IS_MAP(this)) { | 314 if (!IS_MAP(this)) { |
| 317 throw MakeTypeError(kIncompatibleMethodReceiver, | 315 throw %make_type_error(kIncompatibleMethodReceiver, |
| 318 'Map.prototype.get', this); | 316 'Map.prototype.get', this); |
| 319 } | 317 } |
| 320 var table = %_JSCollectionGetTable(this); | 318 var table = %_JSCollectionGetTable(this); |
| 321 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); | 319 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
| 322 var hash = GetExistingHash(key); | 320 var hash = GetExistingHash(key); |
| 323 if (IS_UNDEFINED(hash)) return UNDEFINED; | 321 if (IS_UNDEFINED(hash)) return UNDEFINED; |
| 324 var entry = MapFindEntry(table, numBuckets, key, hash); | 322 var entry = MapFindEntry(table, numBuckets, key, hash); |
| 325 if (entry === NOT_FOUND) return UNDEFINED; | 323 if (entry === NOT_FOUND) return UNDEFINED; |
| 326 return ORDERED_HASH_MAP_VALUE_AT(table, entry, numBuckets); | 324 return ORDERED_HASH_MAP_VALUE_AT(table, entry, numBuckets); |
| 327 } | 325 } |
| 328 | 326 |
| 329 | 327 |
| 330 function MapSet(key, value) { | 328 function MapSet(key, value) { |
| 331 if (!IS_MAP(this)) { | 329 if (!IS_MAP(this)) { |
| 332 throw MakeTypeError(kIncompatibleMethodReceiver, | 330 throw %make_type_error(kIncompatibleMethodReceiver, |
| 333 'Map.prototype.set', this); | 331 'Map.prototype.set', this); |
| 334 } | 332 } |
| 335 // Normalize -0 to +0 as required by the spec. | 333 // Normalize -0 to +0 as required by the spec. |
| 336 // Even though we use SameValueZero as the comparison for the keys we don't | 334 // Even though we use SameValueZero as the comparison for the keys we don't |
| 337 // want to ever store -0 as the key since the key is directly exposed when | 335 // want to ever store -0 as the key since the key is directly exposed when |
| 338 // doing iteration. | 336 // doing iteration. |
| 339 if (key === 0) { | 337 if (key === 0) { |
| 340 key = 0; | 338 key = 0; |
| 341 } | 339 } |
| 342 | 340 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 370 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof + 1); | 368 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof + 1); |
| 371 FIXED_ARRAY_SET(table, index, key); | 369 FIXED_ARRAY_SET(table, index, key); |
| 372 FIXED_ARRAY_SET(table, index + 1, value); | 370 FIXED_ARRAY_SET(table, index + 1, value); |
| 373 FIXED_ARRAY_SET(table, index + 2, chainEntry); | 371 FIXED_ARRAY_SET(table, index + 2, chainEntry); |
| 374 return this; | 372 return this; |
| 375 } | 373 } |
| 376 | 374 |
| 377 | 375 |
| 378 function MapHas(key) { | 376 function MapHas(key) { |
| 379 if (!IS_MAP(this)) { | 377 if (!IS_MAP(this)) { |
| 380 throw MakeTypeError(kIncompatibleMethodReceiver, | 378 throw %make_type_error(kIncompatibleMethodReceiver, |
| 381 'Map.prototype.has', this); | 379 'Map.prototype.has', this); |
| 382 } | 380 } |
| 383 var table = %_JSCollectionGetTable(this); | 381 var table = %_JSCollectionGetTable(this); |
| 384 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); | 382 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
| 385 var hash = GetHash(key); | 383 var hash = GetHash(key); |
| 386 return MapFindEntry(table, numBuckets, key, hash) !== NOT_FOUND; | 384 return MapFindEntry(table, numBuckets, key, hash) !== NOT_FOUND; |
| 387 } | 385 } |
| 388 | 386 |
| 389 | 387 |
| 390 function MapDelete(key) { | 388 function MapDelete(key) { |
| 391 if (!IS_MAP(this)) { | 389 if (!IS_MAP(this)) { |
| 392 throw MakeTypeError(kIncompatibleMethodReceiver, | 390 throw %make_type_error(kIncompatibleMethodReceiver, |
| 393 'Map.prototype.delete', this); | 391 'Map.prototype.delete', this); |
| 394 } | 392 } |
| 395 var table = %_JSCollectionGetTable(this); | 393 var table = %_JSCollectionGetTable(this); |
| 396 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); | 394 var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
| 397 var hash = GetHash(key); | 395 var hash = GetHash(key); |
| 398 var entry = MapFindEntry(table, numBuckets, key, hash); | 396 var entry = MapFindEntry(table, numBuckets, key, hash); |
| 399 if (entry === NOT_FOUND) return false; | 397 if (entry === NOT_FOUND) return false; |
| 400 | 398 |
| 401 var nof = ORDERED_HASH_TABLE_ELEMENT_COUNT(table) - 1; | 399 var nof = ORDERED_HASH_TABLE_ELEMENT_COUNT(table) - 1; |
| 402 var nod = ORDERED_HASH_TABLE_DELETED_COUNT(table) + 1; | 400 var nod = ORDERED_HASH_TABLE_DELETED_COUNT(table) + 1; |
| 403 var index = ORDERED_HASH_MAP_ENTRY_TO_INDEX(entry, numBuckets); | 401 var index = ORDERED_HASH_MAP_ENTRY_TO_INDEX(entry, numBuckets); |
| 404 FIXED_ARRAY_SET(table, index, %_TheHole()); | 402 FIXED_ARRAY_SET(table, index, %_TheHole()); |
| 405 FIXED_ARRAY_SET(table, index + 1, %_TheHole()); | 403 FIXED_ARRAY_SET(table, index + 1, %_TheHole()); |
| 406 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof); | 404 ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, nof); |
| 407 ORDERED_HASH_TABLE_SET_DELETED_COUNT(table, nod); | 405 ORDERED_HASH_TABLE_SET_DELETED_COUNT(table, nod); |
| 408 if (nof < (numBuckets >>> 1)) %MapShrink(this); | 406 if (nof < (numBuckets >>> 1)) %MapShrink(this); |
| 409 return true; | 407 return true; |
| 410 } | 408 } |
| 411 | 409 |
| 412 | 410 |
| 413 function MapGetSize() { | 411 function MapGetSize() { |
| 414 if (!IS_MAP(this)) { | 412 if (!IS_MAP(this)) { |
| 415 throw MakeTypeError(kIncompatibleMethodReceiver, | 413 throw %make_type_error(kIncompatibleMethodReceiver, |
| 416 'Map.prototype.size', this); | 414 'Map.prototype.size', this); |
| 417 } | 415 } |
| 418 var table = %_JSCollectionGetTable(this); | 416 var table = %_JSCollectionGetTable(this); |
| 419 return ORDERED_HASH_TABLE_ELEMENT_COUNT(table); | 417 return ORDERED_HASH_TABLE_ELEMENT_COUNT(table); |
| 420 } | 418 } |
| 421 | 419 |
| 422 | 420 |
| 423 function MapClearJS() { | 421 function MapClearJS() { |
| 424 if (!IS_MAP(this)) { | 422 if (!IS_MAP(this)) { |
| 425 throw MakeTypeError(kIncompatibleMethodReceiver, | 423 throw %make_type_error(kIncompatibleMethodReceiver, |
| 426 'Map.prototype.clear', this); | 424 'Map.prototype.clear', this); |
| 427 } | 425 } |
| 428 %_MapClear(this); | 426 %_MapClear(this); |
| 429 } | 427 } |
| 430 | 428 |
| 431 | 429 |
| 432 function MapForEach(f, receiver) { | 430 function MapForEach(f, receiver) { |
| 433 if (!IS_MAP(this)) { | 431 if (!IS_MAP(this)) { |
| 434 throw MakeTypeError(kIncompatibleMethodReceiver, | 432 throw %make_type_error(kIncompatibleMethodReceiver, |
| 435 'Map.prototype.forEach', this); | 433 'Map.prototype.forEach', this); |
| 436 } | 434 } |
| 437 | 435 |
| 438 if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); | 436 if (!IS_CALLABLE(f)) throw %make_type_error(kCalledNonCallable, f); |
| 439 | 437 |
| 440 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); | 438 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); |
| 441 var value_array = [UNDEFINED, UNDEFINED]; | 439 var value_array = [UNDEFINED, UNDEFINED]; |
| 442 while (%MapIteratorNext(iterator, value_array)) { | 440 while (%MapIteratorNext(iterator, value_array)) { |
| 443 %_Call(f, receiver, value_array[1], value_array[0], this); | 441 %_Call(f, receiver, value_array[1], value_array[0], this); |
| 444 } | 442 } |
| 445 } | 443 } |
| 446 | 444 |
| 447 | 445 |
| 448 function MapSpecies() { | 446 function MapSpecies() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 "set_has", SetHas, | 483 "set_has", SetHas, |
| 486 "set_delete", SetDelete, | 484 "set_delete", SetDelete, |
| 487 ]); | 485 ]); |
| 488 | 486 |
| 489 utils.Export(function(to) { | 487 utils.Export(function(to) { |
| 490 to.GetExistingHash = GetExistingHash; | 488 to.GetExistingHash = GetExistingHash; |
| 491 to.GetHash = GetHash; | 489 to.GetHash = GetHash; |
| 492 }); | 490 }); |
| 493 | 491 |
| 494 }) | 492 }) |
| OLD | NEW |