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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 | 44 |
45 typedef uint32_t (*HASH_FUNCTION)(); | 45 typedef uint32_t (*HASH_FUNCTION)(); |
46 | 46 |
47 #define __ masm-> | 47 #define __ masm-> |
48 | 48 |
49 | 49 |
50 void generate(MacroAssembler* masm, i::Vector<const uint8_t> string) { | 50 void generate(MacroAssembler* masm, i::Vector<const uint8_t> string) { |
51 // GenerateHashInit takes the first character as an argument so it can't | 51 // GenerateHashInit takes the first character as an argument so it can't |
52 // handle the zero length string. | 52 // handle the zero length string. |
53 ASSERT(string.length() > 0); | 53 DCHECK(string.length() > 0); |
54 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 | 54 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
55 __ push(ebx); | 55 __ push(ebx); |
56 __ push(ecx); | 56 __ push(ecx); |
57 __ mov(eax, Immediate(0)); | 57 __ mov(eax, Immediate(0)); |
58 __ mov(ebx, Immediate(string.at(0))); | 58 __ mov(ebx, Immediate(string.at(0))); |
59 StringHelper::GenerateHashInit(masm, eax, ebx, ecx); | 59 StringHelper::GenerateHashInit(masm, eax, ebx, ecx); |
60 for (int i = 1; i < string.length(); i++) { | 60 for (int i = 1; i < string.length(); i++) { |
61 __ mov(ebx, Immediate(string.at(i))); | 61 __ mov(ebx, Immediate(string.at(i))); |
62 StringHelper::GenerateHashAddCharacter(masm, eax, ebx, ecx); | 62 StringHelper::GenerateHashAddCharacter(masm, eax, ebx, ecx); |
63 } | 63 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Some pseudo-random numbers | 298 // Some pseudo-random numbers |
299 static const uint32_t kLimit = 1000; | 299 static const uint32_t kLimit = 1000; |
300 for (uint32_t i = 0; i < 5; i++) { | 300 for (uint32_t i = 0; i < 5; i++) { |
301 for (uint32_t j = 0; j < 5; j++) { | 301 for (uint32_t j = 0; j < 5; j++) { |
302 check(PseudoRandom(i, j) % kLimit); | 302 check(PseudoRandom(i, j) % kLimit); |
303 } | 303 } |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 #undef __ | 307 #undef __ |
OLD | NEW |