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" |
11 #include "src/debug/debug.h" | 11 #include "src/debug/debug.h" |
12 #include "src/ia32/frames-ia32.h" | 12 #include "src/ia32/frames-ia32.h" |
13 #include "src/ia32/macro-assembler-ia32.h" | 13 #include "src/ia32/macro-assembler-ia32.h" |
14 #include "src/runtime/runtime.h" | 14 #include "src/runtime/runtime.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 // ------------------------------------------------------------------------- | 19 // ------------------------------------------------------------------------- |
20 // MacroAssembler implementation. | 20 // MacroAssembler implementation. |
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::Load(Register dst, const Operand& src, Representation r) { | 34 void MacroAssembler::Load(Register dst, const Operand& src, Representation r) { |
34 DCHECK(!r.IsDouble()); | 35 DCHECK(!r.IsDouble()); |
35 if (r.IsInteger8()) { | 36 if (r.IsInteger8()) { |
36 movsx_b(dst, src); | 37 movsx_b(dst, src); |
(...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2785 int n_of_non_aliasing_regs = NumRegs(regs); | 2786 int n_of_non_aliasing_regs = NumRegs(regs); |
2786 | 2787 |
2787 return n_of_valid_regs != n_of_non_aliasing_regs; | 2788 return n_of_valid_regs != n_of_non_aliasing_regs; |
2788 } | 2789 } |
2789 #endif | 2790 #endif |
2790 | 2791 |
2791 | 2792 |
2792 CodePatcher::CodePatcher(byte* address, int size) | 2793 CodePatcher::CodePatcher(byte* address, int size) |
2793 : address_(address), | 2794 : address_(address), |
2794 size_(size), | 2795 size_(size), |
2795 masm_(NULL, address, size + Assembler::kGap) { | 2796 masm_(NULL, address, size + Assembler::kGap, CodeObjectRequired::kNo) { |
2796 // Create a new macro assembler pointing to the address of the code to patch. | 2797 // Create a new macro assembler pointing to the address of the code to patch. |
2797 // The size is adjusted with kGap on order for the assembler to generate size | 2798 // The size is adjusted with kGap on order for the assembler to generate size |
2798 // bytes of instructions without failing with buffer size constraints. | 2799 // bytes of instructions without failing with buffer size constraints. |
2799 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2800 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2800 } | 2801 } |
2801 | 2802 |
2802 | 2803 |
2803 CodePatcher::~CodePatcher() { | 2804 CodePatcher::~CodePatcher() { |
2804 // Indicate that code has changed. | 2805 // Indicate that code has changed. |
2805 Assembler::FlushICacheWithoutIsolate(address_, size_); | 2806 Assembler::FlushICacheWithoutIsolate(address_, size_); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 mov(eax, dividend); | 3147 mov(eax, dividend); |
3147 shr(eax, 31); | 3148 shr(eax, 31); |
3148 add(edx, eax); | 3149 add(edx, eax); |
3149 } | 3150 } |
3150 | 3151 |
3151 | 3152 |
3152 } // namespace internal | 3153 } // namespace internal |
3153 } // namespace v8 | 3154 } // namespace v8 |
3154 | 3155 |
3155 #endif // V8_TARGET_ARCH_IA32 | 3156 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |