OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ | 5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ |
6 #define V8_ARM64_SIMULATOR_ARM64_H_ | 6 #define V8_ARM64_SIMULATOR_ARM64_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 bool PrintValue(const char* desc); | 260 bool PrintValue(const char* desc); |
261 | 261 |
262 // Push an address onto the JS stack. | 262 // Push an address onto the JS stack. |
263 uintptr_t PushAddress(uintptr_t address); | 263 uintptr_t PushAddress(uintptr_t address); |
264 | 264 |
265 // Pop an address from the JS stack. | 265 // Pop an address from the JS stack. |
266 uintptr_t PopAddress(); | 266 uintptr_t PopAddress(); |
267 | 267 |
268 // Accessor to the internal simulator stack area. | 268 // Accessor to the internal simulator stack area. |
269 uintptr_t StackLimit() const; | 269 uintptr_t StackLimit(uintptr_t c_limit) const; |
270 | 270 |
271 void ResetState(); | 271 void ResetState(); |
272 | 272 |
273 // Runtime call support. | 273 // Runtime call support. |
274 static void* RedirectExternalReference(void* external_function, | 274 static void* RedirectExternalReference(void* external_function, |
275 ExternalReference::Type type); | 275 ExternalReference::Type type); |
276 void DoRuntimeCall(Instruction* instr); | 276 void DoRuntimeCall(Instruction* instr); |
277 | 277 |
278 // Run the simulator. | 278 // Run the simulator. |
279 static const Instruction* kEndOfSimAddress; | 279 static const Instruction* kEndOfSimAddress; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 set_reg(31, value, Reg31IsStackPointer); | 394 set_reg(31, value, Reg31IsStackPointer); |
395 } | 395 } |
396 | 396 |
397 int64_t sp() { return xreg(31, Reg31IsStackPointer); } | 397 int64_t sp() { return xreg(31, Reg31IsStackPointer); } |
398 int64_t jssp() { return xreg(kJSSPCode, Reg31IsStackPointer); } | 398 int64_t jssp() { return xreg(kJSSPCode, Reg31IsStackPointer); } |
399 int64_t fp() { | 399 int64_t fp() { |
400 return xreg(kFramePointerRegCode, Reg31IsStackPointer); | 400 return xreg(kFramePointerRegCode, Reg31IsStackPointer); |
401 } | 401 } |
402 Instruction* lr() { return reg<Instruction*>(kLinkRegCode); } | 402 Instruction* lr() { return reg<Instruction*>(kLinkRegCode); } |
403 | 403 |
404 Address get_sp() { return reg<Address>(31, Reg31IsStackPointer); } | 404 Address get_sp() const { return reg<Address>(31, Reg31IsStackPointer); } |
405 | 405 |
406 template<typename T> | 406 template<typename T> |
407 T fpreg(unsigned code) const { | 407 T fpreg(unsigned code) const { |
408 DCHECK(code < kNumberOfRegisters); | 408 DCHECK(code < kNumberOfRegisters); |
409 return fpregisters_[code].Get<T>(); | 409 return fpregisters_[code].Get<T>(); |
410 } | 410 } |
411 | 411 |
412 // Common specialized accessors for the fpreg() template. | 412 // Common specialized accessors for the fpreg() template. |
413 float sreg(unsigned code) const { | 413 float sreg(unsigned code) const { |
414 return fpreg<float>(code); | 414 return fpreg<float>(code); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 FUNCTION_ADDR(entry), \ | 875 FUNCTION_ADDR(entry), \ |
876 p0, p1, p2, p3, p4)) | 876 p0, p1, p2, p3, p4)) |
877 | 877 |
878 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ | 878 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ |
879 static_cast<int>( \ | 879 static_cast<int>( \ |
880 Simulator::current(Isolate::Current()) \ | 880 Simulator::current(Isolate::Current()) \ |
881 ->CallRegExp(entry, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) | 881 ->CallRegExp(entry, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) |
882 | 882 |
883 | 883 |
884 // The simulator has its own stack. Thus it has a different stack limit from | 884 // The simulator has its own stack. Thus it has a different stack limit from |
885 // the C-based native code. | 885 // the C-based native code. The JS-based limit normally points near the end of |
886 // See also 'class SimulatorStack' in arm/simulator-arm.h. | 886 // the simulator stack. When the C-based limit is exhausted we reflect that by |
| 887 // lowering the JS-based limit as well, to make stack checks trigger. |
887 class SimulatorStack : public v8::internal::AllStatic { | 888 class SimulatorStack : public v8::internal::AllStatic { |
888 public: | 889 public: |
889 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 890 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
890 uintptr_t c_limit) { | 891 uintptr_t c_limit) { |
891 return Simulator::current(isolate)->StackLimit(); | 892 return Simulator::current(isolate)->StackLimit(c_limit); |
892 } | 893 } |
893 | 894 |
894 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { | 895 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { |
895 Simulator* sim = Simulator::current(Isolate::Current()); | 896 Simulator* sim = Simulator::current(Isolate::Current()); |
896 return sim->PushAddress(try_catch_address); | 897 return sim->PushAddress(try_catch_address); |
897 } | 898 } |
898 | 899 |
899 static void UnregisterCTryCatch() { | 900 static void UnregisterCTryCatch() { |
900 Simulator::current(Isolate::Current())->PopAddress(); | 901 Simulator::current(Isolate::Current())->PopAddress(); |
901 } | 902 } |
902 }; | 903 }; |
903 | 904 |
904 #endif // !defined(USE_SIMULATOR) | 905 #endif // !defined(USE_SIMULATOR) |
905 | 906 |
906 } } // namespace v8::internal | 907 } } // namespace v8::internal |
907 | 908 |
908 #endif // V8_ARM64_SIMULATOR_ARM64_H_ | 909 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
OLD | NEW |