| 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 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 | 1195 |
| 1196 // Special handling of termination exceptions, uncatchable by JavaScript and | 1196 // Special handling of termination exceptions, uncatchable by JavaScript and |
| 1197 // Wasm code, we unwind the handlers until the top ENTRY handler is found. | 1197 // Wasm code, we unwind the handlers until the top ENTRY handler is found. |
| 1198 bool catchable_by_js = is_catchable_by_javascript(exception); | 1198 bool catchable_by_js = is_catchable_by_javascript(exception); |
| 1199 | 1199 |
| 1200 // Compute handler and stack unwinding information by performing a full walk | 1200 // Compute handler and stack unwinding information by performing a full walk |
| 1201 // over the stack and dispatching according to the frame type. | 1201 // over the stack and dispatching according to the frame type. |
| 1202 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { | 1202 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { |
| 1203 StackFrame* frame = iter.frame(); | 1203 StackFrame* frame = iter.frame(); |
| 1204 | 1204 |
| 1205 if (frame->is_wasm() && trap_handler::IsThreadInWasm()) { | |
| 1206 trap_handler::ClearThreadInWasm(); | |
| 1207 } | |
| 1208 | |
| 1209 // For JSEntryStub frames we always have a handler. | 1205 // For JSEntryStub frames we always have a handler. |
| 1210 if (frame->is_entry() || frame->is_entry_construct()) { | 1206 if (frame->is_entry() || frame->is_entry_construct()) { |
| 1211 StackHandler* handler = frame->top_handler(); | 1207 StackHandler* handler = frame->top_handler(); |
| 1212 | 1208 |
| 1213 // Restore the next handler. | 1209 // Restore the next handler. |
| 1214 thread_local_top()->handler_ = handler->next()->address(); | 1210 thread_local_top()->handler_ = handler->next()->address(); |
| 1215 | 1211 |
| 1216 // Gather information from the handler. | 1212 // Gather information from the handler. |
| 1217 code = frame->LookupCode(); | 1213 code = frame->LookupCode(); |
| 1218 handler_sp = handler->address() + StackHandlerConstants::kSize; | 1214 handler_sp = handler->address() + StackHandlerConstants::kSize; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1230 // argument slots on the stack are dropped as returning would. | 1226 // argument slots on the stack are dropped as returning would. |
| 1231 Address return_sp = frame->fp() + | 1227 Address return_sp = frame->fp() + |
| 1232 StandardFrameConstants::kFixedFrameSizeAboveFp - | 1228 StandardFrameConstants::kFixedFrameSizeAboveFp - |
| 1233 stack_slots * kPointerSize; | 1229 stack_slots * kPointerSize; |
| 1234 | 1230 |
| 1235 // Gather information from the frame. | 1231 // Gather information from the frame. |
| 1236 code = frame->LookupCode(); | 1232 code = frame->LookupCode(); |
| 1237 | 1233 |
| 1238 handler_sp = return_sp; | 1234 handler_sp = return_sp; |
| 1239 handler_fp = frame->fp(); | 1235 handler_fp = frame->fp(); |
| 1240 | |
| 1241 // This is going to be handled by Wasm, so we need to set the TLS flag | |
| 1242 // again. | |
| 1243 trap_handler::SetThreadInWasm(); | |
| 1244 | |
| 1245 break; | 1236 break; |
| 1246 } | 1237 } |
| 1247 } | 1238 } |
| 1248 } | 1239 } |
| 1249 | 1240 |
| 1250 // For optimized frames we perform a lookup in the handler table. | 1241 // For optimized frames we perform a lookup in the handler table. |
| 1251 if (frame->is_optimized() && catchable_by_js) { | 1242 if (frame->is_optimized() && catchable_by_js) { |
| 1252 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); | 1243 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); |
| 1253 int stack_slots = 0; // Will contain stack slot count of frame. | 1244 int stack_slots = 0; // Will contain stack slot count of frame. |
| 1254 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); | 1245 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); |
| (...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3707 // Then check whether this scope intercepts. | 3698 // Then check whether this scope intercepts. |
| 3708 if ((flag & intercept_mask_)) { | 3699 if ((flag & intercept_mask_)) { |
| 3709 intercepted_flags_ |= flag; | 3700 intercepted_flags_ |= flag; |
| 3710 return true; | 3701 return true; |
| 3711 } | 3702 } |
| 3712 return false; | 3703 return false; |
| 3713 } | 3704 } |
| 3714 | 3705 |
| 3715 } // namespace internal | 3706 } // namespace internal |
| 3716 } // namespace v8 | 3707 } // namespace v8 |
| OLD | NEW |