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