OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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" | 5 #include "vm/globals.h" |
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/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1117 if (value == 1) { | 1117 if (value == 1) { |
1118 decq(reg); | 1118 decq(reg); |
1119 } else if (value != 0) { | 1119 } else if (value != 0) { |
1120 subq(reg, Immediate(value)); | 1120 subq(reg, Immediate(value)); |
1121 } | 1121 } |
1122 } | 1122 } |
1123 } | 1123 } |
1124 | 1124 |
1125 | 1125 |
1126 void Assembler::LoadObject(Register dst, const Object& object) { | 1126 void Assembler::LoadObject(Register dst, const Object& object) { |
1127 UNIMPLEMENTED(); | |
1128 ASSERT(object.IsZoneHandle()); | 1127 ASSERT(object.IsZoneHandle()); |
1129 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1128 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1130 EmitUint8(0xB8 + dst); | 1129 EmitRegisterREX(dst, REX_W); |
1130 EmitUint8(0xB8 | (dst & 7)); | |
1131 buffer_.EmitObject(object); | 1131 buffer_.EmitObject(object); |
1132 } | 1132 } |
1133 | 1133 |
1134 | 1134 |
1135 void Assembler::PushObject(const Object& object) { | 1135 void Assembler::PushObject(const Object& object) { |
1136 UNIMPLEMENTED(); | 1136 LoadObject(R11, object); |
1137 ASSERT(object.IsZoneHandle()); | 1137 pushq(R11); |
srdjan
2011/12/01 01:26:07
Should we label R11 as scratch register?
regis
2011/12/01 01:42:04
Defined alias TMP as R11.
| |
1138 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | |
1139 EmitUint8(0x68); | |
1140 buffer_.EmitObject(object); | |
1141 } | 1138 } |
1142 | 1139 |
1143 | 1140 |
1144 void Assembler::CompareObject(Register reg, const Object& object) { | 1141 void Assembler::CompareObject(Register reg, const Object& object) { |
1145 UNIMPLEMENTED(); | 1142 ASSERT(reg != R11); |
1146 ASSERT(object.IsZoneHandle()); | 1143 LoadObject(R11, object); |
1147 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1144 cmpq(reg, R11); |
1148 if (reg == RAX) { | |
1149 EmitUint8(0x05 + (7 << 3)); | |
1150 buffer_.EmitObject(object); | |
1151 } else { | |
1152 EmitUint8(0x81); | |
1153 EmitOperand(7, Operand(reg)); | |
1154 buffer_.EmitObject(object); | |
1155 } | |
1156 } | 1145 } |
1157 | 1146 |
1158 | 1147 |
1159 void Assembler::Stop(const char* message) { | 1148 void Assembler::Stop(const char* message) { |
1160 // Emit the lower half and the higher half of the message address as immediate | 1149 // Emit the lower half and the higher half of the message address as immediate |
1161 // operands in the test rax instructions, followed by the int3 instruction. | 1150 // operands in the test rax instructions, followed by the int3 instruction. |
1162 // Execution can be resumed with the 'cont' command in gdb. | 1151 // Execution can be resumed with the 'cont' command in gdb. |
1163 int64_t message_address = reinterpret_cast<int64_t>(message); | 1152 int64_t message_address = reinterpret_cast<int64_t>(message); |
1164 testl(RAX, Immediate(Utils::Low32Bits(message_address))); | 1153 testl(RAX, Immediate(Utils::Low32Bits(message_address))); |
1165 testl(RAX, Immediate(Utils::High32Bits(message_address))); | 1154 testl(RAX, Immediate(Utils::High32Bits(message_address))); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1303 } else { | 1292 } else { |
1304 EmitRegisterREX(operand, REX_NONE); | 1293 EmitRegisterREX(operand, REX_NONE); |
1305 } | 1294 } |
1306 EmitUint8(0xD3); | 1295 EmitUint8(0xD3); |
1307 EmitOperand(rm, Operand(operand)); | 1296 EmitOperand(rm, Operand(operand)); |
1308 } | 1297 } |
1309 | 1298 |
1310 } // namespace dart | 1299 } // namespace dart |
1311 | 1300 |
1312 #endif // defined TARGET_ARCH_X64 | 1301 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |