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

Side by Side Diff: runtime/vm/assembler_ia32.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 | « no previous file | runtime/vm/assembler_x64.cc » ('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_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 class DirectCallRelocation : public AssemblerFixup { 19 class DirectCallRelocation : public AssemblerFixup {
16 public: 20 public:
17 void Process(const MemoryRegion& region, int position) { 21 void Process(const MemoryRegion& region, int position) {
18 // Direct calls are relative to the following instruction on x86. 22 // Direct calls are relative to the following instruction on x86.
19 int32_t pointer = region.Load<int32_t>(position); 23 int32_t pointer = region.Load<int32_t>(position);
20 int32_t delta = region.start() + position + sizeof(int32_t); 24 int32_t delta = region.start() + position + sizeof(int32_t);
21 region.Store<int32_t>(position, pointer - delta); 25 region.Store<int32_t>(position, pointer - delta);
22 } 26 }
23 }; 27 };
24 28
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 int position = label->NearPosition(); 1435 int position = label->NearPosition();
1432 int offset = bound - (position + 1); 1436 int offset = bound - (position + 1);
1433 ASSERT(Utils::IsInt(8, offset)); 1437 ASSERT(Utils::IsInt(8, offset));
1434 buffer_.Store<int8_t>(position, offset); 1438 buffer_.Store<int8_t>(position, offset);
1435 } 1439 }
1436 label->BindTo(bound); 1440 label->BindTo(bound);
1437 } 1441 }
1438 1442
1439 1443
1440 void Assembler::Stop(const char* message) { 1444 void Assembler::Stop(const char* message) {
1441 // Emit the message address as immediate operand in the test rax instruction, 1445 if (FLAG_print_stop_message) {
1442 // followed by the int3 instruction. 1446 pushl(EAX); // Preserve EAX.
1443 // Execution can be resumed with the 'cont' command in gdb. 1447 movl(EAX, Immediate(reinterpret_cast<int32_t>(message)));
1444 testl(EAX, Immediate(reinterpret_cast<int32_t>(message))); 1448 call(&StubCode::PrintStopMessageLabel()); // Passing message in EAX.
1445 int3(); 1449 popl(EAX); // Restore EAX.
1450 } else {
1451 // Emit the message address as immediate operand in the test instruction.
1452 testl(EAX, Immediate(reinterpret_cast<int32_t>(message)));
1453 }
1454 // Emit the int3 instruction.
1455 int3(); // Execution can be resumed with the 'cont' command in gdb.
1446 } 1456 }
1447 1457
1448 1458
1449 void Assembler::EmitOperand(int rm, const Operand& operand) { 1459 void Assembler::EmitOperand(int rm, const Operand& operand) {
1450 ASSERT(rm >= 0 && rm < 8); 1460 ASSERT(rm >= 0 && rm < 8);
1451 const int length = operand.length_; 1461 const int length = operand.length_;
1452 ASSERT(length > 0); 1462 ASSERT(length > 0);
1453 // Emit the ModRM byte updated with the given RM value. 1463 // Emit the ModRM byte updated with the given RM value.
1454 ASSERT((operand.encoding_[0] & 0x38) == 0); 1464 ASSERT((operand.encoding_[0] & 0x38) == 0);
1455 EmitUint8(operand.encoding_[0] + (rm << 3)); 1465 EmitUint8(operand.encoding_[0] + (rm << 3));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 Register shifter) { 1544 Register shifter) {
1535 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1545 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1536 ASSERT(shifter == ECX); 1546 ASSERT(shifter == ECX);
1537 EmitUint8(0xD3); 1547 EmitUint8(0xD3);
1538 EmitOperand(rm, Operand(operand)); 1548 EmitOperand(rm, Operand(operand));
1539 } 1549 }
1540 1550
1541 } // namespace dart 1551 } // namespace dart
1542 1552
1543 #endif // defined TARGET_ARCH_IA32 1553 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698