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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 | 1200 |
1201 // Special handling of termination exceptions, uncatchable by JavaScript and | 1201 // Special handling of termination exceptions, uncatchable by JavaScript and |
1202 // Wasm code, we unwind the handlers until the top ENTRY handler is found. | 1202 // Wasm code, we unwind the handlers until the top ENTRY handler is found. |
1203 bool catchable_by_js = is_catchable_by_javascript(exception); | 1203 bool catchable_by_js = is_catchable_by_javascript(exception); |
1204 | 1204 |
1205 // Compute handler and stack unwinding information by performing a full walk | 1205 // Compute handler and stack unwinding information by performing a full walk |
1206 // over the stack and dispatching according to the frame type. | 1206 // over the stack and dispatching according to the frame type. |
1207 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { | 1207 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { |
1208 StackFrame* frame = iter.frame(); | 1208 StackFrame* frame = iter.frame(); |
1209 | 1209 |
| 1210 if (frame->is_wasm()) { |
| 1211 trap_handler::ClearThreadInWasm(); |
| 1212 } |
| 1213 |
1210 // For JSEntryStub frames we always have a handler. | 1214 // For JSEntryStub frames we always have a handler. |
1211 if (frame->is_entry() || frame->is_entry_construct()) { | 1215 if (frame->is_entry() || frame->is_entry_construct()) { |
1212 StackHandler* handler = frame->top_handler(); | 1216 StackHandler* handler = frame->top_handler(); |
1213 | 1217 |
1214 // Restore the next handler. | 1218 // Restore the next handler. |
1215 thread_local_top()->handler_ = handler->next()->address(); | 1219 thread_local_top()->handler_ = handler->next()->address(); |
1216 | 1220 |
1217 // Gather information from the handler. | 1221 // Gather information from the handler. |
1218 code = frame->LookupCode(); | 1222 code = frame->LookupCode(); |
1219 handler_sp = handler->address() + StackHandlerConstants::kSize; | 1223 handler_sp = handler->address() + StackHandlerConstants::kSize; |
(...skipping 11 matching lines...) Expand all Loading... |
1231 // argument slots on the stack are dropped as returning would. | 1235 // argument slots on the stack are dropped as returning would. |
1232 Address return_sp = frame->fp() + | 1236 Address return_sp = frame->fp() + |
1233 StandardFrameConstants::kFixedFrameSizeAboveFp - | 1237 StandardFrameConstants::kFixedFrameSizeAboveFp - |
1234 stack_slots * kPointerSize; | 1238 stack_slots * kPointerSize; |
1235 | 1239 |
1236 // Gather information from the frame. | 1240 // Gather information from the frame. |
1237 code = frame->LookupCode(); | 1241 code = frame->LookupCode(); |
1238 | 1242 |
1239 handler_sp = return_sp; | 1243 handler_sp = return_sp; |
1240 handler_fp = frame->fp(); | 1244 handler_fp = frame->fp(); |
| 1245 |
| 1246 // This is going to be handled by Wasm, so we need to set the TLS flag |
| 1247 // again. |
| 1248 if (trap_handler::EnableTrapHandler()) { |
| 1249 trap_handler::SetThreadInWasm(); |
| 1250 } |
| 1251 |
1241 break; | 1252 break; |
1242 } | 1253 } |
1243 } | 1254 } |
1244 } | 1255 } |
1245 | 1256 |
1246 // For optimized frames we perform a lookup in the handler table. | 1257 // For optimized frames we perform a lookup in the handler table. |
1247 if (frame->is_optimized() && catchable_by_js) { | 1258 if (frame->is_optimized() && catchable_by_js) { |
1248 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); | 1259 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); |
1249 int stack_slots = 0; // Will contain stack slot count of frame. | 1260 int stack_slots = 0; // Will contain stack slot count of frame. |
1250 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); | 1261 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); |
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3663 // Then check whether this scope intercepts. | 3674 // Then check whether this scope intercepts. |
3664 if ((flag & intercept_mask_)) { | 3675 if ((flag & intercept_mask_)) { |
3665 intercepted_flags_ |= flag; | 3676 intercepted_flags_ |= flag; |
3666 return true; | 3677 return true; |
3667 } | 3678 } |
3668 return false; | 3679 return false; |
3669 } | 3680 } |
3670 | 3681 |
3671 } // namespace internal | 3682 } // namespace internal |
3672 } // namespace v8 | 3683 } // namespace v8 |
OLD | NEW |