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

Unified Diff: test/cctest/wasm/wasm-run-utils.h

Issue 2591653002: [wasm] Introduce WasmSharedModuleData and refactor other objects (Closed)
Patch Set: Fix SLOW_DCHECK Created 4 years 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 | « test/cctest/wasm/test-wasm-breakpoints.cc ('k') | test/common/wasm/wasm-module-runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/wasm-run-utils.h
diff --git a/test/cctest/wasm/wasm-run-utils.h b/test/cctest/wasm/wasm-run-utils.h
index 4b24ca38e20ba65a380115878c40d2388ee7c566..0f36c5041c9b2de52dd344828fc04231e7fbf7ae 100644
--- a/test/cctest/wasm/wasm-run-utils.h
+++ b/test/cctest/wasm/wasm-run-utils.h
@@ -267,15 +267,16 @@ class TestingModule : public ModuleEnv {
}
uint32_t AddBytes(Vector<const byte> bytes) {
- Handle<SeqOneByteString> old_bytes =
- instance_object_->get_compiled_module()->module_bytes();
+ Handle<SeqOneByteString> old_bytes(
+ instance_object_->compiled_module()->module_bytes(), isolate_);
uint32_t old_size = static_cast<uint32_t>(old_bytes->length());
ScopedVector<byte> new_bytes(old_size + bytes.length());
memcpy(new_bytes.start(), old_bytes->GetChars(), old_size);
memcpy(new_bytes.start() + old_size, bytes.start(), bytes.length());
Handle<SeqOneByteString> new_bytes_str = Handle<SeqOneByteString>::cast(
isolate_->factory()->NewStringFromOneByte(new_bytes).ToHandleChecked());
- instance_object_->get_compiled_module()->set_module_bytes(new_bytes_str);
+ instance_object_->compiled_module()->shared()->set_module_bytes(
+ *new_bytes_str);
return old_size;
}
@@ -308,18 +309,23 @@ class TestingModule : public ModuleEnv {
}
Handle<WasmInstanceObject> InitInstanceObject() {
+ Handle<SeqOneByteString> empty_string = Handle<SeqOneByteString>::cast(
+ isolate_->factory()->NewStringFromOneByte({}).ToHandleChecked());
Handle<Managed<wasm::WasmModule>> module_wrapper =
Managed<wasm::WasmModule>::New(isolate_, &module_, false);
+ Handle<Script> script =
+ isolate_->factory()->NewScript(isolate_->factory()->empty_string());
+ script->set_type(Script::TYPE_WASM);
+ Handle<WasmSharedModuleData> shared_module_data =
+ WasmSharedModuleData::New(isolate_, module_wrapper, empty_string,
+ script, Handle<ByteArray>::null());
Handle<WasmCompiledModule> compiled_module =
- WasmCompiledModule::New(isolate_, module_wrapper);
+ WasmCompiledModule::New(isolate_, shared_module_data);
// Minimally initialize the compiled module such that IsWasmCompiledModule
// passes.
// If tests need more (correct) information, add it later.
compiled_module->set_min_mem_pages(0);
compiled_module->set_max_mem_pages(Smi::kMaxValue);
- Handle<SeqOneByteString> empty_string = Handle<SeqOneByteString>::cast(
- isolate_->factory()->NewStringFromOneByte({}).ToHandleChecked());
- compiled_module->set_module_bytes(empty_string);
DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module));
return WasmInstanceObject::New(isolate_, compiled_module);
}
« no previous file with comments | « test/cctest/wasm/test-wasm-breakpoints.cc ('k') | test/common/wasm/wasm-module-runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698