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

Unified Diff: src/wasm/ast-decoder.cc

Issue 1890803002: [wasm] Generate source position information (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-throw-error
Patch Set: avoid using std::tie Created 4 years, 8 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/compiler/wasm-compiler.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.cc
diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc
index d63037aef7676b38f709201cb152c3428c06e7ae..62026517a74605bc38bded99dcbdf6c7afb20d89 100644
--- a/src/wasm/ast-decoder.cc
+++ b/src/wasm/ast-decoder.cc
@@ -718,6 +718,7 @@ class SR_WasmDecoder : public WasmDecoder {
break;
}
case kExprUnreachable: {
+ // TODO(clemensh): add source position for unreachable
BUILD0(Unreachable);
ssa_env_->Kill(SsaEnv::kControlEnd);
Leaf(kAstEnd, nullptr);
@@ -1235,6 +1236,7 @@ class SR_WasmDecoder : public WasmDecoder {
buffer[i] = p->tree->children[i - 1]->node;
}
p->tree->node = builder_->CallDirect(operand.index, buffer);
+ AddSourcePosition(p);
}
break;
}
@@ -1253,6 +1255,7 @@ class SR_WasmDecoder : public WasmDecoder {
buffer[i] = p->tree->children[i]->node;
}
p->tree->node = builder_->CallIndirect(operand.index, buffer);
+ AddSourcePosition(p);
}
break;
}
@@ -1270,6 +1273,7 @@ class SR_WasmDecoder : public WasmDecoder {
buffer[i] = p->tree->children[i - 1]->node;
}
p->tree->node = builder_->CallImport(operand.index, buffer);
+ AddSourcePosition(p);
}
break;
}
@@ -1631,6 +1635,17 @@ class SR_WasmDecoder : public WasmDecoder {
}
return assigned;
}
+
+ void AddSourcePosition(Production* p) {
+ DCHECK_NOT_NULL(p->tree->node);
+ AddSourcePosition(p->tree->node, p->pc());
+ }
+
+ void AddSourcePosition(TFNode* node, const byte* pc) {
+ int offset = static_cast<int>(pc - start_);
+ DCHECK_EQ(pc - start_, offset); // overflows cannot happen
+ builder_->SetSourcePosition(node, offset);
+ }
};
bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start,
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698