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" |
(...skipping 6190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6201 if (reg5.is_valid()) regs |= reg5.bit(); | 6201 if (reg5.is_valid()) regs |= reg5.bit(); |
6202 if (reg6.is_valid()) regs |= reg6.bit(); | 6202 if (reg6.is_valid()) regs |= reg6.bit(); |
6203 if (reg7.is_valid()) regs |= reg7.bit(); | 6203 if (reg7.is_valid()) regs |= reg7.bit(); |
6204 if (reg8.is_valid()) regs |= reg8.bit(); | 6204 if (reg8.is_valid()) regs |= reg8.bit(); |
6205 int n_of_non_aliasing_regs = NumRegs(regs); | 6205 int n_of_non_aliasing_regs = NumRegs(regs); |
6206 | 6206 |
6207 return n_of_valid_regs != n_of_non_aliasing_regs; | 6207 return n_of_valid_regs != n_of_non_aliasing_regs; |
6208 } | 6208 } |
6209 | 6209 |
6210 | 6210 |
6211 CodePatcher::CodePatcher(byte* address, int instructions, | 6211 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int instructions, |
6212 FlushICache flush_cache) | 6212 FlushICache flush_cache) |
6213 : address_(address), | 6213 : address_(address), |
6214 size_(instructions * Assembler::kInstrSize), | 6214 size_(instructions * Assembler::kInstrSize), |
6215 masm_(NULL, address, size_ + Assembler::kGap, CodeObjectRequired::kNo), | 6215 masm_(isolate, address, size_ + Assembler::kGap, CodeObjectRequired::kNo), |
6216 flush_cache_(flush_cache) { | 6216 flush_cache_(flush_cache) { |
6217 // Create a new macro assembler pointing to the address of the code to patch. | 6217 // Create a new macro assembler pointing to the address of the code to patch. |
6218 // The size is adjusted with kGap on order for the assembler to generate size | 6218 // The size is adjusted with kGap on order for the assembler to generate size |
6219 // bytes of instructions without failing with buffer size constraints. | 6219 // bytes of instructions without failing with buffer size constraints. |
6220 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 6220 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
6221 } | 6221 } |
6222 | 6222 |
6223 | 6223 |
6224 CodePatcher::~CodePatcher() { | 6224 CodePatcher::~CodePatcher() { |
6225 // Indicate that code has changed. | 6225 // Indicate that code has changed. |
6226 if (flush_cache_ == FLUSH) { | 6226 if (flush_cache_ == FLUSH) { |
6227 Assembler::FlushICacheWithoutIsolate(address_, size_); | 6227 Assembler::FlushICache(masm_.isolate(), address_, size_); |
6228 } | 6228 } |
6229 // Check that the code was patched as expected. | 6229 // Check that the code was patched as expected. |
6230 DCHECK(masm_.pc_ == address_ + size_); | 6230 DCHECK(masm_.pc_ == address_ + size_); |
6231 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 6231 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
6232 } | 6232 } |
6233 | 6233 |
6234 | 6234 |
6235 void CodePatcher::Emit(Instr instr) { | 6235 void CodePatcher::Emit(Instr instr) { |
6236 masm()->emit(instr); | 6236 masm()->emit(instr); |
6237 } | 6237 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6284 if (mag.shift > 0) sra(result, result, mag.shift); | 6284 if (mag.shift > 0) sra(result, result, mag.shift); |
6285 srl(at, dividend, 31); | 6285 srl(at, dividend, 31); |
6286 Addu(result, result, Operand(at)); | 6286 Addu(result, result, Operand(at)); |
6287 } | 6287 } |
6288 | 6288 |
6289 | 6289 |
6290 } // namespace internal | 6290 } // namespace internal |
6291 } // namespace v8 | 6291 } // namespace v8 |
6292 | 6292 |
6293 #endif // V8_TARGET_ARCH_MIPS64 | 6293 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |