Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Side by Side Diff: runtime/vm/assembler_x64.cc

Issue 9128002: Print stop message. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(TMP); // Preserve TMP register.
1312 pushq(RDI); // Preserve RDI register.
1313 movq(RDI, Immediate(message_address));
1314 call(&StubCode::PrintStopMessageLabel());
1315 popq(RDI); // Restore RDI register.
1316 popq(TMP); // Restore TMP register.
1317 }
1305 // Emit the lower half and the higher half of the message address as immediate 1318 // 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. 1319 // operands in the test rax instructions, followed by the int3 instruction.
1307 // Execution can be resumed with the 'cont' command in gdb. 1320 // 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))); 1321 testl(RAX, Immediate(Utils::Low32Bits(message_address)));
Ivan Posva 2012/01/10 00:18:17 How about wrapping the testl instructions into the
regis 2012/01/10 00:32:37 Done.
1310 testl(RAX, Immediate(Utils::High32Bits(message_address))); 1322 testl(RAX, Immediate(Utils::High32Bits(message_address)));
1311 int3(); 1323 int3();
1312 } 1324 }
1313 1325
1314 1326
1315 void Assembler::Bind(Label* label) { 1327 void Assembler::Bind(Label* label) {
1316 int bound = buffer_.Size(); 1328 int bound = buffer_.Size();
1317 ASSERT(!label->IsBound()); // Labels can only be bound once. 1329 ASSERT(!label->IsBound()); // Labels can only be bound once.
1318 while (label->IsLinked()) { 1330 while (label->IsLinked()) {
1319 int position = label->LinkPosition(); 1331 int position = label->LinkPosition();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 } else { 1503 } else {
1492 EmitRegisterREX(operand, REX_NONE); 1504 EmitRegisterREX(operand, REX_NONE);
1493 } 1505 }
1494 EmitUint8(0xD3); 1506 EmitUint8(0xD3);
1495 EmitOperand(rm, Operand(operand)); 1507 EmitOperand(rm, Operand(operand));
1496 } 1508 }
1497 1509
1498 } // namespace dart 1510 } // namespace dart
1499 1511
1500 #endif // defined TARGET_ARCH_X64 1512 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698