[wasm] Reset WasmCompiledModule when it contains non-default values

When we use a WasmCompiledModule for a second instance (i.e. the first
instance has been collected already by the GC), we reset all instance
specialization data the WasmCompiledModule contains, and then patch in
the new instance specialization data. However, we guarded the reset of
memory references, and in the referenced issue the memory references
were not reset and therefore later patched incorrectly during
instantiation. With this CL we change the condition and reset now every
time the current version of a WasmCompiledModule contains non-default
values.

R=mtrofin@chromium.org
CC=​mstarzinger@chromium.org
TEST=mjsunit/regress/regress-crbug-759327

Bug: chromium:759327
Change-Id: I9a147afd6ad4000b782850dae0b90685759c9dc7
Reviewed-on: https://chromium-review.googlesource.com/638571
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47665}
This commit is contained in:
Andreas Haas 2017-08-28 18:23:12 +02:00 committed by Commit Bot
parent 47c25893d0
commit 402f5151cd

View File

@ -965,7 +965,7 @@ void WasmCompiledModule::Reset(Isolate* isolate,
Zone specialization_zone(isolate->allocator(), ZONE_NAME);
CodeSpecialization code_specialization(isolate, &specialization_zone);
if (old_mem_size > 0 && old_mem_start != nullptr) {
if (old_mem_size != default_mem_size || old_mem_start != nullptr) {
code_specialization.RelocateMemoryReferences(old_mem_start, old_mem_size,
nullptr, default_mem_size);
}