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

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
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/stub_code.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
1305 // 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.
1307 // Execution can be resumed with the 'cont' command in gdb.
1308 int64_t message_address = reinterpret_cast<int64_t>(message); 1309 int64_t message_address = reinterpret_cast<int64_t>(message);
1309 testl(RAX, Immediate(Utils::Low32Bits(message_address))); 1310 if (FLAG_print_stop_message) {
1310 testl(RAX, Immediate(Utils::High32Bits(message_address))); 1311 pushq(TMP); // Preserve TMP register.
1311 int3(); 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 } else {
1318 // Emit the lower half and the higher half of the message address as
1319 // immediate operands in the test rax instructions.
1320 testl(RAX, Immediate(Utils::Low32Bits(message_address)));
1321 testl(RAX, Immediate(Utils::High32Bits(message_address)));
1322 }
1323 // Emit the int3 instruction.
1324 int3(); // Execution can be resumed with the 'cont' command in gdb.
1312 } 1325 }
1313 1326
1314 1327
1315 void Assembler::Bind(Label* label) { 1328 void Assembler::Bind(Label* label) {
1316 int bound = buffer_.Size(); 1329 int bound = buffer_.Size();
1317 ASSERT(!label->IsBound()); // Labels can only be bound once. 1330 ASSERT(!label->IsBound()); // Labels can only be bound once.
1318 while (label->IsLinked()) { 1331 while (label->IsLinked()) {
1319 int position = label->LinkPosition(); 1332 int position = label->LinkPosition();
1320 int next = buffer_.Load<int32_t>(position); 1333 int next = buffer_.Load<int32_t>(position);
1321 buffer_.Store<int32_t>(position, bound - (position + 4)); 1334 buffer_.Store<int32_t>(position, bound - (position + 4));
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 } else { 1504 } else {
1492 EmitRegisterREX(operand, REX_NONE); 1505 EmitRegisterREX(operand, REX_NONE);
1493 } 1506 }
1494 EmitUint8(0xD3); 1507 EmitUint8(0xD3);
1495 EmitOperand(rm, Operand(operand)); 1508 EmitOperand(rm, Operand(operand));
1496 } 1509 }
1497 1510
1498 } // namespace dart 1511 } // namespace dart
1499 1512
1500 #endif // defined TARGET_ARCH_X64 1513 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/stub_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698