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

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

Issue 2395063002: [wasm] Fix wasm instantiation flakes (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 | « no previous file | no next file » | 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 f4cf505f5a910761dda7ba846dcc2f4ee630be89..dd3768be2d03f5df2a7edd73bd5e05829b4aa81a 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1211,16 +1211,15 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
{
Handle<WasmCompiledModule> original(
WasmCompiledModule::cast(module_object->GetInternalField(0)), isolate);
- // Always make a new copy of the code_table, since the old_code_table
- // may still have placeholders for imports.
- old_code_table = original->code_table();
- code_table = factory->CopyFixedArray(old_code_table);
-
if (original->has_weak_owning_instance()) {
WeakCell* tmp = original->ptr_to_weak_owning_instance();
titzer 2016/10/07 12:40:32 Why do we have a raw pointer here?
Mircea Trofin 2016/10/07 14:44:23 Not sure, I think this is from 0xC; it's immateria
DCHECK(!tmp->cleared());
// There is already an owner, clone everything.
owner = Handle<JSObject>(JSObject::cast(tmp->value()), isolate);
+
+ old_code_table = original->code_table();
+ code_table = factory->CopyFixedArray(old_code_table);
titzer 2016/10/07 12:40:32 I don't understand how this fixes anything. As far
Mircea Trofin 2016/10/07 14:44:23 Consider the old code. Suppose the allocation on l
titzer 2016/10/07 15:37:42 Ok, until then can we have a switch to turn off th
+
// Insert the latest clone in front.
TRACE("Cloning from %d\n", original->instance_id());
compiled_module = WasmCompiledModule::Clone(isolate, original);
@@ -1254,6 +1253,11 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
}
RecordStats(isolate, code_table);
} else {
+ // Always make a new copy of the code_table, since the old_code_table
+ // may still have placeholders for imports.
+ old_code_table = original->code_table();
+ code_table = factory->CopyFixedArray(old_code_table);
+
// There was no owner, so we can reuse the original.
compiled_module = original;
TRACE("Reusing existing instance %d\n", compiled_module->instance_id());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698