| 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, 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) { |
| 65 return c_limit; | 71 return c_limit; |
| 66 } | 72 } |
| 67 | 73 |
| 68 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { | 74 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { |
| 69 return try_catch_address; | 75 return try_catch_address; |
| 70 } | 76 } |
| 71 | 77 |
| 72 static inline void UnregisterCTryCatch() { } | 78 static inline void UnregisterCTryCatch() { } |
| 73 }; | 79 }; |
| 74 | 80 |
| 75 } } // namespace v8::internal | 81 } } // namespace v8::internal |
| 76 | 82 |
| 77 #else // !defined(USE_SIMULATOR) | 83 #else // !defined(USE_SIMULATOR) |
| 78 // Running with a simulator. | 84 // Running with a simulator. |
| 79 | 85 |
| 80 #include "constants-arm.h" | 86 #include "constants-arm.h" |
| 81 #include "hashmap.h" | 87 #include "hashmap.h" |
| 88 #include "assembler.h" |
| 82 | 89 |
| 83 namespace v8 { | 90 namespace v8 { |
| 84 namespace internal { | 91 namespace internal { |
| 85 | 92 |
| 86 class CachePage { | 93 class CachePage { |
| 87 public: | 94 public: |
| 88 static const int LINE_VALID = 0; | 95 static const int LINE_VALID = 0; |
| 89 static const int LINE_INVALID = 1; | 96 static const int LINE_INVALID = 1; |
| 90 | 97 |
| 91 static const int kPageShift = 12; | 98 static const int kPageShift = 12; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 285 |
| 279 // Executes one instruction. | 286 // Executes one instruction. |
| 280 void InstructionDecode(Instruction* instr); | 287 void InstructionDecode(Instruction* instr); |
| 281 | 288 |
| 282 // ICache. | 289 // ICache. |
| 283 static void CheckICache(Instruction* instr); | 290 static void CheckICache(Instruction* instr); |
| 284 static void FlushOnePage(intptr_t start, int size); | 291 static void FlushOnePage(intptr_t start, int size); |
| 285 static CachePage* GetCachePage(void* page); | 292 static CachePage* GetCachePage(void* page); |
| 286 | 293 |
| 287 // Runtime call support. | 294 // Runtime call support. |
| 288 static void* RedirectExternalReference(void* external_function, | 295 static void* RedirectExternalReference( |
| 289 bool fp_return); | 296 void* external_function, |
| 297 v8::internal::ExternalReference::Type type); |
| 290 | 298 |
| 291 // For use in calls that take two double values, constructed from r0, r1, r2 | 299 // For use in calls that take two double values, constructed from r0, r1, r2 |
| 292 // and r3. | 300 // and r3. |
| 293 void GetFpArgs(double* x, double* y); | 301 void GetFpArgs(double* x, double* y); |
| 294 void SetFpResult(const double& result); | 302 void SetFpResult(const double& result); |
| 295 void TrashCallerSaveRegisters(); | 303 void TrashCallerSaveRegisters(); |
| 296 | 304 |
| 297 // Architecture state. | 305 // Architecture state. |
| 298 // Saturating instructions require a Q flag to indicate saturation. | 306 // Saturating instructions require a Q flag to indicate saturation. |
| 299 // There is currently no way to read the CPSR directly, and thus read the Q | 307 // There is currently no way to read the CPSR directly, and thus read the Q |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 }; | 361 }; |
| 354 | 362 |
| 355 | 363 |
| 356 // When running with the simulator transition into simulated execution at this | 364 // When running with the simulator transition into simulated execution at this |
| 357 // point. | 365 // point. |
| 358 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 366 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
| 359 reinterpret_cast<Object*>(Simulator::current()->Call( \ | 367 reinterpret_cast<Object*>(Simulator::current()->Call( \ |
| 360 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) | 368 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) |
| 361 | 369 |
| 362 #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) \ |
| 363 Simulator::current()->Call( \ | 371 Simulator::current()->Call(entry, 8, p0, p1, p2, p3, NULL, p4, p5, p6) |
| 364 FUNCTION_ADDR(entry), 7, p0, p1, p2, p3, p4, p5, p6) | |
| 365 | 372 |
| 366 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ | 373 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ |
| 367 try_catch_address == \ | 374 try_catch_address == \ |
| 368 NULL ? NULL : *(reinterpret_cast<TryCatch**>(try_catch_address)) | 375 NULL ? NULL : *(reinterpret_cast<TryCatch**>(try_catch_address)) |
| 369 | 376 |
| 370 | 377 |
| 371 // 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 |
| 372 // 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 |
| 373 // stack cause stack overflow errors, since the simulator ignores the input. | 380 // stack cause stack overflow errors, since the simulator ignores the input. |
| 374 // 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... |
| 386 | 393 |
| 387 static inline void UnregisterCTryCatch() { | 394 static inline void UnregisterCTryCatch() { |
| 388 Simulator::current()->PopAddress(); | 395 Simulator::current()->PopAddress(); |
| 389 } | 396 } |
| 390 }; | 397 }; |
| 391 | 398 |
| 392 } } // namespace v8::internal | 399 } } // namespace v8::internal |
| 393 | 400 |
| 394 #endif // !defined(USE_SIMULATOR) | 401 #endif // !defined(USE_SIMULATOR) |
| 395 #endif // V8_ARM_SIMULATOR_ARM_H_ | 402 #endif // V8_ARM_SIMULATOR_ARM_H_ |
| OLD | NEW |