Chromium Code Reviews| 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1194 | 1194 |
| 1195 // Special handling of termination exceptions, uncatchable by JavaScript and | 1195 // Special handling of termination exceptions, uncatchable by JavaScript and |
| 1196 // Wasm code, we unwind the handlers until the top ENTRY handler is found. | 1196 // Wasm code, we unwind the handlers until the top ENTRY handler is found. |
| 1197 bool catchable_by_js = is_catchable_by_javascript(exception); | 1197 bool catchable_by_js = is_catchable_by_javascript(exception); |
| 1198 | 1198 |
| 1199 // Compute handler and stack unwinding information by performing a full walk | 1199 // Compute handler and stack unwinding information by performing a full walk |
| 1200 // over the stack and dispatching according to the frame type. | 1200 // over the stack and dispatching according to the frame type. |
| 1201 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { | 1201 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { |
| 1202 StackFrame* frame = iter.frame(); | 1202 StackFrame* frame = iter.frame(); |
| 1203 | 1203 |
| 1204 if (frame->is_wasm()) { | |
| 1205 trap_handler::ClearThreadInWasm(); | |
|
Mark Seaborn
2017/02/17 21:41:12
The other calls are guarded by "if (trap_handler::
ahaas
2017/02/20 09:27:24
Is it intentional that ClearThreadInWasm is called
titzer
2017/02/20 09:50:08
+1 and make the method inline
Eric Holk
2017/02/23 02:16:55
Originally, it didn't really matter either way sin
Eric Holk
2017/02/23 02:16:55
Done.
Eric Holk
2017/02/23 02:16:56
Done.
| |
| 1206 } | |
| 1207 | |
| 1204 // For JSEntryStub frames we always have a handler. | 1208 // For JSEntryStub frames we always have a handler. |
| 1205 if (frame->is_entry() || frame->is_entry_construct()) { | 1209 if (frame->is_entry() || frame->is_entry_construct()) { |
| 1206 StackHandler* handler = frame->top_handler(); | 1210 StackHandler* handler = frame->top_handler(); |
| 1207 | 1211 |
| 1208 // Restore the next handler. | 1212 // Restore the next handler. |
| 1209 thread_local_top()->handler_ = handler->next()->address(); | 1213 thread_local_top()->handler_ = handler->next()->address(); |
| 1210 | 1214 |
| 1211 // Gather information from the handler. | 1215 // Gather information from the handler. |
| 1212 code = frame->LookupCode(); | 1216 code = frame->LookupCode(); |
| 1213 handler_sp = handler->address() + StackHandlerConstants::kSize; | 1217 handler_sp = handler->address() + StackHandlerConstants::kSize; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1225 // argument slots on the stack are dropped as returning would. | 1229 // argument slots on the stack are dropped as returning would. |
| 1226 Address return_sp = frame->fp() + | 1230 Address return_sp = frame->fp() + |
| 1227 StandardFrameConstants::kFixedFrameSizeAboveFp - | 1231 StandardFrameConstants::kFixedFrameSizeAboveFp - |
| 1228 stack_slots * kPointerSize; | 1232 stack_slots * kPointerSize; |
| 1229 | 1233 |
| 1230 // Gather information from the frame. | 1234 // Gather information from the frame. |
| 1231 code = frame->LookupCode(); | 1235 code = frame->LookupCode(); |
| 1232 | 1236 |
| 1233 handler_sp = return_sp; | 1237 handler_sp = return_sp; |
| 1234 handler_fp = frame->fp(); | 1238 handler_fp = frame->fp(); |
| 1239 | |
| 1240 // This is going to be handled by Wasm, so we need to set the TLS flag | |
| 1241 // again. | |
| 1242 if (trap_handler::ShouldEnableTrapHandler()) { | |
| 1243 trap_handler::SetThreadInWasm(); | |
| 1244 } | |
| 1245 | |
| 1235 break; | 1246 break; |
| 1236 } | 1247 } |
| 1237 } | 1248 } |
| 1238 } | 1249 } |
| 1239 | 1250 |
| 1240 // For optimized frames we perform a lookup in the handler table. | 1251 // For optimized frames we perform a lookup in the handler table. |
| 1241 if (frame->is_optimized() && catchable_by_js) { | 1252 if (frame->is_optimized() && catchable_by_js) { |
| 1242 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); | 1253 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); |
| 1243 int stack_slots = 0; // Will contain stack slot count of frame. | 1254 int stack_slots = 0; // Will contain stack slot count of frame. |
| 1244 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); | 1255 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); |
| (...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3653 // Then check whether this scope intercepts. | 3664 // Then check whether this scope intercepts. |
| 3654 if ((flag & intercept_mask_)) { | 3665 if ((flag & intercept_mask_)) { |
| 3655 intercepted_flags_ |= flag; | 3666 intercepted_flags_ |= flag; |
| 3656 return true; | 3667 return true; |
| 3657 } | 3668 } |
| 3658 return false; | 3669 return false; |
| 3659 } | 3670 } |
| 3660 | 3671 |
| 3661 } // namespace internal | 3672 } // namespace internal |
| 3662 } // namespace v8 | 3673 } // namespace v8 |
| OLD | NEW |