OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
10 | 10 |
(...skipping 4442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4453 | 4453 |
4454 | 4454 |
4455 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { | 4455 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { |
4456 if (frame_mode == BUILD_STUB_FRAME) { | 4456 if (frame_mode == BUILD_STUB_FRAME) { |
4457 Push(ra, fp, cp); | 4457 Push(ra, fp, cp); |
4458 Push(Smi::FromInt(StackFrame::STUB)); | 4458 Push(Smi::FromInt(StackFrame::STUB)); |
4459 // Adjust FP to point to saved FP. | 4459 // Adjust FP to point to saved FP. |
4460 Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 4460 Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
4461 } else { | 4461 } else { |
4462 PredictableCodeSizeScope predictible_code_size_scope( | 4462 PredictableCodeSizeScope predictible_code_size_scope( |
4463 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); | 4463 this, kNoCodeAgeSequenceLength); |
4464 // The following three instructions must remain together and unmodified | 4464 // The following three instructions must remain together and unmodified |
4465 // for code aging to work properly. | 4465 // for code aging to work properly. |
4466 if (isolate()->IsCodePreAgingActive()) { | 4466 if (isolate()->IsCodePreAgingActive()) { |
4467 // Pre-age the code. | 4467 // Pre-age the code. |
4468 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); | 4468 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
4469 nop(Assembler::CODE_AGE_MARKER_NOP); | 4469 nop(Assembler::CODE_AGE_MARKER_NOP); |
4470 // Load the stub address to t9 and call it, | 4470 // Load the stub address to t9 and call it, |
4471 // GetCodeAgeAndParity() extracts the stub address from this instruction. | 4471 // GetCodeAgeAndParity() extracts the stub address from this instruction. |
4472 li(t9, | 4472 li(t9, |
4473 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())), | 4473 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())), |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5657 if (r1.is(r2)) return true; | 5657 if (r1.is(r2)) return true; |
5658 if (r1.is(r3)) return true; | 5658 if (r1.is(r3)) return true; |
5659 if (r1.is(r4)) return true; | 5659 if (r1.is(r4)) return true; |
5660 if (r2.is(r3)) return true; | 5660 if (r2.is(r3)) return true; |
5661 if (r2.is(r4)) return true; | 5661 if (r2.is(r4)) return true; |
5662 if (r3.is(r4)) return true; | 5662 if (r3.is(r4)) return true; |
5663 return false; | 5663 return false; |
5664 } | 5664 } |
5665 | 5665 |
5666 | 5666 |
5667 CodePatcher::CodePatcher(byte* address, int instructions) | 5667 CodePatcher::CodePatcher(byte* address, |
| 5668 int instructions, |
| 5669 FlushICache flush_cache) |
5668 : address_(address), | 5670 : address_(address), |
5669 size_(instructions * Assembler::kInstrSize), | 5671 size_(instructions * Assembler::kInstrSize), |
5670 masm_(NULL, address, size_ + Assembler::kGap) { | 5672 masm_(NULL, address, size_ + Assembler::kGap), |
| 5673 flush_cache_(flush_cache) { |
5671 // Create a new macro assembler pointing to the address of the code to patch. | 5674 // Create a new macro assembler pointing to the address of the code to patch. |
5672 // The size is adjusted with kGap on order for the assembler to generate size | 5675 // The size is adjusted with kGap on order for the assembler to generate size |
5673 // bytes of instructions without failing with buffer size constraints. | 5676 // bytes of instructions without failing with buffer size constraints. |
5674 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5677 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
5675 } | 5678 } |
5676 | 5679 |
5677 | 5680 |
5678 CodePatcher::~CodePatcher() { | 5681 CodePatcher::~CodePatcher() { |
5679 // Indicate that code has changed. | 5682 // Indicate that code has changed. |
5680 CPU::FlushICache(address_, size_); | 5683 if (flush_cache_ == FLUSH) { |
| 5684 CPU::FlushICache(address_, size_); |
| 5685 } |
5681 | 5686 |
5682 // Check that the code was patched as expected. | 5687 // Check that the code was patched as expected. |
5683 ASSERT(masm_.pc_ == address_ + size_); | 5688 ASSERT(masm_.pc_ == address_ + size_); |
5684 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5689 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
5685 } | 5690 } |
5686 | 5691 |
5687 | 5692 |
5688 void CodePatcher::Emit(Instr instr) { | 5693 void CodePatcher::Emit(Instr instr) { |
5689 masm()->emit(instr); | 5694 masm()->emit(instr); |
5690 } | 5695 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5735 } | 5740 } |
5736 if (ms.shift() > 0) sra(result, result, ms.shift()); | 5741 if (ms.shift() > 0) sra(result, result, ms.shift()); |
5737 srl(at, dividend, 31); | 5742 srl(at, dividend, 31); |
5738 Addu(result, result, Operand(at)); | 5743 Addu(result, result, Operand(at)); |
5739 } | 5744 } |
5740 | 5745 |
5741 | 5746 |
5742 } } // namespace v8::internal | 5747 } } // namespace v8::internal |
5743 | 5748 |
5744 #endif // V8_TARGET_ARCH_MIPS | 5749 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |