Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Unified Diff: src/isolate.cc

Issue 2275293002: [WASM] Implements catch for the wasm low level exception mechanism. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Git pull Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.h ('k') | src/isolate-inl.h » ('j') | src/runtime/runtime-wasm.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 9a21e236cff78bb6608250837e72e8ca49afbd24..73746fb269cb38c2d74840c2b2ee4b649114c39b 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1145,9 +1145,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.
@@ -1168,6 +1170,26 @@ Object* Isolate::UnwindAndFindHandler() {
break;
}
+ if (frame->is_wasm() && catchable_by_wasm) {
titzer 2016/09/28 17:09:14 What about nesting this whole thing inside a if(FL
John 2016/09/29 13:28:31 Done.
+ 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);
« no previous file with comments | « src/isolate.h ('k') | src/isolate-inl.h » ('j') | src/runtime/runtime-wasm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698