Chromium Code Reviews| 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" |
| 11 #include "vm/runtime_entry.h" | 11 #include "vm/runtime_entry.h" |
| 12 #include "vm/stub_code.h" | |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | |
| 17 | |
| 18 | |
| 15 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { | 19 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { |
| 16 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length); | 20 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length); |
| 17 } | 21 } |
| 18 | 22 |
| 19 | 23 |
| 20 void Assembler::call(Register reg) { | 24 void Assembler::call(Register reg) { |
| 21 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 25 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 22 Operand operand(reg); | 26 Operand operand(reg); |
| 23 EmitOperandREX(2, operand, REX_NONE); | 27 EmitOperandREX(2, operand, REX_NONE); |
| 24 EmitUint8(0xFF); | 28 EmitUint8(0xFF); |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1295 | 1299 |
| 1296 void Assembler::StoreIntoObject(Register object, | 1300 void Assembler::StoreIntoObject(Register object, |
| 1297 const FieldAddress& dest, | 1301 const FieldAddress& dest, |
| 1298 Register value) { | 1302 Register value) { |
| 1299 // TODO(iposva): Add write barrier. | 1303 // TODO(iposva): Add write barrier. |
| 1300 movq(dest, value); | 1304 movq(dest, value); |
| 1301 } | 1305 } |
| 1302 | 1306 |
| 1303 | 1307 |
| 1304 void Assembler::Stop(const char* message) { | 1308 void Assembler::Stop(const char* message) { |
| 1309 int64_t message_address = reinterpret_cast<int64_t>(message); | |
| 1310 if (FLAG_print_stop_message) { | |
| 1311 pushq(Immediate(message_address)); | |
| 1312 call(&StubCode::PrintStopMessageLabel()); | |
| 1313 popq(RAX); | |
|
Ivan Posva
2012/01/09 17:26:42
This kills the content of RAX.
How about:
pushq(R
regis
2012/01/10 00:09:16
Done. Using RDI instead of RAX and also preserving
| |
| 1314 } | |
| 1305 // Emit the lower half and the higher half of the message address as immediate | 1315 // Emit the lower half and the higher half of the message address as immediate |
| 1306 // operands in the test rax instructions, followed by the int3 instruction. | 1316 // operands in the test rax instructions, followed by the int3 instruction. |
| 1307 // Execution can be resumed with the 'cont' command in gdb. | 1317 // Execution can be resumed with the 'cont' command in gdb. |
| 1308 int64_t message_address = reinterpret_cast<int64_t>(message); | |
| 1309 testl(RAX, Immediate(Utils::Low32Bits(message_address))); | 1318 testl(RAX, Immediate(Utils::Low32Bits(message_address))); |
| 1310 testl(RAX, Immediate(Utils::High32Bits(message_address))); | 1319 testl(RAX, Immediate(Utils::High32Bits(message_address))); |
| 1311 int3(); | 1320 int3(); |
| 1312 } | 1321 } |
| 1313 | 1322 |
| 1314 | 1323 |
| 1315 void Assembler::Bind(Label* label) { | 1324 void Assembler::Bind(Label* label) { |
| 1316 int bound = buffer_.Size(); | 1325 int bound = buffer_.Size(); |
| 1317 ASSERT(!label->IsBound()); // Labels can only be bound once. | 1326 ASSERT(!label->IsBound()); // Labels can only be bound once. |
| 1318 while (label->IsLinked()) { | 1327 while (label->IsLinked()) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 } else { | 1500 } else { |
| 1492 EmitRegisterREX(operand, REX_NONE); | 1501 EmitRegisterREX(operand, REX_NONE); |
| 1493 } | 1502 } |
| 1494 EmitUint8(0xD3); | 1503 EmitUint8(0xD3); |
| 1495 EmitOperand(rm, Operand(operand)); | 1504 EmitOperand(rm, Operand(operand)); |
| 1496 } | 1505 } |
| 1497 | 1506 |
| 1498 } // namespace dart | 1507 } // namespace dart |
| 1499 | 1508 |
| 1500 #endif // defined TARGET_ARCH_X64 | 1509 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |