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

Side by Side Diff: src/mips/simulator-mips.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/ia32/simulator-ia32.h ('k') | src/mips/simulator-mips.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 MIPS instructions if we are not generating a native 6 // Declares a Simulator for MIPS instructions if we are not generating a native
7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation 7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation
8 // on regular desktop machines. 8 // on 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 MIPS HW platform. 11 // on a MIPS HW platform.
12 12
13 #ifndef V8_MIPS_SIMULATOR_MIPS_H_ 13 #ifndef V8_MIPS_SIMULATOR_MIPS_H_
14 #define V8_MIPS_SIMULATOR_MIPS_H_ 14 #define V8_MIPS_SIMULATOR_MIPS_H_
15 15
16 #include "src/allocation.h" 16 #include "src/allocation.h"
17 #include "src/mips/constants-mips.h" 17 #include "src/mips/constants-mips.h"
18 18
19 #if !defined(USE_SIMULATOR) 19 #if !defined(USE_SIMULATOR)
20 // Running without a simulator on a native mips platform. 20 // Running without a simulator on a native mips platform.
21 21
22 namespace v8 { 22 namespace v8 {
23 namespace internal { 23 namespace internal {
24 24
25 // When running without a simulator we call the entry directly. 25 // When running without a simulator we call the entry directly.
26 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ 26 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
27 entry(p0, p1, p2, p3, p4) 27 entry(p0, p1, p2, p3, p4)
28 28
29 typedef int (*mips_regexp_matcher)(String*, int, const byte*, const byte*, 29 typedef int (*mips_regexp_matcher)(String*, int, const byte*, const byte*,
30 void*, int*, int, Address, int, Isolate*); 30 void*, int*, int, Address, int, Isolate*);
31 31
32 32
33 // Call the generated regexp code directly. The code at the entry address 33 // Call the generated regexp code directly. The code at the entry address
34 // should act as a function matching the type arm_regexp_matcher. 34 // should act as a function matching the type arm_regexp_matcher.
35 // The fifth argument is a dummy that reserves the space used for 35 // The fifth argument is a dummy that reserves the space used for
36 // the return address added by the ExitFrame in native calls. 36 // the return address added by the ExitFrame in native calls.
37 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ 37 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
38 (FUNCTION_CAST<mips_regexp_matcher>(entry)( \ 38 p7, p8) \
39 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)) 39 (FUNCTION_CAST<mips_regexp_matcher>(entry)(p0, p1, p2, p3, NULL, p4, p5, p6, \
40 p7, p8))
40 41
41 // The stack limit beyond which we will throw stack overflow errors in 42 // The stack limit beyond which we will throw stack overflow errors in
42 // generated code. Because generated code on mips uses the C stack, we 43 // generated code. Because generated code on mips uses the C stack, we
43 // just use the C stack limit. 44 // just use the C stack limit.
44 class SimulatorStack : public v8::internal::AllStatic { 45 class SimulatorStack : public v8::internal::AllStatic {
45 public: 46 public:
46 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, 47 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
47 uintptr_t c_limit) { 48 uintptr_t c_limit) {
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(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(Isolate* isolate) { USE(isolate); }
56 }; 59 };
57 60
58 } // namespace internal 61 } // namespace internal
59 } // namespace v8 62 } // namespace v8
60 63
61 // Calculated the stack limit beyond which we will throw stack overflow errors. 64 // Calculated the stack limit beyond which we will throw stack overflow errors.
62 // This macro must be called from a C++ method. It relies on being able to take 65 // This macro must be called from a C++ method. It relies on being able to take
63 // the address of "this" to get a value on the current execution stack and then 66 // the address of "this" to get a value on the current execution stack and then
64 // calculates the stack limit based on that value. 67 // calculates the stack limit based on that value.
65 // NOTE: The check for overflow is not safe as there is no guarantee that the 68 // NOTE: The check for overflow is not safe as there is no guarantee that the
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 kIntegerOverflow, 404 kIntegerOverflow,
402 kIntegerUnderflow, 405 kIntegerUnderflow,
403 kDivideByZero, 406 kDivideByZero,
404 kNumExceptions 407 kNumExceptions
405 }; 408 };
406 409
407 // Exceptions. 410 // Exceptions.
408 void SignalException(Exception e); 411 void SignalException(Exception e);
409 412
410 // Runtime call support. 413 // Runtime call support.
411 static void* RedirectExternalReference(void* external_function, 414 static void* RedirectExternalReference(Isolate* isolate,
415 void* external_function,
412 ExternalReference::Type type); 416 ExternalReference::Type type);
413 417
414 // Handle arguments and return value for runtime FP functions. 418 // Handle arguments and return value for runtime FP functions.
415 void GetFpArgs(double* x, double* y, int32_t* z); 419 void GetFpArgs(double* x, double* y, int32_t* z);
416 void SetFpResult(const double& result); 420 void SetFpResult(const double& result);
417 421
418 void CallInternal(byte* entry); 422 void CallInternal(byte* entry);
419 423
420 // Architecture state. 424 // Architecture state.
421 // Registers. 425 // Registers.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 struct StopCountAndDesc { 461 struct StopCountAndDesc {
458 uint32_t count; 462 uint32_t count;
459 char* desc; 463 char* desc;
460 }; 464 };
461 StopCountAndDesc watched_stops_[kMaxStopCode + 1]; 465 StopCountAndDesc watched_stops_[kMaxStopCode + 1];
462 }; 466 };
463 467
464 468
465 // When running with the simulator transition into simulated execution at this 469 // When running with the simulator transition into simulated execution at this
466 // point. 470 // point.
467 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ 471 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
468 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \ 472 reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \
469 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) 473 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
470 474
471 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ 475 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
472 Simulator::current(Isolate::Current())->Call( \ 476 p7, p8) \
473 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8) 477 Simulator::current(isolate) \
478 ->Call(entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
474 479
475 480
476 // The simulator has its own stack. Thus it has a different stack limit from 481 // The simulator has its own stack. Thus it has a different stack limit from
477 // the C-based native code. The JS-based limit normally points near the end of 482 // the C-based native code. The JS-based limit normally points near the end of
478 // the simulator stack. When the C-based limit is exhausted we reflect that by 483 // the simulator stack. When the C-based limit is exhausted we reflect that by
479 // lowering the JS-based limit as well, to make stack checks trigger. 484 // lowering the JS-based limit as well, to make stack checks trigger.
480 class SimulatorStack : public v8::internal::AllStatic { 485 class SimulatorStack : public v8::internal::AllStatic {
481 public: 486 public:
482 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, 487 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
483 uintptr_t c_limit) { 488 uintptr_t c_limit) {
484 return Simulator::current(isolate)->StackLimit(c_limit); 489 return Simulator::current(isolate)->StackLimit(c_limit);
485 } 490 }
486 491
487 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { 492 static inline uintptr_t RegisterCTryCatch(Isolate* isolate,
488 Simulator* sim = Simulator::current(Isolate::Current()); 493 uintptr_t try_catch_address) {
494 Simulator* sim = Simulator::current(isolate);
489 return sim->PushAddress(try_catch_address); 495 return sim->PushAddress(try_catch_address);
490 } 496 }
491 497
492 static inline void UnregisterCTryCatch() { 498 static inline void UnregisterCTryCatch(Isolate* isolate) {
493 Simulator::current(Isolate::Current())->PopAddress(); 499 Simulator::current(isolate)->PopAddress();
494 } 500 }
495 }; 501 };
496 502
497 } // namespace internal 503 } // namespace internal
498 } // namespace v8 504 } // namespace v8
499 505
500 #endif // !defined(USE_SIMULATOR) 506 #endif // !defined(USE_SIMULATOR)
501 #endif // V8_MIPS_SIMULATOR_MIPS_H_ 507 #endif // V8_MIPS_SIMULATOR_MIPS_H_
OLDNEW
« no previous file with comments | « src/ia32/simulator-ia32.h ('k') | src/mips/simulator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698