Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index bd607e2f3712c03a7f071a884fd5c355684c4912..b5e9988306ae46ef92b4bea95efeef08ca9c0276 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -1144,9 +1144,11 @@ Object* Isolate::UnwindAndFindHandler() { |
| Address handler_sp = nullptr; |
| Address handler_fp = nullptr; |
| - // Special handling of termination exceptions, uncatchable by JavaScript code, |
| - // we unwind the handlers until the top ENTRY handler is found. |
| + // Special handling of termination exceptions, uncatchable by JavaScript and |
| + // Wasm code, we unwind the handlers until the top ENTRY handler is found. |
| bool catchable_by_js = is_catchable_by_javascript(exception); |
| + bool catchable_by_wasm = |
| + FLAG_wasm_eh_prototype && is_catchable_by_wasm(exception); |
| // Compute handler and stack unwinding information by performing a full walk |
| // over the stack and dispatching according to the frame type. |
| @@ -1167,6 +1169,26 @@ Object* Isolate::UnwindAndFindHandler() { |
| break; |
| } |
| + if (frame->is_wasm() && catchable_by_wasm) { |
|
titzer
2016/09/28 12:53:31
Maybe inline this condition? Since frame->is_wasm(
John
2016/09/28 13:37:18
I am cargo-culting on the catchable_by_js. I also
|
| + int stack_slots = 0; // Will contain stack slot count of frame. |
| + WasmFrame* wasm_frame = static_cast<WasmFrame*>(frame); |
| + offset = wasm_frame->LookupExceptionHandlerInTable(&stack_slots); |
| + if (offset >= 0) { |
| + // Compute the stack pointer from the frame pointer. This ensures that |
| + // argument slots on the stack are dropped as returning would. |
| + Address return_sp = frame->fp() + |
| + StandardFrameConstants::kFixedFrameSizeAboveFp - |
| + stack_slots * kPointerSize; |
| + |
| + // Gather information from the frame. |
| + code = frame->LookupCode(); |
| + |
| + handler_sp = return_sp; |
| + handler_fp = frame->fp(); |
| + break; |
| + } |
| + } |
| + |
| // For optimized frames we perform a lookup in the handler table. |
| if (frame->is_optimized() && catchable_by_js) { |
| OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); |