| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| 11 #include "vm/instructions.h" | 11 #include "vm/instructions.h" |
| 12 #include "vm/locations.h" | 12 #include "vm/locations.h" |
| 13 #include "vm/memory_region.h" | 13 #include "vm/memory_region.h" |
| 14 #include "vm/runtime_entry.h" | 14 #include "vm/runtime_entry.h" |
| 15 #include "vm/stack_frame.h" | 15 #include "vm/stack_frame.h" |
| 16 #include "vm/stub_code.h" | 16 #include "vm/stub_code.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 | 19 |
| 20 DECLARE_FLAG(bool, check_code_pointer); | 20 DECLARE_FLAG(bool, check_code_pointer); |
| 21 DECLARE_FLAG(bool, inline_alloc); | 21 DECLARE_FLAG(bool, inline_alloc); |
| 22 | 22 |
| 23 | 23 |
| 24 Assembler::Assembler(bool use_far_branches) | 24 Assembler::Assembler(bool use_far_branches) |
| 25 : buffer_(), | 25 : buffer_(), |
| 26 prologue_offset_(-1), | 26 prologue_offset_(-1), |
| 27 has_single_entry_point_(true), |
| 27 comments_(), | 28 comments_(), |
| 28 constant_pool_allowed_(false) { | 29 constant_pool_allowed_(false) { |
| 29 // Far branching mode is only needed and implemented for MIPS and ARM. | 30 // Far branching mode is only needed and implemented for MIPS and ARM. |
| 30 ASSERT(!use_far_branches); | 31 ASSERT(!use_far_branches); |
| 31 MonomorphicCheckedEntry(); | |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { | 35 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { |
| 36 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length); | 36 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length); |
| 37 } | 37 } |
| 38 | 38 |
| 39 | 39 |
| 40 void Assembler::call(Register reg) { | 40 void Assembler::call(Register reg) { |
| 41 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 41 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| (...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3315 void Assembler::EnterStubFrame() { | 3315 void Assembler::EnterStubFrame() { |
| 3316 EnterDartFrame(0, kNoRegister); | 3316 EnterDartFrame(0, kNoRegister); |
| 3317 } | 3317 } |
| 3318 | 3318 |
| 3319 | 3319 |
| 3320 void Assembler::LeaveStubFrame() { | 3320 void Assembler::LeaveStubFrame() { |
| 3321 LeaveDartFrame(); | 3321 LeaveDartFrame(); |
| 3322 } | 3322 } |
| 3323 | 3323 |
| 3324 | 3324 |
| 3325 void Assembler::NoMonomorphicCheckedEntry() { | |
| 3326 buffer_.Reset(); | |
| 3327 for (intptr_t i = 0; i < Instructions::kCheckedEntryOffset; i++) { | |
| 3328 int3(); | |
| 3329 } | |
| 3330 ASSERT(CodeSize() == Instructions::kCheckedEntryOffset); | |
| 3331 } | |
| 3332 | |
| 3333 | |
| 3334 // RDI receiver, RBX guarded cid as Smi | 3325 // RDI receiver, RBX guarded cid as Smi |
| 3335 void Assembler::MonomorphicCheckedEntry() { | 3326 void Assembler::MonomorphicCheckedEntry() { |
| 3327 ASSERT(has_single_entry_point_); |
| 3328 has_single_entry_point_ = false; |
| 3336 Label immediate, have_cid, miss; | 3329 Label immediate, have_cid, miss; |
| 3337 Bind(&miss); | 3330 Bind(&miss); |
| 3338 jmp(Address(THR, Thread::monomorphic_miss_entry_offset())); | 3331 jmp(Address(THR, Thread::monomorphic_miss_entry_offset())); |
| 3339 | 3332 |
| 3340 Bind(&immediate); | 3333 Bind(&immediate); |
| 3341 movq(R10, Immediate(kSmiCid)); | 3334 movq(R10, Immediate(kSmiCid)); |
| 3342 jmp(&have_cid, kNearJump); | 3335 jmp(&have_cid, kNearJump); |
| 3343 | 3336 |
| 3344 Comment("MonomorphicCheckedEntry"); | 3337 Comment("MonomorphicCheckedEntry"); |
| 3345 ASSERT(CodeSize() == Instructions::kCheckedEntryOffset); | 3338 ASSERT(CodeSize() == Instructions::kCheckedEntryOffset); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3783 | 3776 |
| 3784 | 3777 |
| 3785 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3778 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3786 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3779 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 3787 return xmm_reg_names[reg]; | 3780 return xmm_reg_names[reg]; |
| 3788 } | 3781 } |
| 3789 | 3782 |
| 3790 } // namespace dart | 3783 } // namespace dart |
| 3791 | 3784 |
| 3792 #endif // defined TARGET_ARCH_X64 | 3785 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |