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

Side by Side Diff: src/x87/code-stubs-x87.h

Issue 293743005: Introduce x87 port (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: rebase Created 6 years, 7 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
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X87_CODE_STUBS_X87_H_
6 #define V8_IA32_CODE_STUBS_IA32_H_ 6 #define V8_X87_CODE_STUBS_X87_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 explicit StoreBufferOverflowStub(Isolate* isolate)
23 : PlatformCodeStub(isolate), save_doubles_(save_fp) { } 23 : PlatformCodeStub(isolate) { }
24 24
25 void Generate(MacroAssembler* masm); 25 void Generate(MacroAssembler* masm);
26 26
27 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); 27 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
28 virtual bool SometimesSetsUpAFrame() { return false; } 28 virtual bool SometimesSetsUpAFrame() { return false; }
29 29
30 private: 30 private:
31 SaveFPRegsMode save_doubles_;
32
33 Major MajorKey() { return StoreBufferOverflow; } 31 Major MajorKey() { return StoreBufferOverflow; }
34 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } 32 int MinorKey() { return 0; }
35 }; 33 };
36 34
37 35
38 class StringHelper : public AllStatic { 36 class StringHelper : public AllStatic {
39 public: 37 public:
40 // Generate code for copying characters using the rep movs instruction. 38 // Generate code for copying characters using the rep movs instruction.
41 // Copies ecx characters from esi to edi. Copying of overlapping regions is 39 // Copies ecx characters from esi to edi. Copying of overlapping regions is
42 // not supported. 40 // not supported.
43 static void GenerateCopyCharactersREP(MacroAssembler* masm, 41 static void GenerateCopyCharactersREP(MacroAssembler* masm,
44 Register dest, // Must be edi. 42 Register dest, // Must be edi.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 LookupMode mode_; 174 LookupMode mode_;
177 }; 175 };
178 176
179 177
180 class RecordWriteStub: public PlatformCodeStub { 178 class RecordWriteStub: public PlatformCodeStub {
181 public: 179 public:
182 RecordWriteStub(Isolate* isolate, 180 RecordWriteStub(Isolate* isolate,
183 Register object, 181 Register object,
184 Register value, 182 Register value,
185 Register address, 183 Register address,
186 RememberedSetAction remembered_set_action, 184 RememberedSetAction remembered_set_action)
187 SaveFPRegsMode fp_mode)
188 : PlatformCodeStub(isolate), 185 : PlatformCodeStub(isolate),
189 object_(object), 186 object_(object),
190 value_(value), 187 value_(value),
191 address_(address), 188 address_(address),
192 remembered_set_action_(remembered_set_action), 189 remembered_set_action_(remembered_set_action),
193 save_fp_regs_mode_(fp_mode),
194 regs_(object, // An input reg. 190 regs_(object, // An input reg.
195 address, // An input reg. 191 address, // An input reg.
196 value) { // One scratch reg. 192 value) { // One scratch reg.
197 } 193 }
198 194
199 enum Mode { 195 enum Mode {
200 STORE_BUFFER_ONLY, 196 STORE_BUFFER_ONLY,
201 INCREMENTAL, 197 INCREMENTAL,
202 INCREMENTAL_COMPACTION 198 INCREMENTAL_COMPACTION
203 }; 199 };
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 !ecx.is(address_orig_)) { 320 !ecx.is(address_orig_)) {
325 masm->pop(ecx); 321 masm->pop(ecx);
326 } 322 }
327 if (!scratch0_.is(scratch0_orig_)) masm->pop(scratch0_); 323 if (!scratch0_.is(scratch0_orig_)) masm->pop(scratch0_);
328 } 324 }
329 325
330 // If we have to call into C then we need to save and restore all caller- 326 // 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 327 // saved registers that were not already preserved. The caller saved
332 // registers are eax, ecx and edx. The three scratch registers (incl. ecx) 328 // 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. 329 // will be restored by other means so we don't bother pushing them here.
334 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { 330 void SaveCallerSaveRegisters(MacroAssembler* masm) {
335 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); 331 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax);
336 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); 332 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx);
337 if (mode == kSaveFPRegs) {
338 masm->sub(esp,
339 Immediate(kDoubleSize * (XMMRegister::kMaxNumRegisters - 1)));
340 // Save all XMM registers except XMM0.
341 for (int i = XMMRegister::kMaxNumRegisters - 1; i > 0; i--) {
342 XMMRegister reg = XMMRegister::from_code(i);
343 masm->movsd(Operand(esp, (i - 1) * kDoubleSize), reg);
344 }
345 }
346 } 333 }
347 334
348 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, 335 inline void RestoreCallerSaveRegisters(MacroAssembler*masm) {
349 SaveFPRegsMode mode) {
350 if (mode == kSaveFPRegs) {
351 // Restore all XMM registers except XMM0.
352 for (int i = XMMRegister::kMaxNumRegisters - 1; i > 0; i--) {
353 XMMRegister reg = XMMRegister::from_code(i);
354 masm->movsd(reg, Operand(esp, (i - 1) * kDoubleSize));
355 }
356 masm->add(esp,
357 Immediate(kDoubleSize * (XMMRegister::kMaxNumRegisters - 1)));
358 }
359 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); 336 if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx);
360 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); 337 if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax);
361 } 338 }
362 339
363 inline Register object() { return object_; } 340 inline Register object() { return object_; }
364 inline Register address() { return address_; } 341 inline Register address() { return address_; }
365 inline Register scratch0() { return scratch0_; } 342 inline Register scratch0() { return scratch0_; }
366 inline Register scratch1() { return scratch1_; } 343 inline Register scratch1() { return scratch1_; }
367 344
368 private: 345 private:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 OnNoNeedToInformIncrementalMarker on_no_need, 381 OnNoNeedToInformIncrementalMarker on_no_need,
405 Mode mode); 382 Mode mode);
406 void InformIncrementalMarker(MacroAssembler* masm); 383 void InformIncrementalMarker(MacroAssembler* masm);
407 384
408 Major MajorKey() { return RecordWrite; } 385 Major MajorKey() { return RecordWrite; }
409 386
410 int MinorKey() { 387 int MinorKey() {
411 return ObjectBits::encode(object_.code()) | 388 return ObjectBits::encode(object_.code()) |
412 ValueBits::encode(value_.code()) | 389 ValueBits::encode(value_.code()) |
413 AddressBits::encode(address_.code()) | 390 AddressBits::encode(address_.code()) |
414 RememberedSetActionBits::encode(remembered_set_action_) | 391 RememberedSetActionBits::encode(remembered_set_action_);
415 SaveFPRegsModeBits::encode(save_fp_regs_mode_);
416 } 392 }
417 393
418 void Activate(Code* code) { 394 void Activate(Code* code) {
419 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); 395 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
420 } 396 }
421 397
422 class ObjectBits: public BitField<int, 0, 3> {}; 398 class ObjectBits: public BitField<int, 0, 3> {};
423 class ValueBits: public BitField<int, 3, 3> {}; 399 class ValueBits: public BitField<int, 3, 3> {};
424 class AddressBits: public BitField<int, 6, 3> {}; 400 class AddressBits: public BitField<int, 6, 3> {};
425 class RememberedSetActionBits: public BitField<RememberedSetAction, 9, 1> {}; 401 class RememberedSetActionBits: public BitField<RememberedSetAction, 9, 1> {};
426 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 10, 1> {};
427 402
428 Register object_; 403 Register object_;
429 Register value_; 404 Register value_;
430 Register address_; 405 Register address_;
431 RememberedSetAction remembered_set_action_; 406 RememberedSetAction remembered_set_action_;
432 SaveFPRegsMode save_fp_regs_mode_;
433 RegisterAllocation regs_; 407 RegisterAllocation regs_;
434 }; 408 };
435 409
436 410
437 } } // namespace v8::internal 411 } } // namespace v8::internal
438 412
439 #endif // V8_IA32_CODE_STUBS_IA32_H_ 413 #endif // V8_X87_CODE_STUBS_X87_H_
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698