| 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 var $getHash; | 5 var $getHash; |
| 6 var $getExistingHash; | 6 var $getExistingHash; |
| 7 | 7 |
| 8 (function(global, utils) { | 8 (function(global, utils) { |
| 9 "use strict"; | 9 "use strict"; |
| 10 | 10 |
| 11 %CheckIsBootstrapping(); | 11 %CheckIsBootstrapping(); |
| 12 | 12 |
| 13 // ------------------------------------------------------------------- | 13 // ------------------------------------------------------------------- |
| 14 // Imports | 14 // Imports |
| 15 | 15 |
| 16 var GlobalMap = global.Map; | 16 var GlobalMap = global.Map; |
| 17 var GlobalObject = global.Object; | 17 var GlobalObject = global.Object; |
| 18 var GlobalSet = global.Set; | 18 var GlobalSet = global.Set; |
| 19 var hashCodeSymbol = utils.GetPrivateSymbol("hash_code_symbol"); |
| 19 var IntRandom; | 20 var IntRandom; |
| 20 | 21 |
| 21 utils.Import(function(from) { | 22 utils.Import(function(from) { |
| 22 IntRandom = from.IntRandom; | 23 IntRandom = from.IntRandom; |
| 23 }); | 24 }); |
| 24 | 25 |
| 25 var NumberIsNaN; | 26 var NumberIsNaN; |
| 26 | 27 |
| 27 utils.Import(function(from) { | 28 utils.Import(function(from) { |
| 28 NumberIsNaN = from.NumberIsNaN; | 29 NumberIsNaN = from.NumberIsNaN; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 hash = ~hash + (hash << 15); // hash = (hash << 15) - hash - 1; | 84 hash = ~hash + (hash << 15); // hash = (hash << 15) - hash - 1; |
| 84 hash = hash ^ (hash >>> 12); | 85 hash = hash ^ (hash >>> 12); |
| 85 hash = hash + (hash << 2); | 86 hash = hash + (hash << 2); |
| 86 hash = hash ^ (hash >>> 4); | 87 hash = hash ^ (hash >>> 4); |
| 87 hash = (hash * 2057) | 0; // hash = (hash + (hash << 3)) + (hash << 11); | 88 hash = (hash * 2057) | 0; // hash = (hash + (hash << 3)) + (hash << 11); |
| 88 hash = hash ^ (hash >>> 16); | 89 hash = hash ^ (hash >>> 16); |
| 89 return hash & 0x3fffffff; | 90 return hash & 0x3fffffff; |
| 90 } | 91 } |
| 91 %SetForceInlineFlag(ComputeIntegerHash); | 92 %SetForceInlineFlag(ComputeIntegerHash); |
| 92 | 93 |
| 93 var hashCodeSymbol = GLOBAL_PRIVATE("hash_code_symbol"); | |
| 94 | |
| 95 function GetExistingHash(key) { | 94 function GetExistingHash(key) { |
| 96 if (%_IsSmi(key)) { | 95 if (%_IsSmi(key)) { |
| 97 return ComputeIntegerHash(key, 0); | 96 return ComputeIntegerHash(key, 0); |
| 98 } | 97 } |
| 99 if (IS_STRING(key)) { | 98 if (IS_STRING(key)) { |
| 100 var field = %_StringGetRawHashField(key); | 99 var field = %_StringGetRawHashField(key); |
| 101 if ((field & 1 /* Name::kHashNotComputedMask */) === 0) { | 100 if ((field & 1 /* Name::kHashNotComputedMask */) === 0) { |
| 102 return field >>> 2 /* Name::kHashShift */; | 101 return field >>> 2 /* Name::kHashShift */; |
| 103 } | 102 } |
| 104 } else if (IS_SPEC_OBJECT(key) && !%_IsJSProxy(key) && !IS_GLOBAL(key)) { | 103 } else if (IS_SPEC_OBJECT(key) && !%_IsJSProxy(key) && !IS_GLOBAL(key)) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 to.MapHas = MapHas; | 508 to.MapHas = MapHas; |
| 510 to.MapDelete = MapDelete; | 509 to.MapDelete = MapDelete; |
| 511 to.SetAdd = SetAdd; | 510 to.SetAdd = SetAdd; |
| 512 to.SetHas = SetHas; | 511 to.SetHas = SetHas; |
| 513 to.SetDelete = SetDelete; | 512 to.SetDelete = SetDelete; |
| 514 to.MapFromArray = MapFromArray; | 513 to.MapFromArray = MapFromArray; |
| 515 to.SetFromArray = SetFromArray; | 514 to.SetFromArray = SetFromArray; |
| 516 }); | 515 }); |
| 517 | 516 |
| 518 }) | 517 }) |
| OLD | NEW |