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

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

Issue 282783004: Reland of "v8::TryCatch now works correctly with ASAN's UseAfterReturn mode enabled." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remake Created 6 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | src/x64/simulator-x64.h » ('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
(...skipping 20 matching lines...) Expand all
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(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
38 (FUNCTION_CAST<mips_regexp_matcher>(entry)( \ 38 (FUNCTION_CAST<mips_regexp_matcher>(entry)( \
39 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)) 39 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8))
40 40
41 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
42 reinterpret_cast<TryCatch*>(try_catch_address)
43
44 // 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
45 // generated code. Because generated code on mips uses the C stack, we 42 // generated code. Because generated code on mips uses the C stack, we
46 // just use the C stack limit. 43 // just use the C stack limit.
47 class SimulatorStack : public v8::internal::AllStatic { 44 class SimulatorStack : public v8::internal::AllStatic {
48 public: 45 public:
49 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, 46 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
50 uintptr_t c_limit) { 47 uintptr_t c_limit) {
51 return c_limit; 48 return c_limit;
52 } 49 }
53 50
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // When running with the simulator transition into simulated execution at this 380 // When running with the simulator transition into simulated execution at this
384 // point. 381 // point.
385 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ 382 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
386 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \ 383 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \
387 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) 384 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
388 385
389 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ 386 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
390 Simulator::current(Isolate::Current())->Call( \ 387 Simulator::current(Isolate::Current())->Call( \
391 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8) 388 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
392 389
393 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
394 try_catch_address == NULL ? \
395 NULL : *(reinterpret_cast<TryCatch**>(try_catch_address))
396
397 390
398 // The simulator has its own stack. Thus it has a different stack limit from 391 // The simulator has its own stack. Thus it has a different stack limit from
399 // the C-based native code. Setting the c_limit to indicate a very small 392 // the C-based native code. Setting the c_limit to indicate a very small
400 // stack cause stack overflow errors, since the simulator ignores the input. 393 // stack cause stack overflow errors, since the simulator ignores the input.
401 // This is unlikely to be an issue in practice, though it might cause testing 394 // This is unlikely to be an issue in practice, though it might cause testing
402 // trouble down the line. 395 // trouble down the line.
403 class SimulatorStack : public v8::internal::AllStatic { 396 class SimulatorStack : public v8::internal::AllStatic {
404 public: 397 public:
405 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, 398 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
406 uintptr_t c_limit) { 399 uintptr_t c_limit) {
407 return Simulator::current(isolate)->StackLimit(); 400 return Simulator::current(isolate)->StackLimit();
408 } 401 }
409 402
410 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { 403 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
411 Simulator* sim = Simulator::current(Isolate::Current()); 404 Simulator* sim = Simulator::current(Isolate::Current());
412 return sim->PushAddress(try_catch_address); 405 return sim->PushAddress(try_catch_address);
413 } 406 }
414 407
415 static inline void UnregisterCTryCatch() { 408 static inline void UnregisterCTryCatch() {
416 Simulator::current(Isolate::Current())->PopAddress(); 409 Simulator::current(Isolate::Current())->PopAddress();
417 } 410 }
418 }; 411 };
419 412
420 } } // namespace v8::internal 413 } } // namespace v8::internal
421 414
422 #endif // !defined(USE_SIMULATOR) 415 #endif // !defined(USE_SIMULATOR)
423 #endif // V8_MIPS_SIMULATOR_MIPS_H_ 416 #endif // V8_MIPS_SIMULATOR_MIPS_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/x64/simulator-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698