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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 } | 695 } |
696 } | 696 } |
697 | 697 |
698 | 698 |
699 void Code::PatchPlatformCodeAge(byte* sequence, | 699 void Code::PatchPlatformCodeAge(byte* sequence, |
700 Code::Age age, | 700 Code::Age age, |
701 MarkingParity parity) { | 701 MarkingParity parity) { |
702 uint32_t young_length; | 702 uint32_t young_length; |
703 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 703 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
704 if (age == kNoAge) { | 704 if (age == kNoAge) { |
705 memcpy(sequence, young_sequence, young_length); | 705 CopyBytes(sequence, young_sequence, young_length); |
706 CPU::FlushICache(sequence, young_length); | 706 CPU::FlushICache(sequence, young_length); |
707 } else { | 707 } else { |
708 Code* stub = GetCodeAgeStub(age, parity); | 708 Code* stub = GetCodeAgeStub(age, parity); |
709 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 709 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); |
710 // Mark this code sequence for FindPlatformCodeAgeSequence() | 710 // Mark this code sequence for FindPlatformCodeAgeSequence() |
711 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); | 711 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); |
712 // Save the function's original return address | 712 // Save the function's original return address |
713 // (it will be clobbered by Call(t9)) | 713 // (it will be clobbered by Call(t9)) |
714 patcher.masm()->mov(at, ra); | 714 patcher.masm()->mov(at, ra); |
715 // Load the stub address to t9 and call it | 715 // Load the stub address to t9 and call it |
716 patcher.masm()->li(t9, | 716 patcher.masm()->li(t9, |
717 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); | 717 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); |
718 patcher.masm()->Call(t9); | 718 patcher.masm()->Call(t9); |
719 // Record the stub address in the empty space for GetCodeAgeAndParity() | 719 // Record the stub address in the empty space for GetCodeAgeAndParity() |
720 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 720 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
721 } | 721 } |
722 } | 722 } |
723 | 723 |
724 | 724 |
725 #undef __ | 725 #undef __ |
726 | 726 |
727 } } // namespace v8::internal | 727 } } // namespace v8::internal |
728 | 728 |
729 #endif // V8_TARGET_ARCH_MIPS | 729 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |