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