OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_IA32_CODE_STUBS_IA32_H_ | 5 #ifndef V8_IA32_CODE_STUBS_IA32_H_ |
6 #define V8_IA32_CODE_STUBS_IA32_H_ | 6 #define V8_IA32_CODE_STUBS_IA32_H_ |
7 | 7 |
8 #include "macro-assembler.h" | 8 #include "macro-assembler.h" |
9 #include "ic-inl.h" | 9 #include "ic-inl.h" |
10 | 10 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 // If we have to call into C then we need to save and restore all caller- | 330 // If we have to call into C then we need to save and restore all caller- |
331 // saved registers that were not already preserved. The caller saved | 331 // saved registers that were not already preserved. The caller saved |
332 // registers are eax, ecx and edx. The three scratch registers (incl. ecx) | 332 // registers are eax, ecx and edx. The three scratch registers (incl. ecx) |
333 // will be restored by other means so we don't bother pushing them here. | 333 // will be restored by other means so we don't bother pushing them here. |
334 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 334 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
335 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); | 335 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); |
336 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); | 336 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); |
337 if (mode == kSaveFPRegs) { | 337 if (mode == kSaveFPRegs) { |
338 masm->sub(esp, | 338 masm->sub(esp, |
339 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 339 Immediate(kDoubleSize * (XMMRegister::kMaxNumRegisters - 1))); |
340 // Save all XMM registers except XMM0. | 340 // Save all XMM registers except XMM0. |
341 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 341 for (int i = XMMRegister::kMaxNumRegisters - 1; i > 0; i--) { |
342 XMMRegister reg = XMMRegister::from_code(i); | 342 XMMRegister reg = XMMRegister::from_code(i); |
343 masm->movsd(Operand(esp, (i - 1) * kDoubleSize), reg); | 343 masm->movsd(Operand(esp, (i - 1) * kDoubleSize), reg); |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 348 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, |
349 SaveFPRegsMode mode) { | 349 SaveFPRegsMode mode) { |
350 if (mode == kSaveFPRegs) { | 350 if (mode == kSaveFPRegs) { |
351 // Restore all XMM registers except XMM0. | 351 // Restore all XMM registers except XMM0. |
352 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 352 for (int i = XMMRegister::kMaxNumRegisters - 1; i > 0; i--) { |
353 XMMRegister reg = XMMRegister::from_code(i); | 353 XMMRegister reg = XMMRegister::from_code(i); |
354 masm->movsd(reg, Operand(esp, (i - 1) * kDoubleSize)); | 354 masm->movsd(reg, Operand(esp, (i - 1) * kDoubleSize)); |
355 } | 355 } |
356 masm->add(esp, | 356 masm->add(esp, |
357 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 357 Immediate(kDoubleSize * (XMMRegister::kMaxNumRegisters - 1))); |
358 } | 358 } |
359 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); | 359 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); |
360 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); | 360 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); |
361 } | 361 } |
362 | 362 |
363 inline Register object() { return object_; } | 363 inline Register object() { return object_; } |
364 inline Register address() { return address_; } | 364 inline Register address() { return address_; } |
365 inline Register scratch0() { return scratch0_; } | 365 inline Register scratch0() { return scratch0_; } |
366 inline Register scratch1() { return scratch1_; } | 366 inline Register scratch1() { return scratch1_; } |
367 | 367 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 Register address_; | 430 Register address_; |
431 RememberedSetAction remembered_set_action_; | 431 RememberedSetAction remembered_set_action_; |
432 SaveFPRegsMode save_fp_regs_mode_; | 432 SaveFPRegsMode save_fp_regs_mode_; |
433 RegisterAllocation regs_; | 433 RegisterAllocation regs_; |
434 }; | 434 }; |
435 | 435 |
436 | 436 |
437 } } // namespace v8::internal | 437 } } // namespace v8::internal |
438 | 438 |
439 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 439 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |