diff options
Diffstat (limited to 'deps/v8/test/cctest/wasm/wasm-run-utils.h')
-rw-r--r-- | deps/v8/test/cctest/wasm/wasm-run-utils.h | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index d1bc9293b63..5d008d882a4 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -75,42 +75,6 @@ using compiler::Node; r.Build(code, code + arraysize(code)); \ } while (false) -template <typename T> -void AppendSingle(std::vector<byte>* code, T t) { - static_assert(std::is_integral<T>::value, - "Special types need specializations"); - code->push_back(t); -} - -// Specialized for WasmOpcode. -template <> -void AppendSingle<WasmOpcode>(std::vector<byte>* code, WasmOpcode op); - -template <typename... T> -void Append(std::vector<byte>* code, T... ts) { - static_assert(sizeof...(ts) == 0, "Base case for appending bytes to code."); -} - -template <typename First, typename... Rest> -void Append(std::vector<byte>* code, First first, Rest... rest) { - AppendSingle(code, first); - Append(code, rest...); -} - -// Like BUILD but pushes code bytes into a std::vector instead of an array -// initializer. This is useful for opcodes (like SIMD), that are LEB128 -// (variable-sized). We use recursive template instantiations with variadic -// template arguments, so that the Append calls can handle either bytes or -// opcodes. AppendSingle is specialized for WasmOpcode, and appends multiple -// bytes. This allows existing callers to swap out the BUILD macro for BUILD_V -// macro without changes. Also see https://crbug.com/v8/10258. -#define BUILD_V(r, ...) \ - do { \ - std::vector<byte> code; \ - Append(&code, __VA_ARGS__); \ - r.Build(code.data(), code.data() + code.size()); \ - } while (false) - // For tests that must manually import a JSFunction with source code. struct ManuallyImportedJSFunction { const FunctionSig* sig; @@ -146,12 +110,10 @@ class TestingModuleBuilder { } byte AddSignature(const FunctionSig* sig) { - DCHECK_EQ(test_module_->signatures.size(), - test_module_->signature_ids.size()); - test_module_->signatures.push_back(sig); - auto canonical_sig_num = test_module_->signature_map.FindOrInsert(*sig); - test_module_->signature_ids.push_back(canonical_sig_num); - size_t size = test_module_->signatures.size(); + // TODO(7748): This will need updating for struct/array types support. + DCHECK_EQ(test_module_->types.size(), test_module_->signature_ids.size()); + test_module_->add_signature(sig); + size_t size = test_module_->types.size(); CHECK_GT(127, size); return static_cast<byte>(size - 1); } @@ -258,10 +220,13 @@ class TestingModuleBuilder { void SetExecutable() { native_module_->SetExecutable(true); } - void TierDown() { native_module_->TierDown(isolate_); } + void TierDown() { + native_module_->SetTieringState(kTieredDown); + native_module_->TriggerRecompilation(); + execution_tier_ = ExecutionTier::kLiftoff; + } - enum AssumeDebugging : bool { kDebug = true, kNoDebug = false }; - CompilationEnv CreateCompilationEnv(AssumeDebugging = kNoDebug); + CompilationEnv CreateCompilationEnv(); ExecutionTier execution_tier() const { return execution_tier_; } |