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

Side by Side Diff: src/isolate.cc

Issue 2203803002: [debug] Don't notify listener of exceptions internal to a desugaring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « src/isolate.h ('k') | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 } else { 1135 } else {
1136 Handle<Object> message_obj = CreateMessage(exception_handle, location); 1136 Handle<Object> message_obj = CreateMessage(exception_handle, location);
1137 thread_local_top()->pending_message_obj_ = *message_obj; 1137 thread_local_top()->pending_message_obj_ = *message_obj;
1138 1138
1139 // For any exception not caught by JavaScript, even when an external 1139 // For any exception not caught by JavaScript, even when an external
1140 // handler is present: 1140 // handler is present:
1141 // If the abort-on-uncaught-exception flag is specified, and if the 1141 // If the abort-on-uncaught-exception flag is specified, and if the
1142 // embedder didn't specify a custom uncaught exception callback, 1142 // embedder didn't specify a custom uncaught exception callback,
1143 // or if the custom callback determined that V8 should abort, then 1143 // or if the custom callback determined that V8 should abort, then
1144 // abort. 1144 // abort.
1145 CatchType prediction = PredictExceptionCatcher();
1145 if (FLAG_abort_on_uncaught_exception && 1146 if (FLAG_abort_on_uncaught_exception &&
1146 PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT && 1147 (prediction == NOT_CAUGHT || prediction == CAUGHT_BY_EXTERNAL) &&
1147 (!abort_on_uncaught_exception_callback_ || 1148 (!abort_on_uncaught_exception_callback_ ||
1148 abort_on_uncaught_exception_callback_( 1149 abort_on_uncaught_exception_callback_(
1149 reinterpret_cast<v8::Isolate*>(this)))) { 1150 reinterpret_cast<v8::Isolate*>(this)))) {
1150 // Prevent endless recursion. 1151 // Prevent endless recursion.
1151 FLAG_abort_on_uncaught_exception = false; 1152 FLAG_abort_on_uncaught_exception = false;
1152 // This flag is intended for use by JavaScript developers, so 1153 // This flag is intended for use by JavaScript developers, so
1153 // print a user-friendly stack trace (not an internal one). 1154 // print a user-friendly stack trace (not an internal one).
1154 PrintF(stderr, "%s\n\nFROM\n", 1155 PrintF(stderr, "%s\n\nFROM\n",
1155 MessageHandler::GetLocalizedMessage(this, message_obj).get()); 1156 MessageHandler::GetLocalizedMessage(this, message_obj).get());
1156 PrintCurrentStackTrace(stderr); 1157 PrintCurrentStackTrace(stderr);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 StackFrame* frame = iter.frame(); 1333 StackFrame* frame = iter.frame();
1333 1334
1334 // For JSEntryStub frames we update the JS_ENTRY handler. 1335 // For JSEntryStub frames we update the JS_ENTRY handler.
1335 if (frame->is_entry() || frame->is_entry_construct()) { 1336 if (frame->is_entry() || frame->is_entry_construct()) {
1336 entry_handler = frame->top_handler()->next()->address(); 1337 entry_handler = frame->top_handler()->next()->address();
1337 } 1338 }
1338 1339
1339 // For JavaScript frames we perform a lookup in the handler table. 1340 // For JavaScript frames we perform a lookup in the handler table.
1340 if (frame->is_java_script()) { 1341 if (frame->is_java_script()) {
1341 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); 1342 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame);
1342 if (PredictException(js_frame) != HandlerTable::UNCAUGHT) { 1343 HandlerTable::CatchPrediction prediction = PredictException(js_frame);
1343 return CAUGHT_BY_JAVASCRIPT; 1344 if (prediction == HandlerTable::DESUGARING) return CAUGHT_BY_DESUGARING;
1344 } 1345 if (prediction != HandlerTable::UNCAUGHT) return CAUGHT_BY_JAVASCRIPT;
1345 } 1346 }
1346 1347
1347 // The exception has been externally caught if and only if there is an 1348 // The exception has been externally caught if and only if there is an
1348 // external handler which is on top of the top-most JS_ENTRY handler. 1349 // external handler which is on top of the top-most JS_ENTRY handler.
1349 if (external_handler != nullptr && !try_catch_handler()->is_verbose_) { 1350 if (external_handler != nullptr && !try_catch_handler()->is_verbose_) {
1350 if (entry_handler == nullptr || entry_handler > external_handler) { 1351 if (entry_handler == nullptr || entry_handler > external_handler) {
1351 return CAUGHT_BY_EXTERNAL; 1352 return CAUGHT_BY_EXTERNAL;
1352 } 1353 }
1353 } 1354 }
1354 } 1355 }
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 tltop->promise_on_stack_ = prev; 1744 tltop->promise_on_stack_ = prev;
1744 global_handles()->Destroy(global_promise.location()); 1745 global_handles()->Destroy(global_promise.location());
1745 } 1746 }
1746 1747
1747 1748
1748 Handle<Object> Isolate::GetPromiseOnStackOnThrow() { 1749 Handle<Object> Isolate::GetPromiseOnStackOnThrow() {
1749 Handle<Object> undefined = factory()->undefined_value(); 1750 Handle<Object> undefined = factory()->undefined_value();
1750 ThreadLocalTop* tltop = thread_local_top(); 1751 ThreadLocalTop* tltop = thread_local_top();
1751 if (tltop->promise_on_stack_ == NULL) return undefined; 1752 if (tltop->promise_on_stack_ == NULL) return undefined;
1752 // Find the top-most try-catch or try-finally handler. 1753 // Find the top-most try-catch or try-finally handler.
1753 if (PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) return undefined; 1754 CatchType prediction = PredictExceptionCatcher();
1755 if (prediction == NOT_CAUGHT || prediction == CAUGHT_BY_EXTERNAL) {
1756 return undefined;
1757 }
1754 for (JavaScriptFrameIterator it(this); !it.done(); it.Advance()) { 1758 for (JavaScriptFrameIterator it(this); !it.done(); it.Advance()) {
1755 switch (PredictException(it.frame())) { 1759 switch (PredictException(it.frame())) {
1756 case HandlerTable::UNCAUGHT: 1760 case HandlerTable::UNCAUGHT:
1757 break; 1761 break;
1758 case HandlerTable::CAUGHT: 1762 case HandlerTable::CAUGHT:
1763 case HandlerTable::DESUGARING:
1759 return undefined; 1764 return undefined;
1760 case HandlerTable::PROMISE: 1765 case HandlerTable::PROMISE:
1761 return tltop->promise_on_stack_->promise(); 1766 return tltop->promise_on_stack_->promise();
1762 } 1767 }
1763 } 1768 }
1764 return undefined; 1769 return undefined;
1765 } 1770 }
1766 1771
1767 1772
1768 void Isolate::SetCaptureStackTraceForUncaughtExceptions( 1773 void Isolate::SetCaptureStackTraceForUncaughtExceptions(
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 // Then check whether this scope intercepts. 3204 // Then check whether this scope intercepts.
3200 if ((flag & intercept_mask_)) { 3205 if ((flag & intercept_mask_)) {
3201 intercepted_flags_ |= flag; 3206 intercepted_flags_ |= flag;
3202 return true; 3207 return true;
3203 } 3208 }
3204 return false; 3209 return false;
3205 } 3210 }
3206 3211
3207 } // namespace internal 3212 } // namespace internal
3208 } // namespace v8 3213 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698