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

Side by Side Diff: src/ppc/simulator-ppc.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/mips64/simulator-mips64.cc ('k') | src/ppc/simulator-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 PPC instructions if we are not generating a native 6 // Declares a Simulator for PPC instructions if we are not generating a native
7 // PPC binary. This Simulator allows us to run and debug PPC code generation on 7 // PPC binary. This Simulator allows us to run and debug PPC 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 PPC HW platform. 11 // on a PPC HW platform.
12 12
13 #ifndef V8_PPC_SIMULATOR_PPC_H_ 13 #ifndef V8_PPC_SIMULATOR_PPC_H_
14 #define V8_PPC_SIMULATOR_PPC_H_ 14 #define V8_PPC_SIMULATOR_PPC_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 ppc platform. 19 // Running without a simulator on a native ppc 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 (*ppc_regexp_matcher)(String*, int, const byte*, const byte*, int*, 28 typedef int (*ppc_regexp_matcher)(String*, int, const byte*, const byte*, int*,
29 int, Address, int, void*, Isolate*); 29 int, Address, int, void*, 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 ppc_regexp_matcher. 33 // should act as a function matching the type ppc_regexp_matcher.
34 // The ninth argument is a dummy that reserves the space used for 34 // The ninth 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<ppc_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ 37 p7, p8) \
38 (FUNCTION_CAST<ppc_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \
38 NULL, p8)) 39 NULL, 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 ppc uses the C stack, we 42 // generated code. Because generated code on ppc 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 } // namespace internal 62 } // namespace internal
58 } // namespace v8 63 } // namespace v8
59 64
60 #else // !defined(USE_SIMULATOR) 65 #else // !defined(USE_SIMULATOR)
61 // Running with a simulator. 66 // Running with a simulator.
62 67
63 #include "src/assembler.h" 68 #include "src/assembler.h"
64 #include "src/hashmap.h" 69 #include "src/hashmap.h"
65 #include "src/ppc/constants-ppc.h" 70 #include "src/ppc/constants-ppc.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 void ExecuteInstruction(Instruction* instr); 327 void ExecuteInstruction(Instruction* instr);
323 328
324 // ICache. 329 // ICache.
325 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); 330 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr);
326 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, 331 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start,
327 int size); 332 int size);
328 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page); 333 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page);
329 334
330 // Runtime call support. 335 // Runtime call support.
331 static void* RedirectExternalReference( 336 static void* RedirectExternalReference(
332 void* external_function, v8::internal::ExternalReference::Type type); 337 Isolate* isolate, void* external_function,
338 v8::internal::ExternalReference::Type type);
333 339
334 // Handle arguments and return value for runtime FP functions. 340 // Handle arguments and return value for runtime FP functions.
335 void GetFpArgs(double* x, double* y, intptr_t* z); 341 void GetFpArgs(double* x, double* y, intptr_t* z);
336 void SetFpResult(const double& result); 342 void SetFpResult(const double& result);
337 void TrashCallerSaveRegisters(); 343 void TrashCallerSaveRegisters();
338 344
339 void CallInternal(byte* entry); 345 void CallInternal(byte* entry);
340 346
341 // Architecture state. 347 // Architecture state.
342 // Saturating instructions require a Q flag to indicate saturation. 348 // Saturating instructions require a Q flag to indicate saturation.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 struct StopCountAndDesc { 390 struct StopCountAndDesc {
385 uint32_t count; 391 uint32_t count;
386 char* desc; 392 char* desc;
387 }; 393 };
388 StopCountAndDesc watched_stops_[kNumOfWatchedStops]; 394 StopCountAndDesc watched_stops_[kNumOfWatchedStops];
389 }; 395 };
390 396
391 397
392 // When running with the simulator transition into simulated execution at this 398 // When running with the simulator transition into simulated execution at this
393 // point. 399 // point.
394 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ 400 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
395 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \ 401 reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \
396 FUNCTION_ADDR(entry), 5, (intptr_t)p0, (intptr_t)p1, (intptr_t)p2, \ 402 FUNCTION_ADDR(entry), 5, (intptr_t)p0, (intptr_t)p1, (intptr_t)p2, \
397 (intptr_t)p3, (intptr_t)p4)) 403 (intptr_t)p3, (intptr_t)p4))
398 404
399 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ 405 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
400 Simulator::current(Isolate::Current()) \ 406 p7, p8) \
401 ->Call(entry, 10, (intptr_t)p0, (intptr_t)p1, (intptr_t)p2, \ 407 Simulator::current(isolate)->Call(entry, 10, (intptr_t)p0, (intptr_t)p1, \
402 (intptr_t)p3, (intptr_t)p4, (intptr_t)p5, (intptr_t)p6, \ 408 (intptr_t)p2, (intptr_t)p3, (intptr_t)p4, \
403 (intptr_t)p7, (intptr_t)NULL, (intptr_t)p8) 409 (intptr_t)p5, (intptr_t)p6, (intptr_t)p7, \
410 (intptr_t)NULL, (intptr_t)p8)
404 411
405 412
406 // The simulator has its own stack. Thus it has a different stack limit from 413 // The simulator has its own stack. Thus it has a different stack limit from
407 // the C-based native code. The JS-based limit normally points near the end of 414 // the C-based native code. The JS-based limit normally points near the end of
408 // the simulator stack. When the C-based limit is exhausted we reflect that by 415 // the simulator stack. When the C-based limit is exhausted we reflect that by
409 // lowering the JS-based limit as well, to make stack checks trigger. 416 // lowering the JS-based limit as well, to make stack checks trigger.
410 class SimulatorStack : public v8::internal::AllStatic { 417 class SimulatorStack : public v8::internal::AllStatic {
411 public: 418 public:
412 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, 419 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate,
413 uintptr_t c_limit) { 420 uintptr_t c_limit) {
414 return Simulator::current(isolate)->StackLimit(c_limit); 421 return Simulator::current(isolate)->StackLimit(c_limit);
415 } 422 }
416 423
417 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { 424 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate,
418 Simulator* sim = Simulator::current(Isolate::Current()); 425 uintptr_t try_catch_address) {
426 Simulator* sim = Simulator::current(isolate);
419 return sim->PushAddress(try_catch_address); 427 return sim->PushAddress(try_catch_address);
420 } 428 }
421 429
422 static inline void UnregisterCTryCatch() { 430 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) {
423 Simulator::current(Isolate::Current())->PopAddress(); 431 Simulator::current(isolate)->PopAddress();
424 } 432 }
425 }; 433 };
426 } // namespace internal 434 } // namespace internal
427 } // namespace v8 435 } // namespace v8
428 436
429 #endif // !defined(USE_SIMULATOR) 437 #endif // !defined(USE_SIMULATOR)
430 #endif // V8_PPC_SIMULATOR_PPC_H_ 438 #endif // V8_PPC_SIMULATOR_PPC_H_
OLDNEW
« no previous file with comments | « src/mips64/simulator-mips64.cc ('k') | src/ppc/simulator-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698