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

Side by Side Diff: src/x64/deoptimizer-x64.cc

Issue 196893003: Introduce addp, idivp, imulp and subp for x64 port (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 #define __ masm()-> 160 #define __ masm()->
161 161
162 void Deoptimizer::EntryGenerator::Generate() { 162 void Deoptimizer::EntryGenerator::Generate() {
163 GeneratePrologue(); 163 GeneratePrologue();
164 164
165 // Save all general purpose registers before messing with them. 165 // Save all general purpose registers before messing with them.
166 const int kNumberOfRegisters = Register::kNumRegisters; 166 const int kNumberOfRegisters = Register::kNumRegisters;
167 167
168 const int kDoubleRegsSize = kDoubleSize * 168 const int kDoubleRegsSize = kDoubleSize *
169 XMMRegister::NumAllocatableRegisters(); 169 XMMRegister::NumAllocatableRegisters();
170 __ subq(rsp, Immediate(kDoubleRegsSize)); 170 __ subp(rsp, Immediate(kDoubleRegsSize));
171 171
172 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) { 172 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) {
173 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i); 173 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
174 int offset = i * kDoubleSize; 174 int offset = i * kDoubleSize;
175 __ movsd(Operand(rsp, offset), xmm_reg); 175 __ movsd(Operand(rsp, offset), xmm_reg);
176 } 176 }
177 177
178 // We push all registers onto the stack, even though we do not need 178 // We push all registers onto the stack, even though we do not need
179 // to restore all later. 179 // to restore all later.
180 for (int i = 0; i < kNumberOfRegisters; i++) { 180 for (int i = 0; i < kNumberOfRegisters; i++) {
(...skipping 11 matching lines...) Expand all
192 192
193 // Get the bailout id from the stack. 193 // Get the bailout id from the stack.
194 __ movp(arg_reg_3, Operand(rsp, kSavedRegistersAreaSize)); 194 __ movp(arg_reg_3, Operand(rsp, kSavedRegistersAreaSize));
195 195
196 // Get the address of the location in the code object 196 // Get the address of the location in the code object
197 // and compute the fp-to-sp delta in register arg5. 197 // and compute the fp-to-sp delta in register arg5.
198 __ movp(arg_reg_4, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize)); 198 __ movp(arg_reg_4, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize));
199 __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize + 199 __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize +
200 kPCOnStackSize)); 200 kPCOnStackSize));
201 201
202 __ subq(arg5, rbp); 202 __ subp(arg5, rbp);
203 __ neg(arg5); 203 __ neg(arg5);
204 204
205 // Allocate a new deoptimizer object. 205 // Allocate a new deoptimizer object.
206 __ PrepareCallCFunction(6); 206 __ PrepareCallCFunction(6);
207 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 207 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
208 __ movp(arg_reg_1, rax); 208 __ movp(arg_reg_1, rax);
209 __ Set(arg_reg_2, type()); 209 __ Set(arg_reg_2, type());
210 // Args 3 and 4 are already in the right registers. 210 // Args 3 and 4 are already in the right registers.
211 211
212 // On windows put the arguments on the stack (PrepareCallCFunction 212 // On windows put the arguments on the stack (PrepareCallCFunction
(...skipping 21 matching lines...) Expand all
234 } 234 }
235 235
236 // Fill in the double input registers. 236 // Fill in the double input registers.
237 int double_regs_offset = FrameDescription::double_registers_offset(); 237 int double_regs_offset = FrameDescription::double_registers_offset();
238 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { 238 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
239 int dst_offset = i * kDoubleSize + double_regs_offset; 239 int dst_offset = i * kDoubleSize + double_regs_offset;
240 __ popq(Operand(rbx, dst_offset)); 240 __ popq(Operand(rbx, dst_offset));
241 } 241 }
242 242
243 // Remove the bailout id and return address from the stack. 243 // Remove the bailout id and return address from the stack.
244 __ addq(rsp, Immediate(1 * kRegisterSize + kPCOnStackSize)); 244 __ addp(rsp, Immediate(1 * kRegisterSize + kPCOnStackSize));
245 245
246 // Compute a pointer to the unwinding limit in register rcx; that is 246 // Compute a pointer to the unwinding limit in register rcx; that is
247 // the first stack slot not part of the input frame. 247 // the first stack slot not part of the input frame.
248 __ movp(rcx, Operand(rbx, FrameDescription::frame_size_offset())); 248 __ movp(rcx, Operand(rbx, FrameDescription::frame_size_offset()));
249 __ addq(rcx, rsp); 249 __ addp(rcx, rsp);
250 250
251 // Unwind the stack down to - but not including - the unwinding 251 // Unwind the stack down to - but not including - the unwinding
252 // limit and copy the contents of the activation frame to the input 252 // limit and copy the contents of the activation frame to the input
253 // frame description. 253 // frame description.
254 __ lea(rdx, Operand(rbx, FrameDescription::frame_content_offset())); 254 __ lea(rdx, Operand(rbx, FrameDescription::frame_content_offset()));
255 Label pop_loop_header; 255 Label pop_loop_header;
256 __ jmp(&pop_loop_header); 256 __ jmp(&pop_loop_header);
257 Label pop_loop; 257 Label pop_loop;
258 __ bind(&pop_loop); 258 __ bind(&pop_loop);
259 __ Pop(Operand(rdx, 0)); 259 __ Pop(Operand(rdx, 0));
260 __ addq(rdx, Immediate(sizeof(intptr_t))); 260 __ addp(rdx, Immediate(sizeof(intptr_t)));
261 __ bind(&pop_loop_header); 261 __ bind(&pop_loop_header);
262 __ cmpq(rcx, rsp); 262 __ cmpq(rcx, rsp);
263 __ j(not_equal, &pop_loop); 263 __ j(not_equal, &pop_loop);
264 264
265 // Compute the output frame in the deoptimizer. 265 // Compute the output frame in the deoptimizer.
266 __ pushq(rax); 266 __ pushq(rax);
267 __ PrepareCallCFunction(2); 267 __ PrepareCallCFunction(2);
268 __ movp(arg_reg_1, rax); 268 __ movp(arg_reg_1, rax);
269 __ LoadAddress(arg_reg_2, ExternalReference::isolate_address(isolate())); 269 __ LoadAddress(arg_reg_2, ExternalReference::isolate_address(isolate()));
270 { 270 {
(...skipping 11 matching lines...) Expand all
282 __ movl(rdx, Operand(rax, Deoptimizer::output_count_offset())); 282 __ movl(rdx, Operand(rax, Deoptimizer::output_count_offset()));
283 __ movp(rax, Operand(rax, Deoptimizer::output_offset())); 283 __ movp(rax, Operand(rax, Deoptimizer::output_offset()));
284 __ lea(rdx, Operand(rax, rdx, times_pointer_size, 0)); 284 __ lea(rdx, Operand(rax, rdx, times_pointer_size, 0));
285 __ jmp(&outer_loop_header); 285 __ jmp(&outer_loop_header);
286 __ bind(&outer_push_loop); 286 __ bind(&outer_push_loop);
287 // Inner loop state: rbx = current FrameDescription*, rcx = loop index. 287 // Inner loop state: rbx = current FrameDescription*, rcx = loop index.
288 __ movp(rbx, Operand(rax, 0)); 288 __ movp(rbx, Operand(rax, 0));
289 __ movp(rcx, Operand(rbx, FrameDescription::frame_size_offset())); 289 __ movp(rcx, Operand(rbx, FrameDescription::frame_size_offset()));
290 __ jmp(&inner_loop_header); 290 __ jmp(&inner_loop_header);
291 __ bind(&inner_push_loop); 291 __ bind(&inner_push_loop);
292 __ subq(rcx, Immediate(sizeof(intptr_t))); 292 __ subp(rcx, Immediate(sizeof(intptr_t)));
293 __ Push(Operand(rbx, rcx, times_1, FrameDescription::frame_content_offset())); 293 __ Push(Operand(rbx, rcx, times_1, FrameDescription::frame_content_offset()));
294 __ bind(&inner_loop_header); 294 __ bind(&inner_loop_header);
295 __ testq(rcx, rcx); 295 __ testq(rcx, rcx);
296 __ j(not_zero, &inner_push_loop); 296 __ j(not_zero, &inner_push_loop);
297 __ addq(rax, Immediate(kPointerSize)); 297 __ addp(rax, Immediate(kPointerSize));
298 __ bind(&outer_loop_header); 298 __ bind(&outer_loop_header);
299 __ cmpq(rax, rdx); 299 __ cmpq(rax, rdx);
300 __ j(below, &outer_push_loop); 300 __ j(below, &outer_push_loop);
301 301
302 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) { 302 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) {
303 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i); 303 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
304 int src_offset = i * kDoubleSize + double_regs_offset; 304 int src_offset = i * kDoubleSize + double_regs_offset;
305 __ movsd(xmm_reg, Operand(rbx, src_offset)); 305 __ movsd(xmm_reg, Operand(rbx, src_offset));
306 } 306 }
307 307
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 UNREACHABLE(); 366 UNREACHABLE();
367 } 367 }
368 368
369 369
370 #undef __ 370 #undef __
371 371
372 372
373 } } // namespace v8::internal 373 } } // namespace v8::internal
374 374
375 #endif // V8_TARGET_ARCH_X64 375 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/x64/assembler-x64.h ('K') | « src/x64/debug-x64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698