| 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 // ------------------------------------------------------------------- |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 function GetExistingHash(key) { | 94 function GetExistingHash(key) { |
| 95 if (%_IsSmi(key)) { | 95 if (%_IsSmi(key)) { |
| 96 return ComputeIntegerHash(key, 0); | 96 return ComputeIntegerHash(key, 0); |
| 97 } | 97 } |
| 98 if (IS_STRING(key)) { | 98 if (IS_STRING(key)) { |
| 99 var field = %_StringGetRawHashField(key); | 99 var field = %_StringGetRawHashField(key); |
| 100 if ((field & 1 /* Name::kHashNotComputedMask */) === 0) { | 100 if ((field & 1 /* Name::kHashNotComputedMask */) === 0) { |
| 101 return field >>> 2 /* Name::kHashShift */; | 101 return field >>> 2 /* Name::kHashShift */; |
| 102 } | 102 } |
| 103 } else if (IS_SPEC_OBJECT(key) && !%_IsJSProxy(key) && !IS_GLOBAL(key)) { | 103 } else if (IS_RECEIVER(key) && !%_IsJSProxy(key) && !IS_GLOBAL(key)) { |
| 104 var hash = GET_PRIVATE(key, hashCodeSymbol); | 104 var hash = GET_PRIVATE(key, hashCodeSymbol); |
| 105 return hash; | 105 return hash; |
| 106 } | 106 } |
| 107 return %GenericHash(key); | 107 return %GenericHash(key); |
| 108 } | 108 } |
| 109 %SetForceInlineFlag(GetExistingHash); | 109 %SetForceInlineFlag(GetExistingHash); |
| 110 | 110 |
| 111 | 111 |
| 112 function GetHash(key) { | 112 function GetHash(key) { |
| 113 var hash = GetExistingHash(key); | 113 var hash = GetExistingHash(key); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 %_MapInitialize(this); | 288 %_MapInitialize(this); |
| 289 | 289 |
| 290 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 290 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 291 var adder = this.set; | 291 var adder = this.set; |
| 292 if (!IS_CALLABLE(adder)) { | 292 if (!IS_CALLABLE(adder)) { |
| 293 throw MakeTypeError(kPropertyNotFunction, adder, 'set', this); | 293 throw MakeTypeError(kPropertyNotFunction, adder, 'set', this); |
| 294 } | 294 } |
| 295 | 295 |
| 296 for (var nextItem of iterable) { | 296 for (var nextItem of iterable) { |
| 297 if (!IS_SPEC_OBJECT(nextItem)) { | 297 if (!IS_RECEIVER(nextItem)) { |
| 298 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); | 298 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); |
| 299 } | 299 } |
| 300 %_Call(adder, this, nextItem[0], nextItem[1]); | 300 %_Call(adder, this, nextItem[0], nextItem[1]); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 | 305 |
| 306 function MapGet(key) { | 306 function MapGet(key) { |
| 307 if (!IS_MAP(this)) { | 307 if (!IS_MAP(this)) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 "set_has", SetHas, | 469 "set_has", SetHas, |
| 470 "set_delete", SetDelete, | 470 "set_delete", SetDelete, |
| 471 ]); | 471 ]); |
| 472 | 472 |
| 473 utils.Export(function(to) { | 473 utils.Export(function(to) { |
| 474 to.GetExistingHash = GetExistingHash; | 474 to.GetExistingHash = GetExistingHash; |
| 475 to.GetHash = GetHash; | 475 to.GetHash = GetHash; |
| 476 }); | 476 }); |
| 477 | 477 |
| 478 }) | 478 }) |
| OLD | NEW |