| 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 28 matching lines...) Expand all Loading... |
| 39 void* return_address, | 39 void* return_address, |
| 40 Isolate* isolate); | 40 Isolate* isolate); |
| 41 | 41 |
| 42 // Call the generated regexp code directly. The code at the entry address | 42 // Call the generated regexp code directly. The code at the entry address |
| 43 // should act as a function matching the type arm64_regexp_matcher. | 43 // should act as a function matching the type arm64_regexp_matcher. |
| 44 // The ninth argument is a dummy that reserves the space used for | 44 // The ninth argument is a dummy that reserves the space used for |
| 45 // the return address added by the ExitFrame in native calls. | 45 // the return address added by the ExitFrame in native calls. |
| 46 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ | 46 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ |
| 47 p7, p8) \ | 47 p7, p8) \ |
| 48 (FUNCTION_CAST<arm64_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ | 48 (FUNCTION_CAST<arm64_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ |
| 49 NULL, p8)) | 49 p8)) |
| 50 | 50 |
| 51 // Running without a simulator there is nothing to do. | 51 // Running without a simulator there is nothing to do. |
| 52 class SimulatorStack : public v8::internal::AllStatic { | 52 class SimulatorStack : public v8::internal::AllStatic { |
| 53 public: | 53 public: |
| 54 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 54 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
| 55 uintptr_t c_limit) { | 55 uintptr_t c_limit) { |
| 56 USE(isolate); | 56 USE(isolate); |
| 57 return c_limit; | 57 return c_limit; |
| 58 } | 58 } |
| 59 | 59 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 Object*** argv); | 194 Object*** argv); |
| 195 int64_t CallRegExp(byte* entry, | 195 int64_t CallRegExp(byte* entry, |
| 196 String* input, | 196 String* input, |
| 197 int64_t start_offset, | 197 int64_t start_offset, |
| 198 const byte* input_start, | 198 const byte* input_start, |
| 199 const byte* input_end, | 199 const byte* input_end, |
| 200 int* output, | 200 int* output, |
| 201 int64_t output_size, | 201 int64_t output_size, |
| 202 Address stack_base, | 202 Address stack_base, |
| 203 int64_t direct_call, | 203 int64_t direct_call, |
| 204 void* return_address, | |
| 205 Isolate* isolate); | 204 Isolate* isolate); |
| 206 | 205 |
| 207 // A wrapper class that stores an argument for one of the above Call | 206 // A wrapper class that stores an argument for one of the above Call |
| 208 // functions. | 207 // functions. |
| 209 // | 208 // |
| 210 // Only arguments up to 64 bits in size are supported. | 209 // Only arguments up to 64 bits in size are supported. |
| 211 class CallArgument { | 210 class CallArgument { |
| 212 public: | 211 public: |
| 213 template<typename T> | 212 template<typename T> |
| 214 explicit CallArgument(T argument) { | 213 explicit CallArgument(T argument) { |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 965 |
| 967 // When running with the simulator transition into simulated execution at this | 966 // When running with the simulator transition into simulated execution at this |
| 968 // point. | 967 // point. |
| 969 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ | 968 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ |
| 970 reinterpret_cast<Object*>(Simulator::current(isolate)->CallJS( \ | 969 reinterpret_cast<Object*>(Simulator::current(isolate)->CallJS( \ |
| 971 FUNCTION_ADDR(entry), p0, p1, p2, p3, p4)) | 970 FUNCTION_ADDR(entry), p0, p1, p2, p3, p4)) |
| 972 | 971 |
| 973 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ | 972 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ |
| 974 p7, p8) \ | 973 p7, p8) \ |
| 975 static_cast<int>(Simulator::current(isolate)->CallRegExp( \ | 974 static_cast<int>(Simulator::current(isolate)->CallRegExp( \ |
| 976 entry, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) | 975 entry, p0, p1, p2, p3, p4, p5, p6, p7, p8)) |
| 977 | |
| 978 | 976 |
| 979 // The simulator has its own stack. Thus it has a different stack limit from | 977 // The simulator has its own stack. Thus it has a different stack limit from |
| 980 // the C-based native code. The JS-based limit normally points near the end of | 978 // the C-based native code. The JS-based limit normally points near the end of |
| 981 // the simulator stack. When the C-based limit is exhausted we reflect that by | 979 // the simulator stack. When the C-based limit is exhausted we reflect that by |
| 982 // lowering the JS-based limit as well, to make stack checks trigger. | 980 // lowering the JS-based limit as well, to make stack checks trigger. |
| 983 class SimulatorStack : public v8::internal::AllStatic { | 981 class SimulatorStack : public v8::internal::AllStatic { |
| 984 public: | 982 public: |
| 985 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 983 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
| 986 uintptr_t c_limit) { | 984 uintptr_t c_limit) { |
| 987 return Simulator::current(isolate)->StackLimit(c_limit); | 985 return Simulator::current(isolate)->StackLimit(c_limit); |
| 988 } | 986 } |
| 989 | 987 |
| 990 static uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, | 988 static uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, |
| 991 uintptr_t try_catch_address) { | 989 uintptr_t try_catch_address) { |
| 992 Simulator* sim = Simulator::current(isolate); | 990 Simulator* sim = Simulator::current(isolate); |
| 993 return sim->PushAddress(try_catch_address); | 991 return sim->PushAddress(try_catch_address); |
| 994 } | 992 } |
| 995 | 993 |
| 996 static void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 994 static void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
| 997 Simulator::current(isolate)->PopAddress(); | 995 Simulator::current(isolate)->PopAddress(); |
| 998 } | 996 } |
| 999 }; | 997 }; |
| 1000 | 998 |
| 1001 #endif // !defined(USE_SIMULATOR) | 999 #endif // !defined(USE_SIMULATOR) |
| 1002 | 1000 |
| 1003 } // namespace internal | 1001 } // namespace internal |
| 1004 } // namespace v8 | 1002 } // namespace v8 |
| 1005 | 1003 |
| 1006 #endif // V8_ARM64_SIMULATOR_ARM64_H_ | 1004 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
| OLD | NEW |