OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 __ subsd(result, double_scratch); | 668 __ subsd(result, double_scratch); |
669 __ addsd(result, Operand(kScratchRegister, 8 * kDoubleSize)); | 669 __ addsd(result, Operand(kScratchRegister, 8 * kDoubleSize)); |
670 __ mulsd(result, input); | 670 __ mulsd(result, input); |
671 | 671 |
672 __ bind(&done); | 672 __ bind(&done); |
673 } | 673 } |
674 | 674 |
675 #undef __ | 675 #undef __ |
676 | 676 |
677 | 677 |
678 static const int kNoCodeAgeSequenceLength = 6; | |
679 | |
680 static byte* GetNoCodeAgeSequence(uint32_t* length) { | 678 static byte* GetNoCodeAgeSequence(uint32_t* length) { |
681 static bool initialized = false; | 679 static bool initialized = false; |
682 static byte sequence[kNoCodeAgeSequenceLength]; | 680 static byte sequence[kNoCodeAgeSequenceLength]; |
683 *length = kNoCodeAgeSequenceLength; | 681 *length = kNoCodeAgeSequenceLength; |
684 if (!initialized) { | 682 if (!initialized) { |
685 // The sequence of instructions that is patched out for aging code is the | 683 // The sequence of instructions that is patched out for aging code is the |
686 // following boilerplate stack-building prologue that is found both in | 684 // following boilerplate stack-building prologue that is found both in |
687 // FUNCTION and OPTIMIZED_FUNCTION code: | 685 // FUNCTION and OPTIMIZED_FUNCTION code: |
688 CodePatcher patcher(sequence, kNoCodeAgeSequenceLength); | 686 CodePatcher patcher(sequence, kNoCodeAgeSequenceLength); |
689 patcher.masm()->push(rbp); | 687 patcher.masm()->push(rbp); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 MarkingParity parity) { | 724 MarkingParity parity) { |
727 uint32_t young_length; | 725 uint32_t young_length; |
728 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 726 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
729 if (age == kNoAge) { | 727 if (age == kNoAge) { |
730 CopyBytes(sequence, young_sequence, young_length); | 728 CopyBytes(sequence, young_sequence, young_length); |
731 CPU::FlushICache(sequence, young_length); | 729 CPU::FlushICache(sequence, young_length); |
732 } else { | 730 } else { |
733 Code* stub = GetCodeAgeStub(isolate, age, parity); | 731 Code* stub = GetCodeAgeStub(isolate, age, parity); |
734 CodePatcher patcher(sequence, young_length); | 732 CodePatcher patcher(sequence, young_length); |
735 patcher.masm()->call(stub->instruction_start()); | 733 patcher.masm()->call(stub->instruction_start()); |
736 for (int i = 0; | 734 patcher.masm()->Nop( |
737 i < kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength; | 735 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); |
738 i++) { | |
739 patcher.masm()->nop(); | |
740 } | |
741 } | 736 } |
742 } | 737 } |
743 | 738 |
744 | 739 |
745 Operand StackArgumentsAccessor::GetArgumentOperand(int index) { | 740 Operand StackArgumentsAccessor::GetArgumentOperand(int index) { |
746 ASSERT(index >= 0); | 741 ASSERT(index >= 0); |
747 int receiver = (receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER) ? 1 : 0; | 742 int receiver = (receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER) ? 1 : 0; |
748 int displacement_to_last_argument = base_reg_.is(rsp) ? | 743 int displacement_to_last_argument = base_reg_.is(rsp) ? |
749 kPCOnStackSize : kFPOnStackSize + kPCOnStackSize; | 744 kPCOnStackSize : kFPOnStackSize + kPCOnStackSize; |
750 displacement_to_last_argument += extra_displacement_to_last_argument_; | 745 displacement_to_last_argument += extra_displacement_to_last_argument_; |
751 if (argument_count_reg_.is(no_reg)) { | 746 if (argument_count_reg_.is(no_reg)) { |
752 // argument[0] is at base_reg_ + displacement_to_last_argument + | 747 // argument[0] is at base_reg_ + displacement_to_last_argument + |
753 // (argument_count_immediate_ + receiver - 1) * kPointerSize. | 748 // (argument_count_immediate_ + receiver - 1) * kPointerSize. |
754 ASSERT(argument_count_immediate_ + receiver > 0); | 749 ASSERT(argument_count_immediate_ + receiver > 0); |
755 return Operand(base_reg_, displacement_to_last_argument + | 750 return Operand(base_reg_, displacement_to_last_argument + |
756 (argument_count_immediate_ + receiver - 1 - index) * kPointerSize); | 751 (argument_count_immediate_ + receiver - 1 - index) * kPointerSize); |
757 } else { | 752 } else { |
758 // argument[0] is at base_reg_ + displacement_to_last_argument + | 753 // argument[0] is at base_reg_ + displacement_to_last_argument + |
759 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 754 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
760 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 755 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
761 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 756 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
762 } | 757 } |
763 } | 758 } |
764 | 759 |
765 | 760 |
766 } } // namespace v8::internal | 761 } } // namespace v8::internal |
767 | 762 |
768 #endif // V8_TARGET_ARCH_X64 | 763 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |