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

Unified Diff: src/isolate.h

Issue 462413003: Move Promise tracking from debug to isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: move assertions Created 6 years, 4 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/debug.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 9ef6fc732a9f9f64c22fd4449ce28834a0107083..c0376aeac0bf4a7cf7922daae6603a67265d7f59 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -78,6 +78,7 @@ typedef void* ExternalReferenceRedirectorPointer();
class Debug;
class Debugger;
+class PromiseOnStack;
#if !defined(__arm__) && V8_TARGET_ARCH_ARM || \
!defined(__aarch64__) && V8_TARGET_ARCH_ARM64 || \
@@ -240,11 +241,7 @@ class ThreadLocalTop BASE_EMBEDDED {
v8::TryCatch::JSStackComparableAddress(try_catch_handler()));
}
- void Free() {
- DCHECK(!has_pending_message_);
- DCHECK(!external_caught_exception_);
- DCHECK(try_catch_handler_ == NULL);
- }
+ void Free();
Isolate* isolate_;
// The context where the current execution method is created and for variable
@@ -270,6 +267,11 @@ class ThreadLocalTop BASE_EMBEDDED {
Address c_entry_fp_; // the frame pointer of the top c entry frame
Address handler_; // try-blocks are chained through the stack
+ // Throwing an exception may cause a Promise rejection. For this purpose
+ // we keep track of a stack of nested promises and the corresponding
+ // try-catch handlers.
+ PromiseOnStack* promise_on_stack_;
+
#ifdef USE_SIMULATOR
Simulator* simulator_;
#endif
@@ -676,6 +678,11 @@ class Isolate {
// JavaScript code. If an exception is scheduled true is returned.
bool OptionalRescheduleException(bool is_bottom_call);
+ // Push and pop a promise and the current try-catch handler.
+ void PushPromise(Handle<JSObject> promise);
+ void PopPromise();
+ Handle<Object> GetPromiseOnStackOnThrow();
+
class ExceptionScope {
public:
explicit ExceptionScope(Isolate* isolate) :
@@ -1349,6 +1356,22 @@ class Isolate {
#undef THREAD_LOCAL_TOP_ACCESSOR
+class PromiseOnStack {
+ public:
+ PromiseOnStack(StackHandler* handler, Handle<JSObject> promise,
+ PromiseOnStack* prev)
+ : handler_(handler), promise_(promise), prev_(prev) {}
+ StackHandler* handler() { return handler_; }
+ Handle<JSObject> promise() { return promise_; }
+ PromiseOnStack* prev() { return prev_; }
+
+ private:
+ StackHandler* handler_;
+ Handle<JSObject> promise_;
+ PromiseOnStack* prev_;
+};
+
+
// If the GCC version is 4.1.x or 4.2.x an additional field is added to the
// class as a work around for a bug in the generated code found with these
// versions of GCC. See V8 issue 122 for details.
« no previous file with comments | « src/debug.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698