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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 } | 533 } |
534 | 534 |
535 // If we have to call into C then we need to save and restore all caller- | 535 // If we have to call into C then we need to save and restore all caller- |
536 // saved registers that were not already preserved. The caller saved | 536 // saved registers that were not already preserved. The caller saved |
537 // registers are eax, ecx and edx. The three scratch registers (incl. ecx) | 537 // registers are eax, ecx and edx. The three scratch registers (incl. ecx) |
538 // will be restored by other means so we don't bother pushing them here. | 538 // will be restored by other means so we don't bother pushing them here. |
539 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 539 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
540 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); | 540 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); |
541 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); | 541 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); |
542 if (mode == kSaveFPRegs) { | 542 if (mode == kSaveFPRegs) { |
543 CpuFeatures::Scope scope(SSE2); | 543 CpuFeatureScope scope(masm, SSE2); |
544 masm->sub(esp, | 544 masm->sub(esp, |
545 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 545 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); |
546 // Save all XMM registers except XMM0. | 546 // Save all XMM registers except XMM0. |
547 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 547 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { |
548 XMMRegister reg = XMMRegister::from_code(i); | 548 XMMRegister reg = XMMRegister::from_code(i); |
549 masm->movdbl(Operand(esp, (i - 1) * kDoubleSize), reg); | 549 masm->movdbl(Operand(esp, (i - 1) * kDoubleSize), reg); |
550 } | 550 } |
551 } | 551 } |
552 } | 552 } |
553 | 553 |
554 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 554 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, |
555 SaveFPRegsMode mode) { | 555 SaveFPRegsMode mode) { |
556 if (mode == kSaveFPRegs) { | 556 if (mode == kSaveFPRegs) { |
557 CpuFeatures::Scope scope(SSE2); | 557 CpuFeatureScope scope(masm, SSE2); |
558 // Restore all XMM registers except XMM0. | 558 // Restore all XMM registers except XMM0. |
559 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 559 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { |
560 XMMRegister reg = XMMRegister::from_code(i); | 560 XMMRegister reg = XMMRegister::from_code(i); |
561 masm->movdbl(reg, Operand(esp, (i - 1) * kDoubleSize)); | 561 masm->movdbl(reg, Operand(esp, (i - 1) * kDoubleSize)); |
562 } | 562 } |
563 masm->add(esp, | 563 masm->add(esp, |
564 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 564 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); |
565 } | 565 } |
566 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); | 566 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); |
567 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); | 567 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 Register address_; | 637 Register address_; |
638 RememberedSetAction remembered_set_action_; | 638 RememberedSetAction remembered_set_action_; |
639 SaveFPRegsMode save_fp_regs_mode_; | 639 SaveFPRegsMode save_fp_regs_mode_; |
640 RegisterAllocation regs_; | 640 RegisterAllocation regs_; |
641 }; | 641 }; |
642 | 642 |
643 | 643 |
644 } } // namespace v8::internal | 644 } } // namespace v8::internal |
645 | 645 |
646 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 646 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |