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 <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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 } | 693 } |
694 | 694 |
695 | 695 |
696 Simulator::Simulator() { | 696 Simulator::Simulator() { |
697 // Setup simulator support first. Some of this information is needed to | 697 // Setup simulator support first. Some of this information is needed to |
698 // setup the architecture state. | 698 // setup the architecture state. |
699 // We allocate the stack here, the size is computed as the sum of | 699 // We allocate the stack here, the size is computed as the sum of |
700 // the size specified by the user and the buffer space needed for | 700 // the size specified by the user and the buffer space needed for |
701 // handling stack overflow exceptions. To be safe in potential | 701 // handling stack overflow exceptions. To be safe in potential |
702 // stack underflows we also add some underflow buffer space. | 702 // stack underflows we also add some underflow buffer space. |
703 stack_ = new char[(Isolate::GetSpecifiedStackSize() + | 703 stack_ = new char[(OSThread::GetSpecifiedStackSize() + |
704 Isolate::kStackSizeBuffer + | 704 OSThread::kStackSizeBuffer + |
705 kSimulatorStackUnderflowSize)]; | 705 kSimulatorStackUnderflowSize)]; |
706 pc_modified_ = false; | 706 pc_modified_ = false; |
707 icount_ = 0; | 707 icount_ = 0; |
708 break_pc_ = NULL; | 708 break_pc_ = NULL; |
709 break_instr_ = 0; | 709 break_instr_ = 0; |
710 last_setjmp_buffer_ = NULL; | 710 last_setjmp_buffer_ = NULL; |
711 top_exit_frame_info_ = 0; | 711 top_exit_frame_info_ = 0; |
712 | 712 |
713 // Setup architecture state. | 713 // Setup architecture state. |
714 // All registers are initialized to zero to start with. | 714 // All registers are initialized to zero to start with. |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 return value; | 1170 return value; |
1171 } | 1171 } |
1172 | 1172 |
1173 | 1173 |
1174 // Returns the top of the stack area to enable checking for stack pointer | 1174 // Returns the top of the stack area to enable checking for stack pointer |
1175 // validity. | 1175 // validity. |
1176 uword Simulator::StackTop() const { | 1176 uword Simulator::StackTop() const { |
1177 // To be safe in potential stack underflows we leave some buffer above and | 1177 // To be safe in potential stack underflows we leave some buffer above and |
1178 // set the stack top. | 1178 // set the stack top. |
1179 return StackBase() + | 1179 return StackBase() + |
1180 (Isolate::GetSpecifiedStackSize() + Isolate::kStackSizeBuffer); | 1180 (OSThread::GetSpecifiedStackSize() + OSThread::kStackSizeBuffer); |
1181 } | 1181 } |
1182 | 1182 |
1183 | 1183 |
1184 bool Simulator::IsTracingExecution() const { | 1184 bool Simulator::IsTracingExecution() const { |
1185 return icount_ > FLAG_trace_sim_after; | 1185 return icount_ > FLAG_trace_sim_after; |
1186 } | 1186 } |
1187 | 1187 |
1188 | 1188 |
1189 // Unsupported instructions use Format to print an error and stop execution. | 1189 // Unsupported instructions use Format to print an error and stop execution. |
1190 void Simulator::Format(Instr* instr, const char* format) { | 1190 void Simulator::Format(Instr* instr, const char* format) { |
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3886 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 3886 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
3887 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 3887 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
3888 buf->Longjmp(); | 3888 buf->Longjmp(); |
3889 } | 3889 } |
3890 | 3890 |
3891 } // namespace dart | 3891 } // namespace dart |
3892 | 3892 |
3893 #endif // defined(USING_SIMULATOR) | 3893 #endif // defined(USING_SIMULATOR) |
3894 | 3894 |
3895 #endif // defined TARGET_ARCH_ARM | 3895 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |