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 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 | 14 |
15 void ArrayNativeCode(MacroAssembler* masm, | 15 void ArrayNativeCode(MacroAssembler* masm, |
16 bool construct_call, | 16 bool construct_call, |
17 Label* call_generic_code); | 17 Label* call_generic_code); |
18 | 18 |
19 | 19 |
20 class StoreBufferOverflowStub: public PlatformCodeStub { | 20 class StoreBufferOverflowStub: public PlatformCodeStub { |
21 public: | 21 public: |
22 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) | 22 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) |
23 : PlatformCodeStub(isolate), save_doubles_(save_fp) { | 23 : PlatformCodeStub(isolate), save_doubles_(save_fp) { } |
24 ASSERT(CpuFeatures::IsSafeForSnapshot(isolate, SSE2) || | |
25 save_fp == kDontSaveFPRegs); | |
26 } | |
27 | 24 |
28 void Generate(MacroAssembler* masm); | 25 void Generate(MacroAssembler* masm); |
29 | 26 |
30 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | 27 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); |
31 virtual bool SometimesSetsUpAFrame() { return false; } | 28 virtual bool SometimesSetsUpAFrame() { return false; } |
32 | 29 |
33 private: | 30 private: |
34 SaveFPRegsMode save_doubles_; | 31 SaveFPRegsMode save_doubles_; |
35 | 32 |
36 Major MajorKey() { return StoreBufferOverflow; } | 33 Major MajorKey() { return StoreBufferOverflow; } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 SaveFPRegsMode fp_mode) | 187 SaveFPRegsMode fp_mode) |
191 : PlatformCodeStub(isolate), | 188 : PlatformCodeStub(isolate), |
192 object_(object), | 189 object_(object), |
193 value_(value), | 190 value_(value), |
194 address_(address), | 191 address_(address), |
195 remembered_set_action_(remembered_set_action), | 192 remembered_set_action_(remembered_set_action), |
196 save_fp_regs_mode_(fp_mode), | 193 save_fp_regs_mode_(fp_mode), |
197 regs_(object, // An input reg. | 194 regs_(object, // An input reg. |
198 address, // An input reg. | 195 address, // An input reg. |
199 value) { // One scratch reg. | 196 value) { // One scratch reg. |
200 ASSERT(CpuFeatures::IsSafeForSnapshot(isolate, SSE2) || | |
201 fp_mode == kDontSaveFPRegs); | |
202 } | 197 } |
203 | 198 |
204 enum Mode { | 199 enum Mode { |
205 STORE_BUFFER_ONLY, | 200 STORE_BUFFER_ONLY, |
206 INCREMENTAL, | 201 INCREMENTAL, |
207 INCREMENTAL_COMPACTION | 202 INCREMENTAL_COMPACTION |
208 }; | 203 }; |
209 | 204 |
210 virtual bool SometimesSetsUpAFrame() { return false; } | 205 virtual bool SometimesSetsUpAFrame() { return false; } |
211 | 206 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 328 } |
334 | 329 |
335 // 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- |
336 // saved registers that were not already preserved. The caller saved | 331 // saved registers that were not already preserved. The caller saved |
337 // 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) |
338 // 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. |
339 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 334 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
340 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); | 335 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); |
341 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); | 336 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); |
342 if (mode == kSaveFPRegs) { | 337 if (mode == kSaveFPRegs) { |
343 CpuFeatureScope scope(masm, SSE2); | |
344 masm->sub(esp, | 338 masm->sub(esp, |
345 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 339 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); |
346 // Save all XMM registers except XMM0. | 340 // Save all XMM registers except XMM0. |
347 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 341 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { |
348 XMMRegister reg = XMMRegister::from_code(i); | 342 XMMRegister reg = XMMRegister::from_code(i); |
349 masm->movsd(Operand(esp, (i - 1) * kDoubleSize), reg); | 343 masm->movsd(Operand(esp, (i - 1) * kDoubleSize), reg); |
350 } | 344 } |
351 } | 345 } |
352 } | 346 } |
353 | 347 |
354 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 348 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, |
355 SaveFPRegsMode mode) { | 349 SaveFPRegsMode mode) { |
356 if (mode == kSaveFPRegs) { | 350 if (mode == kSaveFPRegs) { |
357 CpuFeatureScope scope(masm, SSE2); | |
358 // Restore all XMM registers except XMM0. | 351 // Restore all XMM registers except XMM0. |
359 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | 352 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { |
360 XMMRegister reg = XMMRegister::from_code(i); | 353 XMMRegister reg = XMMRegister::from_code(i); |
361 masm->movsd(reg, Operand(esp, (i - 1) * kDoubleSize)); | 354 masm->movsd(reg, Operand(esp, (i - 1) * kDoubleSize)); |
362 } | 355 } |
363 masm->add(esp, | 356 masm->add(esp, |
364 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | 357 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); |
365 } | 358 } |
366 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); | 359 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); |
367 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); | 360 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 Register address_; | 430 Register address_; |
438 RememberedSetAction remembered_set_action_; | 431 RememberedSetAction remembered_set_action_; |
439 SaveFPRegsMode save_fp_regs_mode_; | 432 SaveFPRegsMode save_fp_regs_mode_; |
440 RegisterAllocation regs_; | 433 RegisterAllocation regs_; |
441 }; | 434 }; |
442 | 435 |
443 | 436 |
444 } } // namespace v8::internal | 437 } } // namespace v8::internal |
445 | 438 |
446 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 439 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |