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

Unified Diff: src/isolate.h

Issue 960273002: Move stack unwinding logic into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Win64 (finally). Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 620f319eab6289831ce1eaa32fdbc2f0ee432642..3ddc82278c9a4e23c070be70b3b7ee8f75582b7c 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -168,6 +168,11 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
C(CFunction, c_function) \
C(Context, context) \
C(PendingException, pending_exception) \
+ C(PendingHandlerContext, pending_handler_context) \
+ C(PendingHandlerCode, pending_handler_code) \
+ C(PendingHandlerOffset, pending_handler_offset) \
+ C(PendingHandlerFP, pending_handler_fp) \
+ C(PendingHandlerSP, pending_handler_sp) \
C(ExternalCaughtException, external_caught_exception) \
C(JSEntrySP, js_entry_sp)
@@ -268,12 +273,22 @@ class ThreadLocalTop BASE_EMBEDDED {
Context* context_;
ThreadId thread_id_;
Object* pending_exception_;
+
+ // Communication channel between Isolate::FindHandler and the CEntryStub.
+ Context* pending_handler_context_;
+ Code* pending_handler_code_;
+ intptr_t pending_handler_offset_;
+ Address pending_handler_fp_;
+ Address pending_handler_sp_;
+
+ // Communication channel between Isolate::Throw and message consumers.
bool has_pending_message_;
bool rethrowing_message_;
Object* pending_message_obj_;
Object* pending_message_script_;
int pending_message_start_pos_;
int pending_message_end_pos_;
+
// Use a separate value for scheduled exceptions to preserve the
// invariants that hold about pending_exception. We may want to
// unify them later.
@@ -284,7 +299,7 @@ class ThreadLocalTop BASE_EMBEDDED {
// Stack.
Address c_entry_fp_; // the frame pointer of the top c entry frame
- Address handler_; // try-blocks are chained through the stack
+ Address handler_; // try-blocks are chained through the stack
Address c_function_; // C function that was called at c entry.
// Throwing an exception may cause a Promise rejection. For this purpose
@@ -388,6 +403,9 @@ typedef List<HeapObject*> DebugObjectCache;
inline void set_##name(type v) { thread_local_top_.name##_ = v; } \
inline type name() const { return thread_local_top_.name##_; }
+#define THREAD_LOCAL_TOP_ADDRESS(type, name) \
+ type* name##_address() { return &thread_local_top_.name##_; }
+
class Isolate {
// These forward declarations are required to make the friend declarations in
@@ -574,15 +592,19 @@ class Isolate {
thread_local_top_.pending_exception_ = heap_.the_hole_value();
}
- Object** pending_exception_address() {
- return &thread_local_top_.pending_exception_;
- }
+ THREAD_LOCAL_TOP_ADDRESS(Object*, pending_exception)
bool has_pending_exception() {
DCHECK(!thread_local_top_.pending_exception_->IsException());
return !thread_local_top_.pending_exception_->IsTheHole();
}
+ THREAD_LOCAL_TOP_ADDRESS(Context*, pending_handler_context)
+ THREAD_LOCAL_TOP_ADDRESS(Code*, pending_handler_code)
+ THREAD_LOCAL_TOP_ADDRESS(intptr_t, pending_handler_offset)
+ THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_fp)
+ THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_sp)
+
THREAD_LOCAL_TOP_ACCESSOR(bool, external_caught_exception)
void clear_pending_message() {
@@ -602,9 +624,7 @@ class Isolate {
THREAD_LOCAL_TOP_ACCESSOR(v8::TryCatch*, catcher)
- Object** scheduled_exception_address() {
- return &thread_local_top_.scheduled_exception_;
- }
+ THREAD_LOCAL_TOP_ADDRESS(Object*, scheduled_exception)
Address pending_message_obj_address() {
return reinterpret_cast<Address>(&thread_local_top_.pending_message_obj_);
@@ -767,6 +787,11 @@ class Isolate {
// error reporting was handled when the exception was thrown
// originally.
Object* ReThrow(Object* exception);
+
+ // Find the correct handler for the current pending exception. This also
+ // clears and returns the current pending exception.
+ Object* FindHandler();
+
void ScheduleThrow(Object* exception);
// Re-set pending message, script and positions reported to the TryCatch
// back to the TLS for re-use when rethrowing.
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698