| 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.
|
|
|