OLD | NEW |
1 // Copyright 2010 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 624 |
625 // If we have to call into C then we need to save and restore all caller- | 625 // If we have to call into C then we need to save and restore all caller- |
626 // saved registers that were not already preserved. The caller saved | 626 // saved registers that were not already preserved. The caller saved |
627 // registers are eax, ecx and edx. The three scratch registers (incl. ecx) | 627 // registers are eax, ecx and edx. The three scratch registers (incl. ecx) |
628 // will be restored by other means so we don't bother pushing them here. | 628 // will be restored by other means so we don't bother pushing them here. |
629 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 629 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
630 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); | 630 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); |
631 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); | 631 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); |
632 if (mode == kSaveFPRegs) { | 632 if (mode == kSaveFPRegs) { |
633 CpuFeatures::Scope scope(SSE2); | 633 CpuFeatures::Scope scope(SSE2); |
634 masm->sub(Operand(esp), | 634 masm->sub(esp, |
635 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 635 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); |
636 // Save all XMM registers except XMM0. | 636 // Save all XMM registers except XMM0. |
637 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 637 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { |
638 XMMRegister reg = XMMRegister::from_code(i); | 638 XMMRegister reg = XMMRegister::from_code(i); |
639 masm->movdbl(Operand(esp, (i - 1) * kDoubleSize), reg); | 639 masm->movdbl(Operand(esp, (i - 1) * kDoubleSize), reg); |
640 } | 640 } |
641 } | 641 } |
642 } | 642 } |
643 | 643 |
644 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 644 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, |
645 SaveFPRegsMode mode) { | 645 SaveFPRegsMode mode) { |
646 if (mode == kSaveFPRegs) { | 646 if (mode == kSaveFPRegs) { |
647 CpuFeatures::Scope scope(SSE2); | 647 CpuFeatures::Scope scope(SSE2); |
648 // Restore all XMM registers except XMM0. | 648 // Restore all XMM registers except XMM0. |
649 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 649 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { |
650 XMMRegister reg = XMMRegister::from_code(i); | 650 XMMRegister reg = XMMRegister::from_code(i); |
651 masm->movdbl(reg, Operand(esp, (i - 1) * kDoubleSize)); | 651 masm->movdbl(reg, Operand(esp, (i - 1) * kDoubleSize)); |
652 } | 652 } |
653 masm->add(Operand(esp), | 653 masm->add(esp, |
654 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 654 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); |
655 } | 655 } |
656 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); | 656 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); |
657 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); | 657 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); |
658 } | 658 } |
659 | 659 |
660 inline Register object() { return object_; } | 660 inline Register object() { return object_; } |
661 inline Register address() { return address_; } | 661 inline Register address() { return address_; } |
662 inline Register scratch0() { return scratch0_; } | 662 inline Register scratch0() { return scratch0_; } |
663 inline Register scratch1() { return scratch1_; } | 663 inline Register scratch1() { return scratch1_; } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 Register address_; | 734 Register address_; |
735 RememberedSetAction remembered_set_action_; | 735 RememberedSetAction remembered_set_action_; |
736 SaveFPRegsMode save_fp_regs_mode_; | 736 SaveFPRegsMode save_fp_regs_mode_; |
737 RegisterAllocation regs_; | 737 RegisterAllocation regs_; |
738 }; | 738 }; |
739 | 739 |
740 | 740 |
741 } } // namespace v8::internal | 741 } } // namespace v8::internal |
742 | 742 |
743 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 743 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |