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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 5239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5250 if (reg6.is_valid()) regs |= reg6.bit(); | 5250 if (reg6.is_valid()) regs |= reg6.bit(); |
5251 if (reg7.is_valid()) regs |= reg7.bit(); | 5251 if (reg7.is_valid()) regs |= reg7.bit(); |
5252 if (reg8.is_valid()) regs |= reg8.bit(); | 5252 if (reg8.is_valid()) regs |= reg8.bit(); |
5253 int n_of_non_aliasing_regs = NumRegs(regs); | 5253 int n_of_non_aliasing_regs = NumRegs(regs); |
5254 | 5254 |
5255 return n_of_valid_regs != n_of_non_aliasing_regs; | 5255 return n_of_valid_regs != n_of_non_aliasing_regs; |
5256 } | 5256 } |
5257 #endif | 5257 #endif |
5258 | 5258 |
5259 | 5259 |
5260 CodePatcher::CodePatcher(byte* address, int size) | 5260 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int size) |
5261 : address_(address), | 5261 : address_(address), |
5262 size_(size), | 5262 size_(size), |
5263 masm_(NULL, address, size + Assembler::kGap, CodeObjectRequired::kNo) { | 5263 masm_(isolate, address, size + Assembler::kGap, CodeObjectRequired::kNo) { |
5264 // Create a new macro assembler pointing to the address of the code to patch. | 5264 // Create a new macro assembler pointing to the address of the code to patch. |
5265 // The size is adjusted with kGap on order for the assembler to generate size | 5265 // The size is adjusted with kGap on order for the assembler to generate size |
5266 // bytes of instructions without failing with buffer size constraints. | 5266 // bytes of instructions without failing with buffer size constraints. |
5267 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5267 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
5268 } | 5268 } |
5269 | 5269 |
5270 | 5270 |
5271 CodePatcher::~CodePatcher() { | 5271 CodePatcher::~CodePatcher() { |
5272 // Indicate that code has changed. | 5272 // Indicate that code has changed. |
5273 Assembler::FlushICacheWithoutIsolate(address_, size_); | 5273 Assembler::FlushICache(masm_.isolate(), address_, size_); |
5274 | 5274 |
5275 // Check that the code was patched as expected. | 5275 // Check that the code was patched as expected. |
5276 DCHECK(masm_.pc_ == address_ + size_); | 5276 DCHECK(masm_.pc_ == address_ + size_); |
5277 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5277 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
5278 } | 5278 } |
5279 | 5279 |
5280 | 5280 |
5281 void MacroAssembler::CheckPageFlag( | 5281 void MacroAssembler::CheckPageFlag( |
5282 Register object, | 5282 Register object, |
5283 Register scratch, | 5283 Register scratch, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5582 movl(rax, dividend); | 5582 movl(rax, dividend); |
5583 shrl(rax, Immediate(31)); | 5583 shrl(rax, Immediate(31)); |
5584 addl(rdx, rax); | 5584 addl(rdx, rax); |
5585 } | 5585 } |
5586 | 5586 |
5587 | 5587 |
5588 } // namespace internal | 5588 } // namespace internal |
5589 } // namespace v8 | 5589 } // namespace v8 |
5590 | 5590 |
5591 #endif // V8_TARGET_ARCH_X64 | 5591 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |