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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 *parity = NO_MARKING_PARITY; | 628 *parity = NO_MARKING_PARITY; |
629 } else { | 629 } else { |
630 Address target_address = Memory::Address_at( | 630 Address target_address = Memory::Address_at( |
631 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); | 631 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); |
632 Code* stub = GetCodeFromTargetAddress(target_address); | 632 Code* stub = GetCodeFromTargetAddress(target_address); |
633 GetCodeAgeAndParity(stub, age, parity); | 633 GetCodeAgeAndParity(stub, age, parity); |
634 } | 634 } |
635 } | 635 } |
636 | 636 |
637 | 637 |
638 void Code::PatchPlatformCodeAge(byte* sequence, | 638 void Code::PatchPlatformCodeAge(Isolate* isolate, |
| 639 byte* sequence, |
639 Code::Age age, | 640 Code::Age age, |
640 MarkingParity parity) { | 641 MarkingParity parity) { |
641 uint32_t young_length; | 642 uint32_t young_length; |
642 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 643 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
643 if (age == kNoAge) { | 644 if (age == kNoAge) { |
644 CopyBytes(sequence, young_sequence, young_length); | 645 CopyBytes(sequence, young_sequence, young_length); |
645 CPU::FlushICache(sequence, young_length); | 646 CPU::FlushICache(sequence, young_length); |
646 } else { | 647 } else { |
647 Code* stub = GetCodeAgeStub(age, parity); | 648 Code* stub = GetCodeAgeStub(isolate, age, parity); |
648 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 649 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); |
649 // Mark this code sequence for FindPlatformCodeAgeSequence() | 650 // Mark this code sequence for FindPlatformCodeAgeSequence() |
650 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); | 651 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); |
651 // Save the function's original return address | 652 // Save the function's original return address |
652 // (it will be clobbered by Call(t9)) | 653 // (it will be clobbered by Call(t9)) |
653 patcher.masm()->mov(at, ra); | 654 patcher.masm()->mov(at, ra); |
654 // Load the stub address to t9 and call it | 655 // Load the stub address to t9 and call it |
655 patcher.masm()->li(t9, | 656 patcher.masm()->li(t9, |
656 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); | 657 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); |
657 patcher.masm()->Call(t9); | 658 patcher.masm()->Call(t9); |
658 // Record the stub address in the empty space for GetCodeAgeAndParity() | 659 // Record the stub address in the empty space for GetCodeAgeAndParity() |
659 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 660 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
660 } | 661 } |
661 } | 662 } |
662 | 663 |
663 | 664 |
664 #undef __ | 665 #undef __ |
665 | 666 |
666 } } // namespace v8::internal | 667 } } // namespace v8::internal |
667 | 668 |
668 #endif // V8_TARGET_ARCH_MIPS | 669 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |