| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| 11 #include "src/base/division-by-constant.h" | 11 #include "src/base/division-by-constant.h" |
| 12 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
| 13 #include "src/codegen.h" | 13 #include "src/codegen.h" |
| 14 #include "src/debug/debug.h" | 14 #include "src/debug/debug.h" |
| 15 #include "src/mips/macro-assembler-mips.h" | 15 #include "src/mips/macro-assembler-mips.h" |
| 16 #include "src/register-configuration.h" | 16 #include "src/register-configuration.h" |
| 17 #include "src/runtime/runtime.h" | 17 #include "src/runtime/runtime.h" |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 22 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, |
| 23 CodeObjectRequired create_code_object) |
| 23 : Assembler(arg_isolate, buffer, size), | 24 : Assembler(arg_isolate, buffer, size), |
| 24 generating_stub_(false), | 25 generating_stub_(false), |
| 25 has_frame_(false), | 26 has_frame_(false), |
| 26 has_double_zero_reg_set_(false) { | 27 has_double_zero_reg_set_(false) { |
| 27 if (isolate() != NULL) { | 28 if (create_code_object == CodeObjectRequired::kYes) { |
| 28 code_object_ = | 29 code_object_ = |
| 29 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); | 30 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 33 | 34 |
| 34 void MacroAssembler::Load(Register dst, | 35 void MacroAssembler::Load(Register dst, |
| 35 const MemOperand& src, | 36 const MemOperand& src, |
| 36 Representation r) { | 37 Representation r) { |
| 37 DCHECK(!r.IsDouble()); | 38 DCHECK(!r.IsDouble()); |
| (...skipping 5735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5773 if (reg5.is_valid()) regs |= reg5.bit(); | 5774 if (reg5.is_valid()) regs |= reg5.bit(); |
| 5774 if (reg6.is_valid()) regs |= reg6.bit(); | 5775 if (reg6.is_valid()) regs |= reg6.bit(); |
| 5775 if (reg7.is_valid()) regs |= reg7.bit(); | 5776 if (reg7.is_valid()) regs |= reg7.bit(); |
| 5776 if (reg8.is_valid()) regs |= reg8.bit(); | 5777 if (reg8.is_valid()) regs |= reg8.bit(); |
| 5777 int n_of_non_aliasing_regs = NumRegs(regs); | 5778 int n_of_non_aliasing_regs = NumRegs(regs); |
| 5778 | 5779 |
| 5779 return n_of_valid_regs != n_of_non_aliasing_regs; | 5780 return n_of_valid_regs != n_of_non_aliasing_regs; |
| 5780 } | 5781 } |
| 5781 | 5782 |
| 5782 | 5783 |
| 5783 CodePatcher::CodePatcher(byte* address, | 5784 CodePatcher::CodePatcher(byte* address, int instructions, |
| 5784 int instructions, | |
| 5785 FlushICache flush_cache) | 5785 FlushICache flush_cache) |
| 5786 : address_(address), | 5786 : address_(address), |
| 5787 size_(instructions * Assembler::kInstrSize), | 5787 size_(instructions * Assembler::kInstrSize), |
| 5788 masm_(NULL, address, size_ + Assembler::kGap), | 5788 masm_(NULL, address, size_ + Assembler::kGap, CodeObjectRequired::kNo), |
| 5789 flush_cache_(flush_cache) { | 5789 flush_cache_(flush_cache) { |
| 5790 // Create a new macro assembler pointing to the address of the code to patch. | 5790 // Create a new macro assembler pointing to the address of the code to patch. |
| 5791 // The size is adjusted with kGap on order for the assembler to generate size | 5791 // The size is adjusted with kGap on order for the assembler to generate size |
| 5792 // bytes of instructions without failing with buffer size constraints. | 5792 // bytes of instructions without failing with buffer size constraints. |
| 5793 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5793 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 5794 } | 5794 } |
| 5795 | 5795 |
| 5796 | 5796 |
| 5797 CodePatcher::~CodePatcher() { | 5797 CodePatcher::~CodePatcher() { |
| 5798 // Indicate that code has changed. | 5798 // Indicate that code has changed. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5843 if (mag.shift > 0) sra(result, result, mag.shift); | 5843 if (mag.shift > 0) sra(result, result, mag.shift); |
| 5844 srl(at, dividend, 31); | 5844 srl(at, dividend, 31); |
| 5845 Addu(result, result, Operand(at)); | 5845 Addu(result, result, Operand(at)); |
| 5846 } | 5846 } |
| 5847 | 5847 |
| 5848 | 5848 |
| 5849 } // namespace internal | 5849 } // namespace internal |
| 5850 } // namespace v8 | 5850 } // namespace v8 |
| 5851 | 5851 |
| 5852 #endif // V8_TARGET_ARCH_MIPS | 5852 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |