Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: test/cctest/test-hashing.cc

Issue 199903002: Introduce Push and Pop macro instructions for x64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased with bleeding_edge Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-disasm-x64.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
64 StringHelper::GenerateHashGetHash(masm, eax, ecx); 64 StringHelper::GenerateHashGetHash(masm, eax, ecx);
65 __ pop(ecx); 65 __ pop(ecx);
66 __ pop(ebx); 66 __ pop(ebx);
67 __ Ret(); 67 __ Ret();
68 #elif V8_TARGET_ARCH_X64 68 #elif V8_TARGET_ARCH_X64
69 __ push(kRootRegister); 69 __ pushq(kRootRegister);
70 __ InitializeRootRegister(); 70 __ InitializeRootRegister();
71 __ push(rbx); 71 __ pushq(rbx);
72 __ push(rcx); 72 __ pushq(rcx);
73 __ movq(rax, Immediate(0)); 73 __ movp(rax, Immediate(0));
74 __ movq(rbx, Immediate(string.at(0))); 74 __ movp(rbx, Immediate(string.at(0)));
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 __ movp(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 __ popq(rcx);
82 __ pop(rbx); 82 __ popq(rbx);
83 __ pop(kRootRegister); 83 __ popq(kRootRegister);
84 __ Ret(); 84 __ Ret();
85 #elif V8_TARGET_ARCH_ARM 85 #elif V8_TARGET_ARCH_ARM
86 __ push(kRootRegister); 86 __ push(kRootRegister);
87 __ InitializeRootRegister(); 87 __ InitializeRootRegister();
88 88
89 __ mov(r0, Operand(0)); 89 __ mov(r0, Operand(0));
90 __ mov(ip, Operand(string.at(0))); 90 __ mov(ip, Operand(string.at(0)));
91 StringHelper::GenerateHashInit(masm, r0, ip); 91 StringHelper::GenerateHashInit(masm, r0, ip);
92 for (int i = 1; i < string.length(); i++) { 92 for (int i = 1; i < string.length(); i++) {
93 __ mov(ip, Operand(string.at(i))); 93 __ mov(ip, Operand(string.at(i)));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 137
138 void generate(MacroAssembler* masm, uint32_t key) { 138 void generate(MacroAssembler* masm, uint32_t key) {
139 #if V8_TARGET_ARCH_IA32 139 #if V8_TARGET_ARCH_IA32
140 __ push(ebx); 140 __ push(ebx);
141 __ mov(eax, Immediate(key)); 141 __ mov(eax, Immediate(key));
142 __ GetNumberHash(eax, ebx); 142 __ GetNumberHash(eax, ebx);
143 __ pop(ebx); 143 __ pop(ebx);
144 __ Ret(); 144 __ Ret();
145 #elif V8_TARGET_ARCH_X64 145 #elif V8_TARGET_ARCH_X64
146 __ push(kRootRegister); 146 __ pushq(kRootRegister);
147 __ InitializeRootRegister(); 147 __ InitializeRootRegister();
148 __ push(rbx); 148 __ pushq(rbx);
149 __ movq(rax, Immediate(key)); 149 __ movp(rax, Immediate(key));
150 __ GetNumberHash(rax, rbx); 150 __ GetNumberHash(rax, rbx);
151 __ pop(rbx); 151 __ popq(rbx);
152 __ pop(kRootRegister); 152 __ popq(kRootRegister);
153 __ Ret(); 153 __ Ret();
154 #elif V8_TARGET_ARCH_ARM 154 #elif V8_TARGET_ARCH_ARM
155 __ push(kRootRegister); 155 __ push(kRootRegister);
156 __ InitializeRootRegister(); 156 __ InitializeRootRegister();
157 __ mov(r0, Operand(key)); 157 __ mov(r0, Operand(key));
158 __ GetNumberHash(r0, ip); 158 __ GetNumberHash(r0, ip);
159 __ pop(kRootRegister); 159 __ pop(kRootRegister);
160 __ mov(pc, Operand(lr)); 160 __ mov(pc, Operand(lr));
161 #elif V8_TARGET_ARCH_A64 161 #elif V8_TARGET_ARCH_A64
162 // The A64 assembler usually uses jssp (x28) as a stack pointer, but only csp 162 // The A64 assembler usually uses jssp (x28) as a stack pointer, but only csp
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // Some pseudo-random numbers 297 // Some pseudo-random numbers
298 static const uint32_t kLimit = 1000; 298 static const uint32_t kLimit = 1000;
299 for (uint32_t i = 0; i < 5; i++) { 299 for (uint32_t i = 0; i < 5; i++) {
300 for (uint32_t j = 0; j < 5; j++) { 300 for (uint32_t j = 0; j < 5; j++) {
301 check(PseudoRandom(i, j) % kLimit); 301 check(PseudoRandom(i, j) % kLimit);
302 } 302 }
303 } 303 }
304 } 304 }
305 305
306 #undef __ 306 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-x64.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698