OLD | NEW |
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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 StackFrame* frame = iter.frame(); | 1192 StackFrame* frame = iter.frame(); |
1193 | 1193 |
1194 // For JSEntryStub frames we update the JS_ENTRY handler. | 1194 // For JSEntryStub frames we update the JS_ENTRY handler. |
1195 if (frame->is_entry() || frame->is_entry_construct()) { | 1195 if (frame->is_entry() || frame->is_entry_construct()) { |
1196 entry_handler = frame->top_handler()->next()->address(); | 1196 entry_handler = frame->top_handler()->next()->address(); |
1197 } | 1197 } |
1198 | 1198 |
1199 // For JavaScript frames we perform a lookup in the handler table. | 1199 // For JavaScript frames we perform a lookup in the handler table. |
1200 if (frame->is_java_script()) { | 1200 if (frame->is_java_script()) { |
1201 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); | 1201 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); |
1202 int stack_slots = 0; // The computed stack slot count is not used. | |
1203 HandlerTable::CatchPrediction prediction; | 1202 HandlerTable::CatchPrediction prediction; |
1204 if (js_frame->LookupExceptionHandlerInTable(&stack_slots, &prediction) > | 1203 if (js_frame->LookupExceptionHandlerInTable(nullptr, &prediction) > 0) { |
1205 0) { | |
1206 // We are conservative with our prediction: try-finally is considered | 1204 // We are conservative with our prediction: try-finally is considered |
1207 // to always rethrow, to meet the expectation of the debugger. | 1205 // to always rethrow, to meet the expectation of the debugger. |
1208 if (prediction == HandlerTable::CAUGHT) return CAUGHT_BY_JAVASCRIPT; | 1206 if (prediction == HandlerTable::CAUGHT) return CAUGHT_BY_JAVASCRIPT; |
1209 } | 1207 } |
1210 } | 1208 } |
1211 | 1209 |
1212 // The exception has been externally caught if and only if there is an | 1210 // The exception has been externally caught if and only if there is an |
1213 // external handler which is on top of the top-most JS_ENTRY handler. | 1211 // external handler which is on top of the top-most JS_ENTRY handler. |
1214 if (external_handler != nullptr && !try_catch_handler()->is_verbose_) { | 1212 if (external_handler != nullptr && !try_catch_handler()->is_verbose_) { |
1215 if (entry_handler == nullptr || entry_handler > external_handler) { | 1213 if (entry_handler == nullptr || entry_handler > external_handler) { |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 | 1603 |
1606 Handle<Object> Isolate::GetPromiseOnStackOnThrow() { | 1604 Handle<Object> Isolate::GetPromiseOnStackOnThrow() { |
1607 Handle<Object> undefined = factory()->undefined_value(); | 1605 Handle<Object> undefined = factory()->undefined_value(); |
1608 ThreadLocalTop* tltop = thread_local_top(); | 1606 ThreadLocalTop* tltop = thread_local_top(); |
1609 if (tltop->promise_on_stack_ == NULL) return undefined; | 1607 if (tltop->promise_on_stack_ == NULL) return undefined; |
1610 Handle<JSFunction> promise_function = tltop->promise_on_stack_->function(); | 1608 Handle<JSFunction> promise_function = tltop->promise_on_stack_->function(); |
1611 // Find the top-most try-catch or try-finally handler. | 1609 // Find the top-most try-catch or try-finally handler. |
1612 if (PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) return undefined; | 1610 if (PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) return undefined; |
1613 for (JavaScriptFrameIterator it(this); !it.done(); it.Advance()) { | 1611 for (JavaScriptFrameIterator it(this); !it.done(); it.Advance()) { |
1614 JavaScriptFrame* frame = it.frame(); | 1612 JavaScriptFrame* frame = it.frame(); |
1615 int stack_slots = 0; // The computed stack slot count is not used. | 1613 if (frame->LookupExceptionHandlerInTable(nullptr, nullptr) > 0) { |
1616 if (frame->LookupExceptionHandlerInTable(&stack_slots, NULL) > 0) { | |
1617 // Throwing inside a Promise only leads to a reject if not caught by an | 1614 // Throwing inside a Promise only leads to a reject if not caught by an |
1618 // inner try-catch or try-finally. | 1615 // inner try-catch or try-finally. |
1619 if (frame->function() == *promise_function) { | 1616 if (frame->function() == *promise_function) { |
1620 return tltop->promise_on_stack_->promise(); | 1617 return tltop->promise_on_stack_->promise(); |
1621 } | 1618 } |
1622 return undefined; | 1619 return undefined; |
1623 } | 1620 } |
1624 } | 1621 } |
1625 return undefined; | 1622 return undefined; |
1626 } | 1623 } |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 // Then check whether this scope intercepts. | 2858 // Then check whether this scope intercepts. |
2862 if ((flag & intercept_mask_)) { | 2859 if ((flag & intercept_mask_)) { |
2863 intercepted_flags_ |= flag; | 2860 intercepted_flags_ |= flag; |
2864 return true; | 2861 return true; |
2865 } | 2862 } |
2866 return false; | 2863 return false; |
2867 } | 2864 } |
2868 | 2865 |
2869 } // namespace internal | 2866 } // namespace internal |
2870 } // namespace v8 | 2867 } // namespace v8 |
OLD | NEW |