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 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 if (trap_handler::UseTrapHandler()) { | |
|
titzer
2017/03/01 16:48:47
Any harm in moving the if inside the SetThreadInWa
Eric Holk
2017/03/01 17:26:13
Nope, in fact it's already there. I'll remove it h
| |
| 1244 trap_handler::SetThreadInWasm(); | |
| 1245 } | |
| 1246 | |
| 1236 break; | 1247 break; |
| 1237 } | 1248 } |
| 1238 } | 1249 } |
| 1239 } | 1250 } |
| 1240 | 1251 |
| 1241 // For optimized frames we perform a lookup in the handler table. | 1252 // For optimized frames we perform a lookup in the handler table. |
| 1242 if (frame->is_optimized() && catchable_by_js) { | 1253 if (frame->is_optimized() && catchable_by_js) { |
| 1243 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); | 1254 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); |
| 1244 int stack_slots = 0; // Will contain stack slot count of frame. | 1255 int stack_slots = 0; // Will contain stack slot count of frame. |
| 1245 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); | 1256 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); |
| (...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3696 // Then check whether this scope intercepts. | 3707 // Then check whether this scope intercepts. |
| 3697 if ((flag & intercept_mask_)) { | 3708 if ((flag & intercept_mask_)) { |
| 3698 intercepted_flags_ |= flag; | 3709 intercepted_flags_ |= flag; |
| 3699 return true; | 3710 return true; |
| 3700 } | 3711 } |
| 3701 return false; | 3712 return false; |
| 3702 } | 3713 } |
| 3703 | 3714 |
| 3704 } // namespace internal | 3715 } // namespace internal |
| 3705 } // namespace v8 | 3716 } // namespace v8 |
| OLD | NEW |