OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 30 matching lines...) Expand all Loading... |
41 #if !defined(USE_SIMULATOR) | 41 #if !defined(USE_SIMULATOR) |
42 // Running without a simulator on a native arm platform. | 42 // Running without a simulator on a native arm platform. |
43 | 43 |
44 namespace v8 { | 44 namespace v8 { |
45 namespace internal { | 45 namespace internal { |
46 | 46 |
47 // When running without a simulator we call the entry directly. | 47 // When running without a simulator we call the entry directly. |
48 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 48 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
49 (entry(p0, p1, p2, p3, p4)) | 49 (entry(p0, p1, p2, p3, p4)) |
50 | 50 |
51 // Call the generated regexp code directly. The entry function pointer should | 51 typedef int (*arm_regexp_matcher)(String*, int, const byte*, const byte*, |
52 // expect seven int/pointer sized arguments and return an int. | 52 void*, int*, Address, int); |
| 53 |
| 54 |
| 55 // Call the generated regexp code directly. The code at the entry address |
| 56 // should act as a function matching the type arm_regexp_matcher. |
| 57 // The fifth argument is a dummy that reserves the space used for |
| 58 // the return address added by the ExitFrame in native calls. |
53 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \ | 59 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \ |
54 (entry(p0, p1, p2, p3, NULL, p4, p5, p6)) | 60 (FUNCTION_CAST<arm_regexp_matcher>(entry)(p0, p1, p2, p3, NULL, p4, p5, p6)) |
55 | 61 |
56 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ | 62 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ |
57 (reinterpret_cast<TryCatch*>(try_catch_address)) | 63 (reinterpret_cast<TryCatch*>(try_catch_address)) |
58 | 64 |
59 // The stack limit beyond which we will throw stack overflow errors in | 65 // The stack limit beyond which we will throw stack overflow errors in |
60 // generated code. Because generated code on arm uses the C stack, we | 66 // generated code. Because generated code on arm uses the C stack, we |
61 // just use the C stack limit. | 67 // just use the C stack limit. |
62 class SimulatorStack : public v8::internal::AllStatic { | 68 class SimulatorStack : public v8::internal::AllStatic { |
63 public: | 69 public: |
64 static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) { | 70 static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 }; | 361 }; |
356 | 362 |
357 | 363 |
358 // When running with the simulator transition into simulated execution at this | 364 // When running with the simulator transition into simulated execution at this |
359 // point. | 365 // point. |
360 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 366 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
361 reinterpret_cast<Object*>(Simulator::current()->Call( \ | 367 reinterpret_cast<Object*>(Simulator::current()->Call( \ |
362 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) | 368 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) |
363 | 369 |
364 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \ | 370 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \ |
365 Simulator::current()->Call( \ | 371 Simulator::current()->Call(entry, 8, p0, p1, p2, p3, NULL, p4, p5, p6) |
366 FUNCTION_ADDR(entry), 8, p0, p1, p2, p3, NULL, p4, p5, p6) | |
367 | 372 |
368 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ | 373 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ |
369 try_catch_address == \ | 374 try_catch_address == \ |
370 NULL ? NULL : *(reinterpret_cast<TryCatch**>(try_catch_address)) | 375 NULL ? NULL : *(reinterpret_cast<TryCatch**>(try_catch_address)) |
371 | 376 |
372 | 377 |
373 // The simulator has its own stack. Thus it has a different stack limit from | 378 // The simulator has its own stack. Thus it has a different stack limit from |
374 // the C-based native code. Setting the c_limit to indicate a very small | 379 // the C-based native code. Setting the c_limit to indicate a very small |
375 // stack cause stack overflow errors, since the simulator ignores the input. | 380 // stack cause stack overflow errors, since the simulator ignores the input. |
376 // This is unlikely to be an issue in practice, though it might cause testing | 381 // This is unlikely to be an issue in practice, though it might cause testing |
(...skipping 11 matching lines...) Expand all Loading... |
388 | 393 |
389 static inline void UnregisterCTryCatch() { | 394 static inline void UnregisterCTryCatch() { |
390 Simulator::current()->PopAddress(); | 395 Simulator::current()->PopAddress(); |
391 } | 396 } |
392 }; | 397 }; |
393 | 398 |
394 } } // namespace v8::internal | 399 } } // namespace v8::internal |
395 | 400 |
396 #endif // !defined(USE_SIMULATOR) | 401 #endif // !defined(USE_SIMULATOR) |
397 #endif // V8_ARM_SIMULATOR_ARM_H_ | 402 #endif // V8_ARM_SIMULATOR_ARM_H_ |
OLD | NEW |