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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
13 #include "src/debug/debug.h" | 13 #include "src/debug/debug.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 #include "src/arm/macro-assembler-arm.h" | 17 #include "src/arm/macro-assembler-arm.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 22 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, |
| 23 CodeObjectRequired create_code_object) |
23 : Assembler(arg_isolate, buffer, size), | 24 : Assembler(arg_isolate, buffer, size), |
24 generating_stub_(false), | 25 generating_stub_(false), |
25 has_frame_(false) { | 26 has_frame_(false) { |
26 if (isolate() != NULL) { | 27 if (create_code_object == CodeObjectRequired::kYes) { |
27 code_object_ = | 28 code_object_ = |
28 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); | 29 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); |
29 } | 30 } |
30 } | 31 } |
31 | 32 |
32 | 33 |
33 void MacroAssembler::Jump(Register target, Condition cond) { | 34 void MacroAssembler::Jump(Register target, Condition cond) { |
34 bx(target, cond); | 35 bx(target, cond); |
35 } | 36 } |
36 | 37 |
(...skipping 3601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 if (reg6.is_valid()) regs |= reg6.bit(); | 3639 if (reg6.is_valid()) regs |= reg6.bit(); |
3639 if (reg7.is_valid()) regs |= reg7.bit(); | 3640 if (reg7.is_valid()) regs |= reg7.bit(); |
3640 if (reg8.is_valid()) regs |= reg8.bit(); | 3641 if (reg8.is_valid()) regs |= reg8.bit(); |
3641 int n_of_non_aliasing_regs = NumRegs(regs); | 3642 int n_of_non_aliasing_regs = NumRegs(regs); |
3642 | 3643 |
3643 return n_of_valid_regs != n_of_non_aliasing_regs; | 3644 return n_of_valid_regs != n_of_non_aliasing_regs; |
3644 } | 3645 } |
3645 #endif | 3646 #endif |
3646 | 3647 |
3647 | 3648 |
3648 CodePatcher::CodePatcher(byte* address, | 3649 CodePatcher::CodePatcher(byte* address, int instructions, |
3649 int instructions, | |
3650 FlushICache flush_cache) | 3650 FlushICache flush_cache) |
3651 : address_(address), | 3651 : address_(address), |
3652 size_(instructions * Assembler::kInstrSize), | 3652 size_(instructions * Assembler::kInstrSize), |
3653 masm_(NULL, address, size_ + Assembler::kGap), | 3653 masm_(NULL, address, size_ + Assembler::kGap, CodeObjectRequired::kNo), |
3654 flush_cache_(flush_cache) { | 3654 flush_cache_(flush_cache) { |
3655 // Create a new macro assembler pointing to the address of the code to patch. | 3655 // Create a new macro assembler pointing to the address of the code to patch. |
3656 // The size is adjusted with kGap on order for the assembler to generate size | 3656 // The size is adjusted with kGap on order for the assembler to generate size |
3657 // bytes of instructions without failing with buffer size constraints. | 3657 // bytes of instructions without failing with buffer size constraints. |
3658 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 3658 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
3659 } | 3659 } |
3660 | 3660 |
3661 | 3661 |
3662 CodePatcher::~CodePatcher() { | 3662 CodePatcher::~CodePatcher() { |
3663 // Indicate that code has changed. | 3663 // Indicate that code has changed. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3707 } | 3707 } |
3708 } | 3708 } |
3709 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3709 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3710 add(result, result, Operand(dividend, LSR, 31)); | 3710 add(result, result, Operand(dividend, LSR, 31)); |
3711 } | 3711 } |
3712 | 3712 |
3713 } // namespace internal | 3713 } // namespace internal |
3714 } // namespace v8 | 3714 } // namespace v8 |
3715 | 3715 |
3716 #endif // V8_TARGET_ARCH_ARM | 3716 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |