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

Unified Diff: src/asmjs/asm-wasm-builder.cc

Issue 2404253002: [wasm] Provide better stack traces for asm.js code (Closed)
Patch Set: Address titzer's comments Created 4 years, 2 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/asmjs/asm-wasm-builder.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/asmjs/asm-wasm-builder.cc
diff --git a/src/asmjs/asm-wasm-builder.cc b/src/asmjs/asm-wasm-builder.cc
index 1cb67edd6e0dbc28c14f5277e4b89d0afcf4f2cb..5e9a9c378ef225cd453cb6e7bf65bb3407c6a593 100644
--- a/src/asmjs/asm-wasm-builder.cc
+++ b/src/asmjs/asm-wasm-builder.cc
@@ -1359,11 +1359,13 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
uint32_t index = imported_function_table_.LookupOrInsertImport(
vp->var(), sig.Build());
VisitCallArgs(expr);
+ current_function_builder_->AddAsmWasmOffset(expr->position());
current_function_builder_->Emit(kExprCallFunction);
current_function_builder_->EmitVarInt(index);
} else {
WasmFunctionBuilder* function = LookupOrInsertFunction(vp->var());
VisitCallArgs(expr);
+ current_function_builder_->AddAsmWasmOffset(expr->position());
current_function_builder_->Emit(kExprCallFunction);
current_function_builder_->EmitDirectCallIndex(
function->func_index());
@@ -1389,6 +1391,7 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
VisitCallArgs(expr);
current_function_builder_->EmitGetLocal(tmp.index());
+ current_function_builder_->AddAsmWasmOffset(expr->position());
current_function_builder_->Emit(kExprCallIndirect);
current_function_builder_->EmitVarInt(indices->signature_index);
returns_value =
@@ -1870,13 +1873,16 @@ AsmWasmBuilder::AsmWasmBuilder(Isolate* isolate, Zone* zone,
// TODO(aseemgarg): probably should take zone (to write wasm to) as input so
// that zone in constructor may be thrown away once wasm module is written.
-ZoneBuffer* AsmWasmBuilder::Run(i::Handle<i::FixedArray>* foreign_args) {
+AsmWasmBuilder::Result AsmWasmBuilder::Run(
+ i::Handle<i::FixedArray>* foreign_args) {
AsmWasmBuilderImpl impl(isolate_, zone_, literal_, typer_);
impl.Build();
*foreign_args = impl.GetForeignArgs();
- ZoneBuffer* buffer = new (zone_) ZoneBuffer(zone_);
- impl.builder_->WriteTo(*buffer);
- return buffer;
+ ZoneBuffer* module_buffer = new (zone_) ZoneBuffer(zone_);
+ impl.builder_->WriteTo(*module_buffer);
+ ZoneBuffer* asm_offsets_buffer = new (zone_) ZoneBuffer(zone_);
+ impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer);
+ return {module_buffer, asm_offsets_buffer};
}
const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__";
« no previous file with comments | « src/asmjs/asm-wasm-builder.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698