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