OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 : object_(object), | 537 : object_(object), |
538 value_(value), | 538 value_(value), |
539 address_(address), | 539 address_(address), |
540 remembered_set_action_(remembered_set_action), | 540 remembered_set_action_(remembered_set_action), |
541 save_fp_regs_mode_(fp_mode), | 541 save_fp_regs_mode_(fp_mode), |
542 regs_(object, // An input reg. | 542 regs_(object, // An input reg. |
543 address, // An input reg. | 543 address, // An input reg. |
544 value) { // One scratch reg. | 544 value) { // One scratch reg. |
545 } | 545 } |
546 | 546 |
547 static const byte kTwoByteNopInstruction = 0x3c; // Cmpb al, #imm8. | 547 static const byte kTwoByteNopInstruction = 0x3c; // Cmpb al, #imm8. |
548 static const byte kSkipNonIncrementalPartInstruction = 0xeb; // Jmp #imm8. | 548 static const byte kTwoByteJumpInstruction = 0xeb; // Jmp #imm8. |
549 | 549 |
550 static byte GetInstruction(bool enable) { | 550 static const byte kFiveByteNopInstruction = 0x3d; // Cmpl al, #imm32. |
Erik Corry
2011/07/04 11:04:11
You are sure it is al and not eax?
Vyacheslav Egorov (Chromium)
2011/08/05 12:50:28
Done.
| |
551 // Can't use ternary operator here, because gcc makes an undefined | 551 static const byte kFiveByteJumpInstruction = 0xe9; // Jmp #imm32. |
552 // reference to a static const int. | 552 |
553 if (enable) { | 553 static void Patch(Code* stub, bool incremental, bool compaction) { |
554 return kSkipNonIncrementalPartInstruction; | 554 ASSERT(!compaction || incremental); |
Erik Corry
2011/07/04 11:04:11
It would be very good to assert that the old opcod
Vyacheslav Egorov (Chromium)
2011/08/05 12:50:28
Done.
| |
555 if (incremental) { | |
556 if (compaction) { | |
557 stub->instruction_start()[0] = kTwoByteNopInstruction; | |
558 stub->instruction_start()[2] = kFiveByteJumpInstruction; | |
559 } else { | |
560 stub->instruction_start()[0] = kTwoByteJumpInstruction; | |
561 } | |
555 } else { | 562 } else { |
556 return kTwoByteNopInstruction; | 563 stub->instruction_start()[0] = kTwoByteNopInstruction; |
564 stub->instruction_start()[2] = kFiveByteNopInstruction; | |
557 } | 565 } |
558 } | 566 } |
559 | 567 |
560 static void Patch(Code* stub, bool enable) { | |
561 ASSERT(*stub->instruction_start() == GetInstruction(!enable)); | |
562 *stub->instruction_start() = GetInstruction(enable); | |
563 } | |
564 | |
565 private: | 568 private: |
566 // This is a helper class for freeing up 3 scratch registers, where the third | 569 // This is a helper class for freeing up 3 scratch registers, where the third |
567 // is always ecx (needed for shift operations). The input is two registers | 570 // is always ecx (needed for shift operations). The input is two registers |
568 // that must be preserved and one scratch register provided by the caller. | 571 // that must be preserved and one scratch register provided by the caller. |
569 class RegisterAllocation { | 572 class RegisterAllocation { |
570 public: | 573 public: |
571 RegisterAllocation(Register object, | 574 RegisterAllocation(Register object, |
572 Register address, | 575 Register address, |
573 Register scratch0) | 576 Register scratch0) |
574 : object_orig_(object), | 577 : object_orig_(object), |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
703 return no_reg; | 706 return no_reg; |
704 } | 707 } |
705 friend class RecordWriteStub; | 708 friend class RecordWriteStub; |
706 }; | 709 }; |
707 | 710 |
708 enum OnNoNeedToInformIncrementalMarker { | 711 enum OnNoNeedToInformIncrementalMarker { |
709 kReturnOnNoNeedToInformIncrementalMarker, | 712 kReturnOnNoNeedToInformIncrementalMarker, |
710 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker | 713 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker |
711 }; | 714 }; |
712 | 715 |
716 enum EvacuationState { | |
717 kWithEvacuationCandidates, | |
718 kWithoutEvacuationCandidates | |
719 }; | |
720 | |
713 void Generate(MacroAssembler* masm); | 721 void Generate(MacroAssembler* masm); |
714 void GenerateIncremental(MacroAssembler* masm); | 722 void GenerateIncremental(MacroAssembler* masm, |
723 EvacuationState evacuation_state); | |
715 void CheckNeedsToInformIncrementalMarker( | 724 void CheckNeedsToInformIncrementalMarker( |
716 MacroAssembler* masm, | 725 MacroAssembler* masm, |
717 OnNoNeedToInformIncrementalMarker on_no_need); | 726 OnNoNeedToInformIncrementalMarker on_no_need, |
718 void InformIncrementalMarker(MacroAssembler* masm); | 727 EvacuationState evacuation_state); |
728 void InformIncrementalMarker(MacroAssembler* masm, | |
729 EvacuationState evacuation_state); | |
719 | 730 |
720 Major MajorKey() { return RecordWrite; } | 731 Major MajorKey() { return RecordWrite; } |
721 | 732 |
722 int MinorKey() { | 733 int MinorKey() { |
723 return ObjectBits::encode(object_.code()) | | 734 return ObjectBits::encode(object_.code()) | |
724 ValueBits::encode(value_.code()) | | 735 ValueBits::encode(value_.code()) | |
725 AddressBits::encode(address_.code()) | | 736 AddressBits::encode(address_.code()) | |
726 RememberedSetActionBits::encode(remembered_set_action_) | | 737 RememberedSetActionBits::encode(remembered_set_action_) | |
727 SaveFPRegsModeBits::encode(save_fp_regs_mode_); | 738 SaveFPRegsModeBits::encode(save_fp_regs_mode_); |
728 } | 739 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
779 Register scratch1, | 790 Register scratch1, |
780 bool load_elements_from_receiver, | 791 bool load_elements_from_receiver, |
781 Label* key_not_smi, | 792 Label* key_not_smi, |
782 Label* value_not_smi, | 793 Label* value_not_smi, |
783 Label* not_pixel_array, | 794 Label* not_pixel_array, |
784 Label* out_of_range); | 795 Label* out_of_range); |
785 | 796 |
786 } } // namespace v8::internal | 797 } } // namespace v8::internal |
787 | 798 |
788 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 799 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |