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" |
11 #include "src/debug/debug.h" | 11 #include "src/debug/debug.h" |
12 #include "src/heap/heap.h" | 12 #include "src/heap/heap.h" |
13 #include "src/register-configuration.h" | 13 #include "src/register-configuration.h" |
14 #include "src/x64/assembler-x64.h" | 14 #include "src/x64/assembler-x64.h" |
15 #include "src/x64/macro-assembler-x64.h" | 15 #include "src/x64/macro-assembler-x64.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 | 19 |
20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, |
| 21 bool create_code_object) |
21 : Assembler(arg_isolate, buffer, size), | 22 : Assembler(arg_isolate, buffer, size), |
22 generating_stub_(false), | 23 generating_stub_(false), |
23 has_frame_(false), | 24 has_frame_(false), |
24 root_array_available_(true) { | 25 root_array_available_(true) { |
25 if (isolate() != NULL) { | 26 if (create_code_object) { |
26 code_object_ = | 27 code_object_ = |
27 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); | 28 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); |
28 } | 29 } |
29 } | 30 } |
30 | 31 |
31 | 32 |
32 static const int64_t kInvalidRootRegisterDelta = -1; | 33 static const int64_t kInvalidRootRegisterDelta = -1; |
33 | 34 |
34 | 35 |
35 int64_t MacroAssembler::RootRegisterDelta(ExternalReference other) { | 36 int64_t MacroAssembler::RootRegisterDelta(ExternalReference other) { |
(...skipping 5147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5183 int n_of_non_aliasing_regs = NumRegs(regs); | 5184 int n_of_non_aliasing_regs = NumRegs(regs); |
5184 | 5185 |
5185 return n_of_valid_regs != n_of_non_aliasing_regs; | 5186 return n_of_valid_regs != n_of_non_aliasing_regs; |
5186 } | 5187 } |
5187 #endif | 5188 #endif |
5188 | 5189 |
5189 | 5190 |
5190 CodePatcher::CodePatcher(byte* address, int size) | 5191 CodePatcher::CodePatcher(byte* address, int size) |
5191 : address_(address), | 5192 : address_(address), |
5192 size_(size), | 5193 size_(size), |
5193 masm_(NULL, address, size + Assembler::kGap) { | 5194 masm_(NULL, address, size + Assembler::kGap, false) { |
5194 // Create a new macro assembler pointing to the address of the code to patch. | 5195 // Create a new macro assembler pointing to the address of the code to patch. |
5195 // The size is adjusted with kGap on order for the assembler to generate size | 5196 // The size is adjusted with kGap on order for the assembler to generate size |
5196 // bytes of instructions without failing with buffer size constraints. | 5197 // bytes of instructions without failing with buffer size constraints. |
5197 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5198 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
5198 } | 5199 } |
5199 | 5200 |
5200 | 5201 |
5201 CodePatcher::~CodePatcher() { | 5202 CodePatcher::~CodePatcher() { |
5202 // Indicate that code has changed. | 5203 // Indicate that code has changed. |
5203 Assembler::FlushICacheWithoutIsolate(address_, size_); | 5204 Assembler::FlushICacheWithoutIsolate(address_, size_); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5512 movl(rax, dividend); | 5513 movl(rax, dividend); |
5513 shrl(rax, Immediate(31)); | 5514 shrl(rax, Immediate(31)); |
5514 addl(rdx, rax); | 5515 addl(rdx, rax); |
5515 } | 5516 } |
5516 | 5517 |
5517 | 5518 |
5518 } // namespace internal | 5519 } // namespace internal |
5519 } // namespace v8 | 5520 } // namespace v8 |
5520 | 5521 |
5521 #endif // V8_TARGET_ARCH_X64 | 5522 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |