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

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

Issue 1884593002: [wasm] Add a cctest for the stack on a wasm trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-throw-error
Patch Set: one more c++ style fix Created 4 years, 8 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 | « test/cctest/wasm/test-wasm-stack.cc ('k') | no next file » | 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 adca30e545c3107ac9119d69390db880afd49b3c..ea3e8ba2d4f381a9e96a3c6d13b1650eac65e904 100644
--- a/test/cctest/wasm/wasm-run-utils.h
+++ b/test/cctest/wasm/wasm-run-utils.h
@@ -410,13 +410,15 @@ class WasmFunctionWrapper : public HandleAndZoneScope,
class WasmFunctionCompiler : public HandleAndZoneScope,
private GraphAndBuilders {
public:
- explicit WasmFunctionCompiler(FunctionSig* sig, TestingModule* module)
+ explicit WasmFunctionCompiler(FunctionSig* sig, TestingModule* module,
+ const char* debug_name = "<WASM UNNAMED>")
: GraphAndBuilders(main_zone()),
jsgraph(this->isolate(), this->graph(), this->common(), nullptr,
nullptr, this->machine()),
sig(sig),
descriptor_(nullptr),
- testing_module_(module) {
+ testing_module_(module),
+ debug_name_(debug_name) {
if (module) {
// Get a new function from the testing module.
function_ = nullptr;
@@ -438,6 +440,7 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
// The call descriptor is initialized when the function is compiled.
CallDescriptor* descriptor_;
TestingModule* testing_module_;
+ const char* debug_name_;
WasmFunction* function_;
int function_index_;
LocalDeclEncoder local_decls;
@@ -474,7 +477,7 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
if (kPointerSize == 4) {
desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc);
}
- CompilationInfo info("wasm compile", this->isolate(), this->zone(),
+ CompilationInfo info(debug_name_, this->isolate(), this->zone(),
Code::ComputeFlags(Code::WASM_FUNCTION));
Handle<Code> result =
Pipeline::GenerateCodeForTesting(&info, desc, this->graph());
@@ -500,6 +503,16 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
if (function_) return function_;
return &testing_module_->module->functions[function_index_];
}
+
+ // Set the context, such that e.g. runtime functions can be called.
+ void SetModuleContext() {
+ if (!testing_module_->instance->context.is_null()) {
+ CHECK(testing_module_->instance->context.is_identical_to(
+ main_isolate()->native_context()));
+ return;
+ }
+ testing_module_->instance->context = main_isolate()->native_context();
+ }
};
// A helper class to build graphs from Wasm bytecode, generate machine
« no previous file with comments | « test/cctest/wasm/test-wasm-stack.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698