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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 if (reg6.is_valid()) regs |= reg6.bit(); | 2653 if (reg6.is_valid()) regs |= reg6.bit(); |
2654 if (reg7.is_valid()) regs |= reg7.bit(); | 2654 if (reg7.is_valid()) regs |= reg7.bit(); |
2655 if (reg8.is_valid()) regs |= reg8.bit(); | 2655 if (reg8.is_valid()) regs |= reg8.bit(); |
2656 int n_of_non_aliasing_regs = NumRegs(regs); | 2656 int n_of_non_aliasing_regs = NumRegs(regs); |
2657 | 2657 |
2658 return n_of_valid_regs != n_of_non_aliasing_regs; | 2658 return n_of_valid_regs != n_of_non_aliasing_regs; |
2659 } | 2659 } |
2660 #endif | 2660 #endif |
2661 | 2661 |
2662 | 2662 |
2663 CodePatcher::CodePatcher(byte* address, int size) | 2663 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int size) |
2664 : address_(address), | 2664 : address_(address), |
2665 size_(size), | 2665 size_(size), |
2666 masm_(NULL, address, size + Assembler::kGap, CodeObjectRequired::kNo) { | 2666 masm_(isolate, address, size + Assembler::kGap, CodeObjectRequired::kNo) { |
2667 // Create a new macro assembler pointing to the address of the code to patch. | 2667 // Create a new macro assembler pointing to the address of the code to patch. |
2668 // The size is adjusted with kGap on order for the assembler to generate size | 2668 // The size is adjusted with kGap on order for the assembler to generate size |
2669 // bytes of instructions without failing with buffer size constraints. | 2669 // bytes of instructions without failing with buffer size constraints. |
2670 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2670 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2671 } | 2671 } |
2672 | 2672 |
2673 | 2673 |
2674 CodePatcher::~CodePatcher() { | 2674 CodePatcher::~CodePatcher() { |
2675 // Indicate that code has changed. | 2675 // Indicate that code has changed. |
2676 Assembler::FlushICacheWithoutIsolate(address_, size_); | 2676 Assembler::FlushICache(masm_.isolate(), address_, size_); |
2677 | 2677 |
2678 // Check that the code was patched as expected. | 2678 // Check that the code was patched as expected. |
2679 DCHECK(masm_.pc_ == address_ + size_); | 2679 DCHECK(masm_.pc_ == address_ + size_); |
2680 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2680 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2681 } | 2681 } |
2682 | 2682 |
2683 | 2683 |
2684 void MacroAssembler::CheckPageFlag( | 2684 void MacroAssembler::CheckPageFlag( |
2685 Register object, | 2685 Register object, |
2686 Register scratch, | 2686 Register scratch, |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 mov(eax, dividend); | 3017 mov(eax, dividend); |
3018 shr(eax, 31); | 3018 shr(eax, 31); |
3019 add(edx, eax); | 3019 add(edx, eax); |
3020 } | 3020 } |
3021 | 3021 |
3022 | 3022 |
3023 } // namespace internal | 3023 } // namespace internal |
3024 } // namespace v8 | 3024 } // namespace v8 |
3025 | 3025 |
3026 #endif // V8_TARGET_ARCH_X87 | 3026 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |