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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 699 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
700 bool result = (!memcmp(sequence, young_sequence, young_length)); | 700 bool result = (!memcmp(sequence, young_sequence, young_length)); |
701 ASSERT(result || *sequence == kCallOpcode); | 701 ASSERT(result || *sequence == kCallOpcode); |
702 return result; | 702 return result; |
703 } | 703 } |
704 | 704 |
705 | 705 |
706 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 706 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
707 MarkingParity* parity) { | 707 MarkingParity* parity) { |
708 if (IsYoungSequence(sequence)) { | 708 if (IsYoungSequence(sequence)) { |
709 *age = kNoAge; | 709 *age = kNoAgeCodeAge; |
710 *parity = NO_MARKING_PARITY; | 710 *parity = NO_MARKING_PARITY; |
711 } else { | 711 } else { |
712 sequence++; // Skip the kCallOpcode byte | 712 sequence++; // Skip the kCallOpcode byte |
713 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + | 713 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + |
714 Assembler::kCallTargetAddressOffset; | 714 Assembler::kCallTargetAddressOffset; |
715 Code* stub = GetCodeFromTargetAddress(target_address); | 715 Code* stub = GetCodeFromTargetAddress(target_address); |
716 GetCodeAgeAndParity(stub, age, parity); | 716 GetCodeAgeAndParity(stub, age, parity); |
717 } | 717 } |
718 } | 718 } |
719 | 719 |
720 | 720 |
721 void Code::PatchPlatformCodeAge(Isolate* isolate, | 721 void Code::PatchPlatformCodeAge(Isolate* isolate, |
722 byte* sequence, | 722 byte* sequence, |
723 Code::Age age, | 723 Code::Age age, |
724 MarkingParity parity) { | 724 MarkingParity parity) { |
725 uint32_t young_length; | 725 uint32_t young_length; |
726 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 726 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
727 if (age == kNoAge) { | 727 if (age == kNoAgeCodeAge) { |
728 CopyBytes(sequence, young_sequence, young_length); | 728 CopyBytes(sequence, young_sequence, young_length); |
729 CPU::FlushICache(sequence, young_length); | 729 CPU::FlushICache(sequence, young_length); |
730 } else { | 730 } else { |
731 Code* stub = GetCodeAgeStub(isolate, age, parity); | 731 Code* stub = GetCodeAgeStub(isolate, age, parity); |
732 CodePatcher patcher(sequence, young_length); | 732 CodePatcher patcher(sequence, young_length); |
733 patcher.masm()->call(stub->instruction_start()); | 733 patcher.masm()->call(stub->instruction_start()); |
734 patcher.masm()->Nop( | 734 patcher.masm()->Nop( |
735 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); | 735 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); |
736 } | 736 } |
737 } | 737 } |
(...skipping 16 matching lines...) Expand all Loading... |
754 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 754 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
755 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 755 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
756 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 756 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
757 } | 757 } |
758 } | 758 } |
759 | 759 |
760 | 760 |
761 } } // namespace v8::internal | 761 } } // namespace v8::internal |
762 | 762 |
763 #endif // V8_TARGET_ARCH_X64 | 763 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |