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

Unified Diff: src/wasm/wasm-module.cc

Issue 2413693003: [wasm] Stack inspection support for asm.js frames (Closed)
Patch Set: 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/frames.cc ('k') | test/mjsunit/wasm/asm-debug.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 93293c086b8f7f1f18298003276aff702be11bec..90e3f2a26495ab2b4e4635d5121973b94b772414 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1384,33 +1384,8 @@ class WasmInstanceBuilder {
FlushICache(isolate_, code_table);
//--------------------------------------------------------------------------
- // Run the start function if one was specified.
+ // Set up and link the new instance.
//--------------------------------------------------------------------------
- if (compiled_module_->has_startup_function()) {
- Handle<FixedArray> startup_data = compiled_module_->startup_function();
- HandleScope scope(isolate_);
- int32_t start_index =
- startup_data->GetValueChecked<Smi>(isolate_, kExportIndex)->value();
- Handle<Code> startup_code =
- code_table->GetValueChecked<Code>(isolate_, start_index);
- int arity = Smi::cast(startup_data->get(kExportArity))->value();
- MaybeHandle<ByteArray> startup_signature =
- startup_data->GetValue<ByteArray>(isolate_, kExportedSignature);
- Handle<JSFunction> startup_fct = WrapExportCodeAsJSFunction(
- isolate_, startup_code, factory->InternalizeUtf8String("start"),
- arity, startup_signature, instance);
- RecordStats(isolate_, *startup_code);
- // Call the JS function.
- Handle<Object> undefined = factory->undefined_value();
- MaybeHandle<Object> retval =
- Execution::Call(isolate_, startup_fct, undefined, 0, nullptr);
-
- if (retval.is_null()) {
- thrower_->Error("WASM.instantiateModule(): start function failed");
- return nothing;
- }
- }
-
{
Handle<Object> global_handle =
isolate_->global_handles()->Create(*instance);
@@ -1446,6 +1421,38 @@ class WasmInstanceBuilder {
}
}
+ //--------------------------------------------------------------------------
+ // Run the start function if one was specified.
+ //--------------------------------------------------------------------------
+ if (compiled_module_->has_startup_function()) {
+ Handle<FixedArray> startup_data = compiled_module_->startup_function();
+ HandleScope scope(isolate_);
+ int32_t start_index =
+ startup_data->GetValueChecked<Smi>(isolate_, kExportIndex)->value();
+ Handle<Code> startup_code =
+ code_table->GetValueChecked<Code>(isolate_, start_index);
+ int arity = Smi::cast(startup_data->get(kExportArity))->value();
+ MaybeHandle<ByteArray> startup_signature =
+ startup_data->GetValue<ByteArray>(isolate_, kExportedSignature);
+ Handle<JSFunction> startup_fct = WrapExportCodeAsJSFunction(
+ isolate_, startup_code, factory->InternalizeUtf8String("start"),
+ arity, startup_signature, instance);
+ RecordStats(isolate_, *startup_code);
+ // Call the JS function.
+ Handle<Object> undefined = factory->undefined_value();
+ MaybeHandle<Object> retval =
+ Execution::Call(isolate_, startup_fct, undefined, 0, nullptr);
+
+ if (retval.is_null()) {
+ thrower_->Error("WASM.instantiateModule(): start function failed");
+ // It's unfortunate that the new instance is already linked in the
+ // chain. However, we need to set up everything before executing the
+ // start function, such that stack trace information can be generated
+ // correctly already in the start function.
+ return nothing;
+ }
+ }
+
DCHECK(wasm::IsWasmObject(*instance));
TRACE("Finishing instance %d\n", compiled_module_->instance_id());
« no previous file with comments | « src/frames.cc ('k') | test/mjsunit/wasm/asm-debug.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698