| 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/locations.h" | 12 #include "vm/locations.h" |
| 12 #include "vm/memory_region.h" | 13 #include "vm/memory_region.h" |
| 13 #include "vm/runtime_entry.h" | 14 #include "vm/runtime_entry.h" |
| 14 #include "vm/stack_frame.h" | 15 #include "vm/stack_frame.h" |
| 15 #include "vm/stub_code.h" | 16 #include "vm/stub_code.h" |
| 16 | 17 |
| 17 namespace dart { | 18 namespace dart { |
| 18 | 19 |
| 19 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 20 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 20 DECLARE_FLAG(bool, inline_alloc); | 21 DECLARE_FLAG(bool, inline_alloc); |
| (...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2551 | 2552 |
| 2552 void Assembler::jmp(Register reg) { | 2553 void Assembler::jmp(Register reg) { |
| 2553 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2554 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 2554 Operand operand(reg); | 2555 Operand operand(reg); |
| 2555 EmitOperandREX(4, operand, REX_NONE); | 2556 EmitOperandREX(4, operand, REX_NONE); |
| 2556 EmitUint8(0xFF); | 2557 EmitUint8(0xFF); |
| 2557 EmitOperand(4, operand); | 2558 EmitOperand(4, operand); |
| 2558 } | 2559 } |
| 2559 | 2560 |
| 2560 | 2561 |
| 2562 void Assembler::jmp(const Address& dst) { |
| 2563 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 2564 EmitOperandREX(4, dst, REX_NONE); |
| 2565 EmitUint8(0xFF); |
| 2566 EmitOperand(4, dst); |
| 2567 } |
| 2568 |
| 2569 |
| 2561 void Assembler::jmp(Label* label, bool near) { | 2570 void Assembler::jmp(Label* label, bool near) { |
| 2562 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2571 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 2563 if (VerifiedMemory::enabled()) { | 2572 if (VerifiedMemory::enabled()) { |
| 2564 near = Assembler::kFarJump; | 2573 near = Assembler::kFarJump; |
| 2565 } | 2574 } |
| 2566 if (label->IsBound()) { | 2575 if (label->IsBound()) { |
| 2567 static const int kShortSize = 2; | 2576 static const int kShortSize = 2; |
| 2568 static const int kLongSize = 5; | 2577 static const int kLongSize = 5; |
| 2569 intptr_t offset = label->Position() - buffer_.Size(); | 2578 intptr_t offset = label->Position() - buffer_.Size(); |
| 2570 ASSERT(offset <= 0); | 2579 ASSERT(offset <= 0); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2592 EmitUint8(0xB8 | (TMP & 7)); | 2601 EmitUint8(0xB8 | (TMP & 7)); |
| 2593 EmitInt64(label->address()); | 2602 EmitInt64(label->address()); |
| 2594 } | 2603 } |
| 2595 jmp(TMP); | 2604 jmp(TMP); |
| 2596 } | 2605 } |
| 2597 | 2606 |
| 2598 | 2607 |
| 2599 void Assembler::JmpPatchable(const ExternalLabel* label, Register pp) { | 2608 void Assembler::JmpPatchable(const ExternalLabel* label, Register pp) { |
| 2600 ASSERT(allow_constant_pool()); | 2609 ASSERT(allow_constant_pool()); |
| 2601 intptr_t call_start = buffer_.GetPosition(); | 2610 intptr_t call_start = buffer_.GetPosition(); |
| 2602 LoadExternalLabel(TMP, label, kPatchable, pp); | 2611 const int32_t offset = |
| 2603 jmp(TMP); | 2612 Array::element_offset(FindExternalLabel(label, kPatchable)); |
| 2604 ASSERT((buffer_.GetPosition() - call_start) == kJmpExternalLabelSize); | 2613 // Patchable jumps always use a 32-bit immediate encoding. |
| 2614 jmp(Address::AddressBaseImm32(pp, offset - kHeapObjectTag)); |
| 2615 ASSERT((buffer_.GetPosition() - call_start) == JumpPattern::kLengthInBytes); |
| 2605 } | 2616 } |
| 2606 | 2617 |
| 2607 | 2618 |
| 2608 void Assembler::Jmp(const ExternalLabel* label, Register pp) { | 2619 void Assembler::Jmp(const ExternalLabel* label, Register pp) { |
| 2609 LoadExternalLabel(TMP, label, kNotPatchable, pp); | 2620 const int32_t offset = |
| 2610 jmp(TMP); | 2621 Array::element_offset(FindExternalLabel(label, kNotPatchable)); |
| 2622 jmp(Address(pp, offset - kHeapObjectTag)); |
| 2611 } | 2623 } |
| 2612 | 2624 |
| 2613 | 2625 |
| 2614 void Assembler::lock() { | 2626 void Assembler::lock() { |
| 2615 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2627 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 2616 EmitUint8(0xF0); | 2628 EmitUint8(0xF0); |
| 2617 } | 2629 } |
| 2618 | 2630 |
| 2619 | 2631 |
| 2620 void Assembler::cmpxchgl(const Address& address, Register reg) { | 2632 void Assembler::cmpxchgl(const Address& address, Register reg) { |
| (...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3991 | 4003 |
| 3992 | 4004 |
| 3993 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 4005 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3994 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 4006 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 3995 return xmm_reg_names[reg]; | 4007 return xmm_reg_names[reg]; |
| 3996 } | 4008 } |
| 3997 | 4009 |
| 3998 } // namespace dart | 4010 } // namespace dart |
| 3999 | 4011 |
| 4000 #endif // defined TARGET_ARCH_X64 | 4012 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |