| 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 4940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4951 if (!result.is(rax)) { | 4951 if (!result.is(rax)) { |
| 4952 __ movq(rax, result); | 4952 __ movq(rax, result); |
| 4953 } | 4953 } |
| 4954 } | 4954 } |
| 4955 | 4955 |
| 4956 | 4956 |
| 4957 void StringHelper::GenerateHashInit(MacroAssembler* masm, | 4957 void StringHelper::GenerateHashInit(MacroAssembler* masm, |
| 4958 Register hash, | 4958 Register hash, |
| 4959 Register character, | 4959 Register character, |
| 4960 Register scratch) { | 4960 Register scratch) { |
| 4961 // hash = character + (character << 10); | 4961 int32_t seed = masm->isolate()->HasherSeed(); |
| 4962 __ movl(hash, character); | 4962 if (seed != 0) { |
| 4963 __ shll(hash, Immediate(10)); | 4963 ASSERT(FLAG_randomize_string_hashes); |
| 4964 __ addl(hash, character); | 4964 // hash = (seed + character) + ((seed + character) << 10); |
| 4965 __ leal(scratch, Operand(character, seed)); |
| 4966 __ shll(scratch, Immediate(10)); |
| 4967 __ leal(hash, Operand(scratch, character, times_1, seed)); |
| 4968 } else { |
| 4969 ASSERT(!FLAG_randomize_string_hashes); |
| 4970 // hash = character + (character << 10); |
| 4971 __ movl(hash, character); |
| 4972 __ shll(hash, Immediate(10)); |
| 4973 __ addl(hash, character); |
| 4974 } |
| 4965 // hash ^= hash >> 6; | 4975 // hash ^= hash >> 6; |
| 4966 __ movl(scratch, hash); | 4976 __ movl(scratch, hash); |
| 4967 __ shrl(scratch, Immediate(6)); | 4977 __ shrl(scratch, Immediate(6)); |
| 4968 __ xorl(hash, scratch); | 4978 __ xorl(hash, scratch); |
| 4969 } | 4979 } |
| 4970 | 4980 |
| 4971 | 4981 |
| 4972 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, | 4982 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, |
| 4973 Register hash, | 4983 Register hash, |
| 4974 Register character, | 4984 Register character, |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6231 xmm0, | 6241 xmm0, |
| 6232 &slow_elements); | 6242 &slow_elements); |
| 6233 __ ret(0); | 6243 __ ret(0); |
| 6234 } | 6244 } |
| 6235 | 6245 |
| 6236 #undef __ | 6246 #undef __ |
| 6237 | 6247 |
| 6238 } } // namespace v8::internal | 6248 } } // namespace v8::internal |
| 6239 | 6249 |
| 6240 #endif // V8_TARGET_ARCH_X64 | 6250 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |