Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: src/arm/simulator-arm.h

Issue 1457223005: Remove a bunch of Isolate::Current() callsites from simulators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/arm/simulator-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5
6 // Declares a Simulator for ARM instructions if we are not generating a native 6 // Declares a Simulator for ARM instructions if we are not generating a native
7 // ARM binary. This Simulator allows us to run and debug ARM code generation on 7 // ARM binary. This Simulator allows us to run and debug ARM code generation on
8 // regular desktop machines. 8 // regular desktop machines.
9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, 9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro,
10 // which will start execution in the Simulator or forwards to the real entry 10 // which will start execution in the Simulator or forwards to the real entry
11 // on a ARM HW platform. 11 // on a ARM HW platform.
12 12
13 #ifndef V8_ARM_SIMULATOR_ARM_H_ 13 #ifndef V8_ARM_SIMULATOR_ARM_H_
14 #define V8_ARM_SIMULATOR_ARM_H_ 14 #define V8_ARM_SIMULATOR_ARM_H_
15 15
16 #include "src/allocation.h" 16 #include "src/allocation.h"
17 17
18 #if !defined(USE_SIMULATOR) 18 #if !defined(USE_SIMULATOR)
19 // Running without a simulator on a native arm platform. 19 // Running without a simulator on a native arm platform.
20 20
21 namespace v8 { 21 namespace v8 {
22 namespace internal { 22 namespace internal {
23 23
24 // When running without a simulator we call the entry directly. 24 // When running without a simulator we call the entry directly.
25 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ 25 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
26 (entry(p0, p1, p2, p3, p4)) 26 (entry(p0, p1, p2, p3, p4))
27 27
28 typedef int (*arm_regexp_matcher)(String*, int, const byte*, const byte*, 28 typedef int (*arm_regexp_matcher)(String*, int, const byte*, const byte*,
29 void*, int*, int, Address, int, Isolate*); 29 void*, int*, int, Address, int, Isolate*);
30 30
31 31
32 // Call the generated regexp code directly. The code at the entry address 32 // Call the generated regexp code directly. The code at the entry address
33 // should act as a function matching the type arm_regexp_matcher. 33 // should act as a function matching the type arm_regexp_matcher.
34 // The fifth argument is a dummy that reserves the space used for 34 // The fifth argument is a dummy that reserves the space used for
35 // the return address added by the ExitFrame in native calls. 35 // the return address added by the ExitFrame in native calls.
36 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ 36 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
37 (FUNCTION_CAST<arm_regexp_matcher>(entry)( \ 37 p7, p8) \
38 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)) 38 (FUNCTION_CAST<arm_regexp_matcher>(entry)(p0, p1, p2, p3, NULL, p4, p5, p6, \
39 p7, p8))
39 40
40 // The stack limit beyond which we will throw stack overflow errors in 41 // The stack limit beyond which we will throw stack overflow errors in
41 // generated code. Because generated code on arm uses the C stack, we 42 // generated code. Because generated code on arm uses the C stack, we
42 // just use the C stack limit. 43 // just use the C stack limit.
43 class SimulatorStack : public v8::internal::AllStatic { 44 class SimulatorStack : public v8::internal::AllStatic {
44 public: 45 public:
45 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, 46 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate,
46 uintptr_t c_limit) { 47 uintptr_t c_limit) {
47 USE(isolate); 48 USE(isolate);
48 return c_limit; 49 return c_limit;
49 } 50 }
50 51
51 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { 52 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate,
53 uintptr_t try_catch_address) {
54 USE(isolate);
52 return try_catch_address; 55 return try_catch_address;
53 } 56 }
54 57
55 static inline void UnregisterCTryCatch() { } 58 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) {
59 USE(isolate);
60 }
56 }; 61 };
57 62
58 } // namespace internal 63 } // namespace internal
59 } // namespace v8 64 } // namespace v8
60 65
61 #else // !defined(USE_SIMULATOR) 66 #else // !defined(USE_SIMULATOR)
62 // Running with a simulator. 67 // Running with a simulator.
63 68
64 #include "src/arm/constants-arm.h" 69 #include "src/arm/constants-arm.h"
65 #include "src/assembler.h" 70 #include "src/assembler.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 void InstructionDecode(Instruction* instr); 342 void InstructionDecode(Instruction* instr);
338 343
339 // ICache. 344 // ICache.
340 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); 345 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr);
341 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, 346 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start,
342 int size); 347 int size);
343 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page); 348 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page);
344 349
345 // Runtime call support. 350 // Runtime call support.
346 static void* RedirectExternalReference( 351 static void* RedirectExternalReference(
347 void* external_function, 352 Isolate* isolate, void* external_function,
348 v8::internal::ExternalReference::Type type); 353 v8::internal::ExternalReference::Type type);
349 354
350 // Handle arguments and return value for runtime FP functions. 355 // Handle arguments and return value for runtime FP functions.
351 void GetFpArgs(double* x, double* y, int32_t* z); 356 void GetFpArgs(double* x, double* y, int32_t* z);
352 void SetFpResult(const double& result); 357 void SetFpResult(const double& result);
353 void TrashCallerSaveRegisters(); 358 void TrashCallerSaveRegisters();
354 359
355 template<class ReturnType, int register_size> 360 template<class ReturnType, int register_size>
356 ReturnType GetFromVFPRegister(int reg_index); 361 ReturnType GetFromVFPRegister(int reg_index);
357 362
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 struct StopCountAndDesc { 424 struct StopCountAndDesc {
420 uint32_t count; 425 uint32_t count;
421 char* desc; 426 char* desc;
422 }; 427 };
423 StopCountAndDesc watched_stops_[kNumOfWatchedStops]; 428 StopCountAndDesc watched_stops_[kNumOfWatchedStops];
424 }; 429 };
425 430
426 431
427 // When running with the simulator transition into simulated execution at this 432 // When running with the simulator transition into simulated execution at this
428 // point. 433 // point.
429 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ 434 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
430 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \ 435 reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \
431 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) 436 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
432 437
433 #define CALL_GENERATED_FP_INT(entry, p0, p1) \ 438 #define CALL_GENERATED_FP_INT(isolate, entry, p0, p1) \
434 Simulator::current(Isolate::Current())->CallFPReturnsInt( \ 439 Simulator::current(isolate)->CallFPReturnsInt(FUNCTION_ADDR(entry), p0, p1)
435 FUNCTION_ADDR(entry), p0, p1)
436 440
437 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ 441 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
438 Simulator::current(Isolate::Current())->Call( \ 442 p7, p8) \
439 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8) 443 Simulator::current(isolate) \
444 ->Call(entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
440 445
441 446
442 // The simulator has its own stack. Thus it has a different stack limit from 447 // The simulator has its own stack. Thus it has a different stack limit from
443 // the C-based native code. The JS-based limit normally points near the end of 448 // the C-based native code. The JS-based limit normally points near the end of
444 // the simulator stack. When the C-based limit is exhausted we reflect that by 449 // the simulator stack. When the C-based limit is exhausted we reflect that by
445 // lowering the JS-based limit as well, to make stack checks trigger. 450 // lowering the JS-based limit as well, to make stack checks trigger.
446 class SimulatorStack : public v8::internal::AllStatic { 451 class SimulatorStack : public v8::internal::AllStatic {
447 public: 452 public:
448 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, 453 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate,
449 uintptr_t c_limit) { 454 uintptr_t c_limit) {
450 return Simulator::current(isolate)->StackLimit(c_limit); 455 return Simulator::current(isolate)->StackLimit(c_limit);
451 } 456 }
452 457
453 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { 458 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate,
454 Simulator* sim = Simulator::current(Isolate::Current()); 459 uintptr_t try_catch_address) {
460 Simulator* sim = Simulator::current(isolate);
455 return sim->PushAddress(try_catch_address); 461 return sim->PushAddress(try_catch_address);
456 } 462 }
457 463
458 static inline void UnregisterCTryCatch() { 464 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) {
459 Simulator::current(Isolate::Current())->PopAddress(); 465 Simulator::current(isolate)->PopAddress();
460 } 466 }
461 }; 467 };
462 468
463 } // namespace internal 469 } // namespace internal
464 } // namespace v8 470 } // namespace v8
465 471
466 #endif // !defined(USE_SIMULATOR) 472 #endif // !defined(USE_SIMULATOR)
467 #endif // V8_ARM_SIMULATOR_ARM_H_ 473 #endif // V8_ARM_SIMULATOR_ARM_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/simulator-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698