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 |
1205 // For JSEntryStub frames we always have a handler. | 1209 // For JSEntryStub frames we always have a handler. |
1206 if (frame->is_entry() || frame->is_entry_construct()) { | 1210 if (frame->is_entry() || frame->is_entry_construct()) { |
1207 StackHandler* handler = frame->top_handler(); | 1211 StackHandler* handler = frame->top_handler(); |
1208 | 1212 |
1209 // Restore the next handler. | 1213 // Restore the next handler. |
1210 thread_local_top()->handler_ = handler->next()->address(); | 1214 thread_local_top()->handler_ = handler->next()->address(); |
1211 | 1215 |
1212 // Gather information from the handler. | 1216 // Gather information from the handler. |
1213 code = frame->LookupCode(); | 1217 code = frame->LookupCode(); |
1214 handler_sp = handler->address() + StackHandlerConstants::kSize; | 1218 handler_sp = handler->address() + StackHandlerConstants::kSize; |
(...skipping 11 matching lines...) Expand all Loading... |
1226 // argument slots on the stack are dropped as returning would. | 1230 // argument slots on the stack are dropped as returning would. |
1227 Address return_sp = frame->fp() + | 1231 Address return_sp = frame->fp() + |
1228 StandardFrameConstants::kFixedFrameSizeAboveFp - | 1232 StandardFrameConstants::kFixedFrameSizeAboveFp - |
1229 stack_slots * kPointerSize; | 1233 stack_slots * kPointerSize; |
1230 | 1234 |
1231 // Gather information from the frame. | 1235 // Gather information from the frame. |
1232 code = frame->LookupCode(); | 1236 code = frame->LookupCode(); |
1233 | 1237 |
1234 handler_sp = return_sp; | 1238 handler_sp = return_sp; |
1235 handler_fp = frame->fp(); | 1239 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 |
1236 break; | 1245 break; |
1237 } | 1246 } |
1238 } | 1247 } |
1239 } | 1248 } |
1240 | 1249 |
1241 // For optimized frames we perform a lookup in the handler table. | 1250 // For optimized frames we perform a lookup in the handler table. |
1242 if (frame->is_optimized() && catchable_by_js) { | 1251 if (frame->is_optimized() && catchable_by_js) { |
1243 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); | 1252 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); |
1244 int stack_slots = 0; // Will contain stack slot count of frame. | 1253 int stack_slots = 0; // Will contain stack slot count of frame. |
1245 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); | 1254 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); |
(...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3698 // Then check whether this scope intercepts. | 3707 // Then check whether this scope intercepts. |
3699 if ((flag & intercept_mask_)) { | 3708 if ((flag & intercept_mask_)) { |
3700 intercepted_flags_ |= flag; | 3709 intercepted_flags_ |= flag; |
3701 return true; | 3710 return true; |
3702 } | 3711 } |
3703 return false; | 3712 return false; |
3704 } | 3713 } |
3705 | 3714 |
3706 } // namespace internal | 3715 } // namespace internal |
3707 } // namespace v8 | 3716 } // namespace v8 |
OLD | NEW |