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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 if (reg6.is_valid()) regs |= reg6.bit(); | 2819 if (reg6.is_valid()) regs |= reg6.bit(); |
2820 if (reg7.is_valid()) regs |= reg7.bit(); | 2820 if (reg7.is_valid()) regs |= reg7.bit(); |
2821 if (reg8.is_valid()) regs |= reg8.bit(); | 2821 if (reg8.is_valid()) regs |= reg8.bit(); |
2822 int n_of_non_aliasing_regs = NumRegs(regs); | 2822 int n_of_non_aliasing_regs = NumRegs(regs); |
2823 | 2823 |
2824 return n_of_valid_regs != n_of_non_aliasing_regs; | 2824 return n_of_valid_regs != n_of_non_aliasing_regs; |
2825 } | 2825 } |
2826 #endif | 2826 #endif |
2827 | 2827 |
2828 | 2828 |
2829 CodePatcher::CodePatcher(byte* address, int size) | 2829 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int size) |
2830 : address_(address), | 2830 : address_(address), |
2831 size_(size), | 2831 size_(size), |
2832 masm_(NULL, address, size + Assembler::kGap, CodeObjectRequired::kNo) { | 2832 masm_(isolate, address, size + Assembler::kGap, CodeObjectRequired::kNo) { |
2833 // Create a new macro assembler pointing to the address of the code to patch. | 2833 // Create a new macro assembler pointing to the address of the code to patch. |
2834 // The size is adjusted with kGap on order for the assembler to generate size | 2834 // The size is adjusted with kGap on order for the assembler to generate size |
2835 // bytes of instructions without failing with buffer size constraints. | 2835 // bytes of instructions without failing with buffer size constraints. |
2836 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2836 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2837 } | 2837 } |
2838 | 2838 |
2839 | 2839 |
2840 CodePatcher::~CodePatcher() { | 2840 CodePatcher::~CodePatcher() { |
2841 // Indicate that code has changed. | 2841 // Indicate that code has changed. |
2842 Assembler::FlushICacheWithoutIsolate(address_, size_); | 2842 Assembler::FlushICache(masm_.isolate(), address_, size_); |
2843 | 2843 |
2844 // Check that the code was patched as expected. | 2844 // Check that the code was patched as expected. |
2845 DCHECK(masm_.pc_ == address_ + size_); | 2845 DCHECK(masm_.pc_ == address_ + size_); |
2846 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2846 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2847 } | 2847 } |
2848 | 2848 |
2849 | 2849 |
2850 void MacroAssembler::CheckPageFlag( | 2850 void MacroAssembler::CheckPageFlag( |
2851 Register object, | 2851 Register object, |
2852 Register scratch, | 2852 Register scratch, |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 mov(eax, dividend); | 3183 mov(eax, dividend); |
3184 shr(eax, 31); | 3184 shr(eax, 31); |
3185 add(edx, eax); | 3185 add(edx, eax); |
3186 } | 3186 } |
3187 | 3187 |
3188 | 3188 |
3189 } // namespace internal | 3189 } // namespace internal |
3190 } // namespace v8 | 3190 } // namespace v8 |
3191 | 3191 |
3192 #endif // V8_TARGET_ARCH_IA32 | 3192 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |