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" |
(...skipping 10 matching lines...) Expand all Loading... |
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 comments_(), | 27 comments_(), |
28 constant_pool_allowed_(false) { | 28 constant_pool_allowed_(false) { |
29 // Far branching mode is only needed and implemented for MIPS and ARM. | 29 // Far branching mode is only needed and implemented for MIPS and ARM. |
30 ASSERT(!use_far_branches); | 30 ASSERT(!use_far_branches); |
| 31 MonomorphicCheckedEntry(); |
31 } | 32 } |
32 | 33 |
33 | 34 |
34 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { | 35 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { |
35 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length); | 36 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length); |
36 } | 37 } |
37 | 38 |
38 | 39 |
39 void Assembler::call(Register reg) { | 40 void Assembler::call(Register reg) { |
40 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 41 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
(...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3314 void Assembler::EnterStubFrame() { | 3315 void Assembler::EnterStubFrame() { |
3315 EnterDartFrame(0, kNoRegister); | 3316 EnterDartFrame(0, kNoRegister); |
3316 } | 3317 } |
3317 | 3318 |
3318 | 3319 |
3319 void Assembler::LeaveStubFrame() { | 3320 void Assembler::LeaveStubFrame() { |
3320 LeaveDartFrame(); | 3321 LeaveDartFrame(); |
3321 } | 3322 } |
3322 | 3323 |
3323 | 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 |
| 3335 void Assembler::MonomorphicCheckedEntry() { |
| 3336 Label immediate, have_cid, miss; |
| 3337 Bind(&miss); |
| 3338 movq(CODE_REG, Address(THR, Thread::monomorphic_miss_stub_offset())); |
| 3339 movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); |
| 3340 jmp(RCX); |
| 3341 |
| 3342 Bind(&immediate); |
| 3343 movq(R10, Immediate(kSmiCid)); |
| 3344 jmp(&have_cid, kNearJump); |
| 3345 |
| 3346 Comment("MonomorphicCheckedEntry"); |
| 3347 ASSERT(CodeSize() == Instructions::kCheckedEntryOffset); |
| 3348 SmiUntag(RBX); |
| 3349 testq(RDI, Immediate(kSmiTagMask)); |
| 3350 j(ZERO, &immediate, kNearJump); |
| 3351 |
| 3352 LoadClassId(R10, RDI); |
| 3353 |
| 3354 Bind(&have_cid); |
| 3355 cmpq(R10, RBX); |
| 3356 j(NOT_EQUAL, &miss, Assembler::kNearJump); |
| 3357 |
| 3358 // Fall through to unchecked entry. |
| 3359 ASSERT(CodeSize() == Instructions::kUncheckedEntryOffset); |
| 3360 ASSERT((CodeSize() & kSmiTagMask) == kSmiTag); |
| 3361 } |
| 3362 |
| 3363 |
3324 #ifndef PRODUCT | 3364 #ifndef PRODUCT |
3325 void Assembler::MaybeTraceAllocation(intptr_t cid, | 3365 void Assembler::MaybeTraceAllocation(intptr_t cid, |
3326 Label* trace, | 3366 Label* trace, |
3327 bool near_jump) { | 3367 bool near_jump) { |
3328 ASSERT(cid > 0); | 3368 ASSERT(cid > 0); |
3329 intptr_t state_offset = ClassTable::StateOffsetFor(cid); | 3369 intptr_t state_offset = ClassTable::StateOffsetFor(cid); |
3330 Register temp_reg = TMP; | 3370 Register temp_reg = TMP; |
3331 LoadIsolate(temp_reg); | 3371 LoadIsolate(temp_reg); |
3332 intptr_t table_offset = | 3372 intptr_t table_offset = |
3333 Isolate::class_table_offset() + ClassTable::TableOffsetFor(cid); | 3373 Isolate::class_table_offset() + ClassTable::TableOffsetFor(cid); |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3744 | 3784 |
3745 | 3785 |
3746 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3786 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3747 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3787 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3748 return xmm_reg_names[reg]; | 3788 return xmm_reg_names[reg]; |
3749 } | 3789 } |
3750 | 3790 |
3751 } // namespace dart | 3791 } // namespace dart |
3752 | 3792 |
3753 #endif // defined TARGET_ARCH_X64 | 3793 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |