| 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_ARM) | 10 #if defined(TARGET_ARCH_ARM) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // SScanF not being implemented in a platform independent way through | 30 // SScanF not being implemented in a platform independent way through |
| 31 // OS in the same way as SNPrint is that the Windows C Run-Time | 31 // OS in the same way as SNPrint is that the Windows C Run-Time |
| 32 // Library does not provide vsscanf. | 32 // Library does not provide vsscanf. |
| 33 #define SScanF sscanf // NOLINT | 33 #define SScanF sscanf // NOLINT |
| 34 | 34 |
| 35 | 35 |
| 36 // Unimplemented counter class for debugging and measurement purposes. | 36 // Unimplemented counter class for debugging and measurement purposes. |
| 37 class StatsCounter { | 37 class StatsCounter { |
| 38 public: | 38 public: |
| 39 explicit StatsCounter(const char* name) { | 39 explicit StatsCounter(const char* name) { |
| 40 UNIMPLEMENTED(); | 40 // UNIMPLEMENTED(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void Increment() { | 43 void Increment() { |
| 44 UNIMPLEMENTED(); | 44 // UNIMPLEMENTED(); |
| 45 } | 45 } |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 | 48 |
| 49 // SimulatorSetjmpBuffer are linked together, and the last created one | 49 // SimulatorSetjmpBuffer are linked together, and the last created one |
| 50 // is referenced by the Simulator. When an exception is thrown, the exception | 50 // is referenced by the Simulator. When an exception is thrown, the exception |
| 51 // runtime looks at where to jump and finds the corresponding | 51 // runtime looks at where to jump and finds the corresponding |
| 52 // SimulatorSetjmpBuffer based on the stack pointer of the exception handler. | 52 // SimulatorSetjmpBuffer based on the stack pointer of the exception handler. |
| 53 // The runtime then does a Longjmp on that buffer to return to the simulator. | 53 // The runtime then does a Longjmp on that buffer to return to the simulator. |
| 54 class SimulatorSetjmpBuffer { | 54 class SimulatorSetjmpBuffer { |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 } | 644 } |
| 645 fp_n_flag_ = false; | 645 fp_n_flag_ = false; |
| 646 fp_z_flag_ = false; | 646 fp_z_flag_ = false; |
| 647 fp_c_flag_ = false; | 647 fp_c_flag_ = false; |
| 648 fp_v_flag_ = false; | 648 fp_v_flag_ = false; |
| 649 } | 649 } |
| 650 | 650 |
| 651 | 651 |
| 652 Simulator::~Simulator() { | 652 Simulator::~Simulator() { |
| 653 delete[] stack_; | 653 delete[] stack_; |
| 654 Isolate::Current()->set_simulator(NULL); | 654 Isolate* isolate = Isolate::Current(); |
| 655 if (isolate != NULL) { |
| 656 isolate->set_simulator(NULL); |
| 657 } |
| 655 } | 658 } |
| 656 | 659 |
| 657 | 660 |
| 658 // When the generated code calls an external reference we need to catch that in | 661 // When the generated code calls an external reference we need to catch that in |
| 659 // the simulator. The external reference will be a function compiled for the | 662 // the simulator. The external reference will be a function compiled for the |
| 660 // host architecture. We need to call that function instead of trying to | 663 // host architecture. We need to call that function instead of trying to |
| 661 // execute it with the simulator. We do that by redirecting the external | 664 // execute it with the simulator. We do that by redirecting the external |
| 662 // reference to a svc (supervisor call) instruction that is handled by | 665 // reference to a svc (supervisor call) instruction that is handled by |
| 663 // the simulator. We write the original destination of the jump just at a known | 666 // the simulator. We write the original destination of the jump just at a known |
| 664 // offset from the svc instruction so the simulator knows what to call. | 667 // offset from the svc instruction so the simulator knows what to call. |
| (...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2730 // isolate->ChangeStateToGeneratedCode(); | 2733 // isolate->ChangeStateToGeneratedCode(); |
| 2731 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw())); | 2734 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw())); |
| 2732 buf->Longjmp(); | 2735 buf->Longjmp(); |
| 2733 } | 2736 } |
| 2734 | 2737 |
| 2735 } // namespace dart | 2738 } // namespace dart |
| 2736 | 2739 |
| 2737 #endif // !defined(HOST_ARCH_ARM) | 2740 #endif // !defined(HOST_ARCH_ARM) |
| 2738 | 2741 |
| 2739 #endif // defined TARGET_ARCH_ARM | 2742 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |