| 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 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| 11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
| 12 #include "src/debug/debug.h" | 12 #include "src/debug/debug.h" |
| 13 #include "src/mips64/macro-assembler-mips64.h" | 13 #include "src/mips64/macro-assembler-mips64.h" |
| 14 #include "src/register-configuration.h" | 14 #include "src/register-configuration.h" |
| 15 #include "src/runtime/runtime.h" | 15 #include "src/runtime/runtime.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, |
| 21 CodeObjectRequired create_code_object) |
| 21 : Assembler(arg_isolate, buffer, size), | 22 : Assembler(arg_isolate, buffer, size), |
| 22 generating_stub_(false), | 23 generating_stub_(false), |
| 23 has_frame_(false), | 24 has_frame_(false), |
| 24 has_double_zero_reg_set_(false) { | 25 has_double_zero_reg_set_(false) { |
| 25 if (isolate() != NULL) { | 26 if (create_code_object == CodeObjectRequired::kYes) { |
| 26 code_object_ = | 27 code_object_ = |
| 27 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); | 28 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); |
| 28 } | 29 } |
| 29 } | 30 } |
| 30 | 31 |
| 31 | 32 |
| 32 void MacroAssembler::Load(Register dst, | 33 void MacroAssembler::Load(Register dst, |
| 33 const MemOperand& src, | 34 const MemOperand& src, |
| 34 Representation r) { | 35 Representation r) { |
| 35 DCHECK(!r.IsDouble()); | 36 DCHECK(!r.IsDouble()); |
| (...skipping 6144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6180 if (reg5.is_valid()) regs |= reg5.bit(); | 6181 if (reg5.is_valid()) regs |= reg5.bit(); |
| 6181 if (reg6.is_valid()) regs |= reg6.bit(); | 6182 if (reg6.is_valid()) regs |= reg6.bit(); |
| 6182 if (reg7.is_valid()) regs |= reg7.bit(); | 6183 if (reg7.is_valid()) regs |= reg7.bit(); |
| 6183 if (reg8.is_valid()) regs |= reg8.bit(); | 6184 if (reg8.is_valid()) regs |= reg8.bit(); |
| 6184 int n_of_non_aliasing_regs = NumRegs(regs); | 6185 int n_of_non_aliasing_regs = NumRegs(regs); |
| 6185 | 6186 |
| 6186 return n_of_valid_regs != n_of_non_aliasing_regs; | 6187 return n_of_valid_regs != n_of_non_aliasing_regs; |
| 6187 } | 6188 } |
| 6188 | 6189 |
| 6189 | 6190 |
| 6190 CodePatcher::CodePatcher(byte* address, | 6191 CodePatcher::CodePatcher(byte* address, int instructions, |
| 6191 int instructions, | |
| 6192 FlushICache flush_cache) | 6192 FlushICache flush_cache) |
| 6193 : address_(address), | 6193 : address_(address), |
| 6194 size_(instructions * Assembler::kInstrSize), | 6194 size_(instructions * Assembler::kInstrSize), |
| 6195 masm_(NULL, address, size_ + Assembler::kGap), | 6195 masm_(NULL, address, size_ + Assembler::kGap, CodeObjectRequired::kNo), |
| 6196 flush_cache_(flush_cache) { | 6196 flush_cache_(flush_cache) { |
| 6197 // Create a new macro assembler pointing to the address of the code to patch. | 6197 // Create a new macro assembler pointing to the address of the code to patch. |
| 6198 // The size is adjusted with kGap on order for the assembler to generate size | 6198 // The size is adjusted with kGap on order for the assembler to generate size |
| 6199 // bytes of instructions without failing with buffer size constraints. | 6199 // bytes of instructions without failing with buffer size constraints. |
| 6200 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 6200 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 6201 } | 6201 } |
| 6202 | 6202 |
| 6203 | 6203 |
| 6204 CodePatcher::~CodePatcher() { | 6204 CodePatcher::~CodePatcher() { |
| 6205 // Indicate that code has changed. | 6205 // Indicate that code has changed. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6264 if (mag.shift > 0) sra(result, result, mag.shift); | 6264 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6265 srl(at, dividend, 31); | 6265 srl(at, dividend, 31); |
| 6266 Addu(result, result, Operand(at)); | 6266 Addu(result, result, Operand(at)); |
| 6267 } | 6267 } |
| 6268 | 6268 |
| 6269 | 6269 |
| 6270 } // namespace internal | 6270 } // namespace internal |
| 6271 } // namespace v8 | 6271 } // namespace v8 |
| 6272 | 6272 |
| 6273 #endif // V8_TARGET_ARCH_MIPS64 | 6273 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |