Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 977 // r0 - holds the untagged key on entry and holds the hash once computed. | 977 // r0 - holds the untagged key on entry and holds the hash once computed. |
| 978 // | 978 // |
| 979 // r1 - used to hold the capacity mask of the dictionary | 979 // r1 - used to hold the capacity mask of the dictionary |
| 980 // | 980 // |
| 981 // r2 - used for the index into the dictionary. | 981 // r2 - used for the index into the dictionary. |
| 982 // | 982 // |
| 983 // result - holds the result on exit if the load succeeds and we fall through. | 983 // result - holds the result on exit if the load succeeds and we fall through. |
| 984 | 984 |
| 985 Label done; | 985 Label done; |
| 986 | 986 |
| 987 // First of all lets assign to r1 value of HashSeed | |
| 988 if (Serializer::enabled()) { | |
| 989 ExternalReference roots_array_start = | |
| 990 ExternalReference::roots_array_start(isolate()); | |
| 991 mov(r1, Immediate(Heap::kStringHashSeedRootIndex)); | |
| 992 mov(r1, Operand::StaticArray(r1, | |
| 993 times_pointer_size, | |
| 994 roots_array_start)); | |
| 995 } else { | |
| 996 int32_t seed = isolate()->heap()->StringHashSeed(); | |
| 997 lea(r1, Operand(seed, RelocInfo::NONE)); | |
|
Erik Corry
2012/01/09 23:52:48
No reason to use lea here when mov would do.
| |
| 998 } | |
| 999 | |
| 1000 // Xor original key with a seed | |
| 1001 xor_(r1, r0); | |
| 1002 | |
| 987 // Compute the hash code from the untagged key. This must be kept in sync | 1003 // Compute the hash code from the untagged key. This must be kept in sync |
| 988 // with ComputeIntegerHash in utils.h. | 1004 // with ComputeIntegerHash in utils.h. |
| 989 // | 1005 // |
| 990 // hash = ~hash + (hash << 15); | 1006 // hash = ~hash + (hash << 15); |
| 991 mov(r1, r0); | |
| 992 not_(r0); | 1007 not_(r0); |
| 993 shl(r1, 15); | 1008 shl(r1, 15); |
| 994 add(r0, r1); | 1009 add(r0, r1); |
| 995 // hash = hash ^ (hash >> 12); | 1010 // hash = hash ^ (hash >> 12); |
| 996 mov(r1, r0); | 1011 mov(r1, r0); |
| 997 shr(r1, 12); | 1012 shr(r1, 12); |
| 998 xor_(r0, r1); | 1013 xor_(r0, r1); |
| 999 // hash = hash + (hash << 2); | 1014 // hash = hash + (hash << 2); |
| 1000 lea(r0, Operand(r0, r0, times_4, 0)); | 1015 lea(r0, Operand(r0, r0, times_4, 0)); |
| 1001 // hash = hash ^ (hash >> 4); | 1016 // hash = hash ^ (hash >> 4); |
| (...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2685 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); | 2700 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); |
| 2686 Check(less_equal, "Live Bytes Count overflow chunk size"); | 2701 Check(less_equal, "Live Bytes Count overflow chunk size"); |
| 2687 } | 2702 } |
| 2688 | 2703 |
| 2689 bind(&done); | 2704 bind(&done); |
| 2690 } | 2705 } |
| 2691 | 2706 |
| 2692 } } // namespace v8::internal | 2707 } } // namespace v8::internal |
| 2693 | 2708 |
| 2694 #endif // V8_TARGET_ARCH_IA32 | 2709 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |