| 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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 // For JSEntryStub frames we update the JS_ENTRY handler. | 1304 // For JSEntryStub frames we update the JS_ENTRY handler. |
| 1305 if (frame->is_entry() || frame->is_entry_construct()) { | 1305 if (frame->is_entry() || frame->is_entry_construct()) { |
| 1306 entry_handler = frame->top_handler()->next()->address(); | 1306 entry_handler = frame->top_handler()->next()->address(); |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 // For JavaScript frames we perform a lookup in the handler table. | 1309 // For JavaScript frames we perform a lookup in the handler table. |
| 1310 if (frame->is_java_script()) { | 1310 if (frame->is_java_script()) { |
| 1311 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); | 1311 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); |
| 1312 HandlerTable::CatchPrediction prediction = PredictException(js_frame); | 1312 HandlerTable::CatchPrediction prediction = PredictException(js_frame); |
| 1313 if (prediction == HandlerTable::DESUGARING) return CAUGHT_BY_DESUGARING; | 1313 if (prediction == HandlerTable::DESUGARING) return CAUGHT_BY_DESUGARING; |
| 1314 if (prediction == HandlerTable::ASYNC_AWAIT) return CAUGHT_BY_ASYNC_AWAIT; |
| 1315 if (prediction == HandlerTable::PROMISE) return CAUGHT_BY_PROMISE; |
| 1314 if (prediction != HandlerTable::UNCAUGHT) return CAUGHT_BY_JAVASCRIPT; | 1316 if (prediction != HandlerTable::UNCAUGHT) return CAUGHT_BY_JAVASCRIPT; |
| 1315 } | 1317 } |
| 1316 | 1318 |
| 1317 // The exception has been externally caught if and only if there is an | 1319 // The exception has been externally caught if and only if there is an |
| 1318 // external handler which is on top of the top-most JS_ENTRY handler. | 1320 // external handler which is on top of the top-most JS_ENTRY handler. |
| 1319 if (external_handler != nullptr && !try_catch_handler()->is_verbose_) { | 1321 if (external_handler != nullptr && !try_catch_handler()->is_verbose_) { |
| 1320 if (entry_handler == nullptr || entry_handler > external_handler) { | 1322 if (entry_handler == nullptr || entry_handler > external_handler) { |
| 1321 return CAUGHT_BY_EXTERNAL; | 1323 return CAUGHT_BY_EXTERNAL; |
| 1322 } | 1324 } |
| 1323 } | 1325 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 ThreadLocalTop* tltop = thread_local_top(); | 1709 ThreadLocalTop* tltop = thread_local_top(); |
| 1708 if (tltop->promise_on_stack_ == NULL) return undefined; | 1710 if (tltop->promise_on_stack_ == NULL) return undefined; |
| 1709 // Find the top-most try-catch or try-finally handler. | 1711 // Find the top-most try-catch or try-finally handler. |
| 1710 CatchType prediction = PredictExceptionCatcher(); | 1712 CatchType prediction = PredictExceptionCatcher(); |
| 1711 if (prediction == NOT_CAUGHT || prediction == CAUGHT_BY_EXTERNAL) { | 1713 if (prediction == NOT_CAUGHT || prediction == CAUGHT_BY_EXTERNAL) { |
| 1712 return undefined; | 1714 return undefined; |
| 1713 } | 1715 } |
| 1714 for (JavaScriptFrameIterator it(this); !it.done(); it.Advance()) { | 1716 for (JavaScriptFrameIterator it(this); !it.done(); it.Advance()) { |
| 1715 switch (PredictException(it.frame())) { | 1717 switch (PredictException(it.frame())) { |
| 1716 case HandlerTable::UNCAUGHT: | 1718 case HandlerTable::UNCAUGHT: |
| 1719 case HandlerTable::ASYNC_AWAIT: |
| 1717 break; | 1720 break; |
| 1718 case HandlerTable::CAUGHT: | 1721 case HandlerTable::CAUGHT: |
| 1719 case HandlerTable::DESUGARING: | 1722 case HandlerTable::DESUGARING: |
| 1720 return undefined; | 1723 return undefined; |
| 1721 case HandlerTable::PROMISE: | 1724 case HandlerTable::PROMISE: |
| 1722 return tltop->promise_on_stack_->promise(); | 1725 return tltop->promise_on_stack_->promise(); |
| 1723 } | 1726 } |
| 1724 } | 1727 } |
| 1725 return undefined; | 1728 return undefined; |
| 1726 } | 1729 } |
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3163 // Then check whether this scope intercepts. | 3166 // Then check whether this scope intercepts. |
| 3164 if ((flag & intercept_mask_)) { | 3167 if ((flag & intercept_mask_)) { |
| 3165 intercepted_flags_ |= flag; | 3168 intercepted_flags_ |= flag; |
| 3166 return true; | 3169 return true; |
| 3167 } | 3170 } |
| 3168 return false; | 3171 return false; |
| 3169 } | 3172 } |
| 3170 | 3173 |
| 3171 } // namespace internal | 3174 } // namespace internal |
| 3172 } // namespace v8 | 3175 } // namespace v8 |
| OLD | NEW |