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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 StringHelper::GenerateHashInit(masm, rax, rbx, rcx); | 75 StringHelper::GenerateHashInit(masm, rax, rbx, rcx); |
76 for (int i = 1; i < string.length(); i++) { | 76 for (int i = 1; i < string.length(); i++) { |
77 __ movq(rbx, Immediate(string.at(i))); | 77 __ movq(rbx, Immediate(string.at(i))); |
78 StringHelper::GenerateHashAddCharacter(masm, rax, rbx, rcx); | 78 StringHelper::GenerateHashAddCharacter(masm, rax, rbx, rcx); |
79 } | 79 } |
80 StringHelper::GenerateHashGetHash(masm, rax, rcx); | 80 StringHelper::GenerateHashGetHash(masm, rax, rcx); |
81 __ pop(rcx); | 81 __ pop(rcx); |
82 __ pop(rbx); | 82 __ pop(rbx); |
83 __ pop(kRootRegister); | 83 __ pop(kRootRegister); |
84 __ Ret(); | 84 __ Ret(); |
| 85 #elif V8_TARGET_ARCH_X32 |
| 86 __ push(kRootRegister); |
| 87 __ InitializeRootRegister(); |
| 88 __ push(rbx); |
| 89 __ push(rcx); |
| 90 __ movl(rax, Immediate(0)); |
| 91 __ movl(rbx, Immediate(string.at(0))); |
| 92 StringHelper::GenerateHashInit(masm, rax, rbx, rcx); |
| 93 for (int i = 1; i < string.length(); i++) { |
| 94 __ movl(rbx, Immediate(string.at(i))); |
| 95 StringHelper::GenerateHashAddCharacter(masm, rax, rbx, rcx); |
| 96 } |
| 97 StringHelper::GenerateHashGetHash(masm, rax, rcx); |
| 98 __ pop(rcx); |
| 99 __ pop(rbx); |
| 100 __ pop(kRootRegister); |
| 101 __ Ret(); |
85 #elif V8_TARGET_ARCH_ARM | 102 #elif V8_TARGET_ARCH_ARM |
86 __ push(kRootRegister); | 103 __ push(kRootRegister); |
87 __ InitializeRootRegister(); | 104 __ InitializeRootRegister(); |
88 | 105 |
89 __ mov(r0, Operand(0)); | 106 __ mov(r0, Operand(0)); |
90 __ mov(ip, Operand(string.at(0))); | 107 __ mov(ip, Operand(string.at(0))); |
91 StringHelper::GenerateHashInit(masm, r0, ip); | 108 StringHelper::GenerateHashInit(masm, r0, ip); |
92 for (int i = 1; i < string.length(); i++) { | 109 for (int i = 1; i < string.length(); i++) { |
93 __ mov(ip, Operand(string.at(i))); | 110 __ mov(ip, Operand(string.at(i))); |
94 StringHelper::GenerateHashAddCharacter(masm, r0, ip); | 111 StringHelper::GenerateHashAddCharacter(masm, r0, ip); |
(...skipping 29 matching lines...) Expand all Loading... |
124 __ Ret(); | 141 __ Ret(); |
125 #elif V8_TARGET_ARCH_X64 | 142 #elif V8_TARGET_ARCH_X64 |
126 __ push(kRootRegister); | 143 __ push(kRootRegister); |
127 __ InitializeRootRegister(); | 144 __ InitializeRootRegister(); |
128 __ push(rbx); | 145 __ push(rbx); |
129 __ movq(rax, Immediate(key)); | 146 __ movq(rax, Immediate(key)); |
130 __ GetNumberHash(rax, rbx); | 147 __ GetNumberHash(rax, rbx); |
131 __ pop(rbx); | 148 __ pop(rbx); |
132 __ pop(kRootRegister); | 149 __ pop(kRootRegister); |
133 __ Ret(); | 150 __ Ret(); |
| 151 #elif V8_TARGET_ARCH_X32 |
| 152 __ push(kRootRegister); |
| 153 __ InitializeRootRegister(); |
| 154 __ push(rbx); |
| 155 __ movl(rax, Immediate(key)); |
| 156 __ GetNumberHash(rax, rbx); |
| 157 __ pop(rbx); |
| 158 __ pop(kRootRegister); |
| 159 __ Ret(); |
134 #elif V8_TARGET_ARCH_ARM | 160 #elif V8_TARGET_ARCH_ARM |
135 __ push(kRootRegister); | 161 __ push(kRootRegister); |
136 __ InitializeRootRegister(); | 162 __ InitializeRootRegister(); |
137 __ mov(r0, Operand(key)); | 163 __ mov(r0, Operand(key)); |
138 __ GetNumberHash(r0, ip); | 164 __ GetNumberHash(r0, ip); |
139 __ pop(kRootRegister); | 165 __ pop(kRootRegister); |
140 __ mov(pc, Operand(lr)); | 166 __ mov(pc, Operand(lr)); |
141 #elif V8_TARGET_ARCH_MIPS | 167 #elif V8_TARGET_ARCH_MIPS |
142 __ push(kRootRegister); | 168 __ push(kRootRegister); |
143 __ InitializeRootRegister(); | 169 __ InitializeRootRegister(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // Some pseudo-random numbers | 289 // Some pseudo-random numbers |
264 static const uint32_t kLimit = 1000; | 290 static const uint32_t kLimit = 1000; |
265 for (uint32_t i = 0; i < 5; i++) { | 291 for (uint32_t i = 0; i < 5; i++) { |
266 for (uint32_t j = 0; j < 5; j++) { | 292 for (uint32_t j = 0; j < 5; j++) { |
267 check(PseudoRandom(i, j) % kLimit); | 293 check(PseudoRandom(i, j) % kLimit); |
268 } | 294 } |
269 } | 295 } |
270 } | 296 } |
271 | 297 |
272 #undef __ | 298 #undef __ |
OLD | NEW |