| OLD | NEW |
| 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 <math.h> // for isnan. | 5 #include <math.h> // for isnan. |
| 6 #include <setjmp.h> | 6 #include <setjmp.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #if defined(TARGET_ARCH_MIPS) | 10 #if defined(TARGET_ARCH_MIPS) |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 825 |
| 826 void Simulator::DoBreak(Instr *instr) { | 826 void Simulator::DoBreak(Instr *instr) { |
| 827 ASSERT(instr->OpcodeField() == SPECIAL); | 827 ASSERT(instr->OpcodeField() == SPECIAL); |
| 828 ASSERT(instr->FunctionField() == BREAK); | 828 ASSERT(instr->FunctionField() == BREAK); |
| 829 if (instr->BreakCodeField() == Instr::kStopMessageCode) { | 829 if (instr->BreakCodeField() == Instr::kStopMessageCode) { |
| 830 SimulatorDebugger dbg(this); | 830 SimulatorDebugger dbg(this); |
| 831 const char* message = *reinterpret_cast<const char**>( | 831 const char* message = *reinterpret_cast<const char**>( |
| 832 reinterpret_cast<intptr_t>(instr) - Instr::kInstrSize); | 832 reinterpret_cast<intptr_t>(instr) - Instr::kInstrSize); |
| 833 set_pc(get_pc() + Instr::kInstrSize); | 833 set_pc(get_pc() + Instr::kInstrSize); |
| 834 dbg.Stop(instr, message); | 834 dbg.Stop(instr, message); |
| 835 // Adjust for extra pc increment. |
| 836 set_pc(get_pc() - Instr::kInstrSize); |
| 835 } else if (instr->BreakCodeField() == Instr::kRedirectCode) { | 837 } else if (instr->BreakCodeField() == Instr::kRedirectCode) { |
| 836 SimulatorSetjmpBuffer buffer(this); | 838 SimulatorSetjmpBuffer buffer(this); |
| 837 | 839 |
| 838 if (!setjmp(buffer.buffer_)) { | 840 if (!setjmp(buffer.buffer_)) { |
| 839 int32_t saved_ra = get_register(RA); | 841 int32_t saved_ra = get_register(RA); |
| 840 Redirection* redirection = Redirection::FromBreakInstruction(instr); | 842 Redirection* redirection = Redirection::FromBreakInstruction(instr); |
| 841 uword external = redirection->external_function(); | 843 uword external = redirection->external_function(); |
| 842 if (FLAG_trace_sim) { | 844 if (FLAG_trace_sim) { |
| 843 OS::Print("Call to host function at 0x%"Pd"\n", external); | 845 OS::Print("Call to host function at 0x%"Pd"\n", external); |
| 844 } | 846 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 for (int i = F0; i <= F31; i++) { | 909 for (int i = F0; i <= F31; i++) { |
| 908 set_fregister(static_cast<FRegister>(i), zap_dvalue); | 910 set_fregister(static_cast<FRegister>(i), zap_dvalue); |
| 909 } | 911 } |
| 910 | 912 |
| 911 // Return. Subtract to account for pc_ increment after return. | 913 // Return. Subtract to account for pc_ increment after return. |
| 912 set_pc(saved_ra - Instr::kInstrSize); | 914 set_pc(saved_ra - Instr::kInstrSize); |
| 913 } | 915 } |
| 914 } else { | 916 } else { |
| 915 SimulatorDebugger dbg(this); | 917 SimulatorDebugger dbg(this); |
| 916 dbg.Stop(instr, "breakpoint"); | 918 dbg.Stop(instr, "breakpoint"); |
| 919 // Adjust for extra pc increment. |
| 920 set_pc(get_pc() - Instr::kInstrSize); |
| 917 } | 921 } |
| 918 } | 922 } |
| 919 | 923 |
| 920 | 924 |
| 921 void Simulator::DecodeSpecial(Instr* instr) { | 925 void Simulator::DecodeSpecial(Instr* instr) { |
| 922 ASSERT(instr->OpcodeField() == SPECIAL); | 926 ASSERT(instr->OpcodeField() == SPECIAL); |
| 923 switch (instr->FunctionField()) { | 927 switch (instr->FunctionField()) { |
| 924 case ADDU: { | 928 case ADDU: { |
| 925 ASSERT(instr->SaField() == 0); | 929 ASSERT(instr->SaField() == 0); |
| 926 // Format(instr, "addu 'rd, 'rs, 'rt"); | 930 // Format(instr, "addu 'rd, 'rs, 'rt"); |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 // Restore the SP register and return R1:R0. | 1630 // Restore the SP register and return R1:R0. |
| 1627 set_register(SP, sp_before_call); | 1631 set_register(SP, sp_before_call); |
| 1628 return Utils::LowHighTo64Bits(get_register(V0), get_register(V1)); | 1632 return Utils::LowHighTo64Bits(get_register(V0), get_register(V1)); |
| 1629 } | 1633 } |
| 1630 | 1634 |
| 1631 } // namespace dart | 1635 } // namespace dart |
| 1632 | 1636 |
| 1633 #endif // !defined(HOST_ARCH_MIPS) | 1637 #endif // !defined(HOST_ARCH_MIPS) |
| 1634 | 1638 |
| 1635 #endif // defined TARGET_ARCH_MIPS | 1639 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |