| Index: src/top.h
|
| diff --git a/src/top.h b/src/top.h
|
| index 26ae542f59b72d0a6e01149dab757cafb4a53574..0dbc3094fa95f7bd29ff6c7b353ad90dc79d09a7 100644
|
| --- a/src/top.h
|
| +++ b/src/top.h
|
| @@ -195,22 +195,26 @@ class Top {
|
| ASSERT(has_pending_exception());
|
| return thread_local_.pending_exception_;
|
| }
|
| - static bool external_caught_exception() {
|
| - return thread_local_.external_caught_exception_;
|
| - }
|
| static void set_pending_exception(MaybeObject* exception) {
|
| thread_local_.pending_exception_ = exception;
|
| }
|
| static void clear_pending_exception() {
|
| thread_local_.pending_exception_ = Heap::the_hole_value();
|
| }
|
| -
|
| static MaybeObject** pending_exception_address() {
|
| return &thread_local_.pending_exception_;
|
| }
|
| static bool has_pending_exception() {
|
| return !thread_local_.pending_exception_->IsTheHole();
|
| }
|
| +
|
| + static bool external_caught_exception() {
|
| + return thread_local_.external_caught_exception_;
|
| + }
|
| + static void set_external_caught_exception(bool value) {
|
| + thread_local_.external_caught_exception_ = value;
|
| + }
|
| +
|
| static void clear_pending_message() {
|
| thread_local_.has_pending_message_ = false;
|
| thread_local_.pending_message_ = NULL;
|
| @@ -461,6 +465,18 @@ class Top {
|
| static const char* kStackOverflowMessage;
|
|
|
| private:
|
| +
|
| + static v8::TryCatch* catcher() {
|
| + return thread_local_.catcher_;
|
| + }
|
| +
|
| + static void set_catcher(v8::TryCatch* catcher) {
|
| + thread_local_.catcher_ = catcher;
|
| + }
|
| +
|
| + // Attempts to propagate the pending exception to the proper v8::TryCatch.
|
| + static void PropagatePendingExceptionToExternalTryCatch();
|
| +
|
| #ifdef ENABLE_VMSTATE_TRACKING
|
| // Set of states used when communicating with the runtime profiler.
|
| //
|
| @@ -525,6 +541,26 @@ class Top {
|
| friend class ThreadLocalTop;
|
|
|
| static void FillCache();
|
| +
|
| + public:
|
| + class ExceptionScope {
|
| + public:
|
| + ExceptionScope() :
|
| + // Scope currently can only be used for regular exceptions, not
|
| + // failures like OOM or termination exception.
|
| + pending_exception_(Top::pending_exception()->ToObjectUnchecked()),
|
| + catcher_(Top::catcher())
|
| + { }
|
| +
|
| + ~ExceptionScope() {
|
| + Top::set_catcher(catcher_);
|
| + Top::set_pending_exception(*pending_exception_);
|
| + }
|
| +
|
| + private:
|
| + Handle<Object> pending_exception_;
|
| + v8::TryCatch* catcher_;
|
| + };
|
| };
|
|
|
|
|
|
|