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

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

Issue 1097413004: Use a breakpoint instruction for a stop message on arm instead of (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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/disassembler_mips.cc ('k') | runtime/vm/simulator_arm64.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 <setjmp.h> // NOLINT 5 #include <setjmp.h> // NOLINT
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_ARM) 9 #if defined(TARGET_ARCH_ARM)
10 10
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1); 1499 typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1);
1500 1500
1501 // Calls to native Dart functions are based on this interface. 1501 // Calls to native Dart functions are based on this interface.
1502 typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments); 1502 typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments);
1503 typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target); 1503 typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target);
1504 1504
1505 1505
1506 void Simulator::SupervisorCall(Instr* instr) { 1506 void Simulator::SupervisorCall(Instr* instr) {
1507 int svc = instr->SvcField(); 1507 int svc = instr->SvcField();
1508 switch (svc) { 1508 switch (svc) {
1509 case kRedirectionSvcCode: { 1509 case Instr::kSimulatorRedirectCode: {
1510 SimulatorSetjmpBuffer buffer(this); 1510 SimulatorSetjmpBuffer buffer(this);
1511 1511
1512 if (!setjmp(buffer.buffer_)) { 1512 if (!setjmp(buffer.buffer_)) {
1513 int32_t saved_lr = get_register(LR); 1513 int32_t saved_lr = get_register(LR);
1514 Redirection* redirection = Redirection::FromSvcInstruction(instr); 1514 Redirection* redirection = Redirection::FromSvcInstruction(instr);
1515 uword external = redirection->external_function(); 1515 uword external = redirection->external_function();
1516 if (IsTracingExecution()) { 1516 if (IsTracingExecution()) {
1517 OS::Print("Call to host function at 0x%" Pd "\n", external); 1517 OS::Print("Call to host function at 0x%" Pd "\n", external);
1518 } 1518 }
1519 1519
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 1620
1621 // Return. 1621 // Return.
1622 set_pc(saved_lr); 1622 set_pc(saved_lr);
1623 } else { 1623 } else {
1624 // Coming via long jump from a throw. Continue to exception handler. 1624 // Coming via long jump from a throw. Continue to exception handler.
1625 set_top_exit_frame_info(0); 1625 set_top_exit_frame_info(0);
1626 } 1626 }
1627 1627
1628 break; 1628 break;
1629 } 1629 }
1630 case kBreakpointSvcCode: { 1630 case Instr::kSimulatorBreakCode: {
1631 SimulatorDebugger dbg(this); 1631 SimulatorDebugger dbg(this);
1632 dbg.Stop(instr, "breakpoint"); 1632 dbg.Stop(instr, "breakpoint");
1633 break; 1633 break;
1634 } 1634 }
1635 case kStopMessageSvcCode: {
1636 SimulatorDebugger dbg(this);
1637 const char* message = *reinterpret_cast<const char**>(
1638 reinterpret_cast<intptr_t>(instr) - Instr::kInstrSize);
1639 set_pc(get_pc() + Instr::kInstrSize);
1640 dbg.Stop(instr, message);
1641 break;
1642 }
1643 default: { 1635 default: {
1644 UNREACHABLE(); 1636 UNREACHABLE();
1645 break; 1637 break;
1646 } 1638 }
1647 } 1639 }
1648 } 1640 }
1649 1641
1650 1642
1651 // Handle execution based on instruction types. 1643 // Handle execution based on instruction types.
1652 1644
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 int32_t rm_val = get_register(rm); 1681 int32_t rm_val = get_register(rm);
1690 intptr_t pc = get_pc(); 1682 intptr_t pc = get_pc();
1691 set_register(LR, pc + Instr::kInstrSize); 1683 set_register(LR, pc + Instr::kInstrSize);
1692 set_pc(rm_val); 1684 set_pc(rm_val);
1693 break; 1685 break;
1694 } 1686 }
1695 case 7: { 1687 case 7: {
1696 if ((instr->Bits(21, 2) == 0x1) && (instr->ConditionField() == AL)) { 1688 if ((instr->Bits(21, 2) == 0x1) && (instr->ConditionField() == AL)) {
1697 // Format(instr, "bkpt #'imm12_4"); 1689 // Format(instr, "bkpt #'imm12_4");
1698 SimulatorDebugger dbg(this); 1690 SimulatorDebugger dbg(this);
1699 set_pc(get_pc() + Instr::kInstrSize); 1691 int32_t imm = instr->BkptField();
1700 char buffer[32]; 1692 if (imm == Instr::kStopMessageCode) {
1701 snprintf(buffer, sizeof(buffer), "bkpt #0x%x", instr->BkptField()); 1693 const char* message = *reinterpret_cast<const char**>(
1702 dbg.Stop(instr, buffer); 1694 reinterpret_cast<intptr_t>(instr) - Instr::kInstrSize);
1695 set_pc(get_pc() + Instr::kInstrSize);
1696 dbg.Stop(instr, message);
1697 } else {
1698 char buffer[32];
1699 snprintf(buffer, sizeof(buffer), "bkpt #0x%x", imm);
1700 set_pc(get_pc() + Instr::kInstrSize);
1701 dbg.Stop(instr, buffer);
1702 }
1703 } else { 1703 } else {
1704 // Format(instr, "smc'cond"); 1704 // Format(instr, "smc'cond");
1705 UnimplementedInstruction(instr); 1705 UnimplementedInstruction(instr);
1706 } 1706 }
1707 break; 1707 break;
1708 } 1708 }
1709 default: { 1709 default: {
1710 UnimplementedInstruction(instr); 1710 UnimplementedInstruction(instr);
1711 break; 1711 break;
1712 } 1712 }
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3873 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3873 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3874 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3874 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3875 buf->Longjmp(); 3875 buf->Longjmp();
3876 } 3876 }
3877 3877
3878 } // namespace dart 3878 } // namespace dart
3879 3879
3880 #endif // !defined(HOST_ARCH_ARM) 3880 #endif // !defined(HOST_ARCH_ARM)
3881 3881
3882 #endif // defined TARGET_ARCH_ARM 3882 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_mips.cc ('k') | runtime/vm/simulator_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698