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

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

Issue 2021323003: [wasm] remove faux code objects Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/x64/assembler-x64-inl.h ('k') | test/unittests/wasm/ast-decoder-unittest.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 8aa8cff940d050a7aff1ead5d5367569bcae970c..ceb42151ab48fac1995cd0bb70890781e51bb334 100644
--- a/test/cctest/wasm/wasm-run-utils.h
+++ b/test/cctest/wasm/wasm-run-utils.h
@@ -78,6 +78,7 @@ class TestingModule : public ModuleEnv {
public:
explicit TestingModule(WasmExecutionMode mode = kExecuteCompiled)
: execution_mode_(mode),
+ linked_(false),
instance_(&module_),
isolate_(CcTest::InitIsolateOnce()),
global_offset(0),
@@ -91,7 +92,6 @@ class TestingModule : public ModuleEnv {
module_.globals_size = kMaxGlobalsSize;
instance->mem_start = nullptr;
instance->mem_size = 0;
- linker = nullptr;
origin = kWasmOrigin;
memset(global_data, 0, sizeof(global_data));
}
@@ -208,8 +208,10 @@ class TestingModule : public ModuleEnv {
Handle<JSObject> module_object = Handle<JSObject>(0, isolate_);
Handle<Code> code = instance->function_code[index];
WasmJs::InstallWasmFunctionMap(isolate_, isolate_->native_context());
- return compiler::CompileJSToWasmWrapper(isolate_, this, name, code,
- module_object, index);
+ Handle<JSFunction> ret = compiler::CompileJSToWasmWrapper(
+ isolate_, this, name, code, module_object, index);
+ Link();
+ return ret;
}
void SetFunctionCode(uint32_t index, Handle<Code> code) {
@@ -242,9 +244,20 @@ class TestingModule : public ModuleEnv {
WasmInterpreter* interpreter() { return interpreter_; }
WasmExecutionMode execution_mode() { return execution_mode_; }
+ void Link() {
+ if (linked_) return;
+ compiler::Link(CcTest::i_isolate(), instance->function_code,
+ instance->function_code, RelocInfo::kWasmDirectCallMask);
+ compiler::Link(CcTest::i_isolate(), instance->function_code,
+ instance->import_code, RelocInfo::kWasmImportCallMask);
+
+ linked_ = true;
+ }
+
private:
WasmExecutionMode execution_mode_;
WasmModule module_;
+ bool linked_;
WasmModuleInstance instance_;
Isolate* isolate_;
v8::base::AccountingAllocator allocator_;
@@ -699,6 +712,9 @@ class WasmRunner {
WasmVal args[] = {WasmVal(p0), WasmVal(p1), WasmVal(p2), WasmVal(p3)};
return CallInterpreter(ArrayVector(args));
} else {
+ if (compiler_.testing_module_ != nullptr) {
+ compiler_.testing_module_->Link();
+ }
CodeRunner<int32_t> runner(CcTest::InitIsolateOnce(),
wrapper_.GetWrapperCode(),
wrapper_.signature());
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698