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

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

Issue 2540133002: [wasm] Remove raw byte pointers from WasmModule (Closed)
Patch Set: Address comments 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-run-wasm-module.cc ('k') | test/common/wasm/wasm-module-runner.h » ('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 561dda3ea7941b894a1ad8c1a8997b635eb6ef44..470bba6853f643bc4b336807b93906801480652c 100644
--- a/test/cctest/wasm/wasm-run-utils.h
+++ b/test/cctest/wasm/wasm-run-utils.h
@@ -72,21 +72,22 @@ const uint32_t kMaxGlobalsSize = 128;
class TestingModule : public ModuleEnv {
public:
explicit TestingModule(WasmExecutionMode mode = kExecuteCompiled)
- : execution_mode_(mode),
+ : ModuleEnv(&module_, &instance_),
+ execution_mode_(mode),
instance_(&module_),
isolate_(CcTest::InitIsolateOnce()),
global_offset(0),
interpreter_(mode == kExecuteInterpreted
- ? new WasmInterpreter(&instance_, &allocator_)
+ ? new WasmInterpreter(
+ ModuleBytesEnv(&module_, &instance_,
+ Vector<const byte>::empty()),
+ &allocator_)
: nullptr) {
- module = &module_;
- instance = &instance_;
instance->module = &module_;
instance->globals_start = global_data;
module_.globals_size = kMaxGlobalsSize;
instance->mem_start = nullptr;
instance->mem_size = 0;
- origin = kWasmOrigin;
memset(global_data, 0, sizeof(global_data));
}
@@ -97,7 +98,7 @@ class TestingModule : public ModuleEnv {
if (interpreter_) delete interpreter_;
}
- void ChangeOriginToAsmjs() { origin = kAsmJsOrigin; }
+ void ChangeOriginToAsmjs() { module_.origin = kAsmJsOrigin; }
byte* AddMemory(uint32_t size) {
CHECK_NULL(instance->mem_start);
@@ -212,7 +213,7 @@ class TestingModule : public ModuleEnv {
Handle<Code> code = instance->function_code[index];
WasmJs::InstallWasmMapsIfNeeded(isolate_, isolate_->native_context());
Handle<Code> ret_code =
- compiler::CompileJSToWasmWrapper(isolate_, this, code, index);
+ compiler::CompileJSToWasmWrapper(isolate_, &module_, code, index);
Handle<JSFunction> ret = WasmExportedFunction::New(
isolate_, instance_obj, name, ret_code,
static_cast<int>(this->module->functions[index].sig->parameter_count()),
@@ -481,7 +482,8 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
function_->func_index = 0;
function_->sig_index = 0;
if (mode == kExecuteInterpreted) {
- interpreter_ = new WasmInterpreter(nullptr, zone()->allocator());
+ ModuleBytesEnv empty_env(nullptr, nullptr, Vector<const byte>::empty());
+ interpreter_ = new WasmInterpreter(empty_env, zone()->allocator());
int index = interpreter_->AddFunctionForTesting(function_);
CHECK_EQ(0, index);
}
« no previous file with comments | « test/cctest/wasm/test-run-wasm-module.cc ('k') | test/common/wasm/wasm-module-runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698