Commit 3d35921e authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Unify all enums representing execution tiers

R=mstarzinger@chromium.org

Change-Id: Iacdff28dd1383d77d7708de4ee22d9f2a77d872a
Reviewed-on: https://chromium-review.googlesource.com/1183440
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55284}
parent 2650fc33
......@@ -2556,6 +2556,7 @@ v8_source_set("v8_base") {
"src/wasm/wasm-serialization.h",
"src/wasm/wasm-text.cc",
"src/wasm/wasm-text.h",
"src/wasm/wasm-tier.h",
"src/wasm/wasm-value.h",
"src/zone/accounting-allocator.cc",
"src/zone/accounting-allocator.h",
......
......@@ -1040,10 +1040,10 @@ RUNTIME_FUNCTION(Runtime_WasmTraceMemory) {
// TODO(titzer): eliminate dependency on WasmModule definition here.
int func_start =
frame->wasm_instance()->module()->functions[func_index].code.offset();
wasm::ExecutionEngine eng = frame->wasm_code()->is_liftoff()
? wasm::ExecutionEngine::kLiftoff
: wasm::ExecutionEngine::kTurbofan;
wasm::TraceMemoryOperation(eng, info, func_index, pos - func_start,
wasm::ExecutionTier tier = frame->wasm_code()->is_liftoff()
? wasm::ExecutionTier::kBaseline
: wasm::ExecutionTier::kOptimized;
wasm::TraceMemoryOperation(tier, info, func_index, pos - func_start,
mem_start);
return ReadOnlyRoots(isolate).undefined_value();
}
......@@ -1055,7 +1055,7 @@ RUNTIME_FUNCTION(Runtime_WasmTierUpFunction) {
CONVERT_SMI_ARG_CHECKED(function_index, 1);
if (!isolate->wasm_engine()->CompileFunction(
isolate, instance->module_object()->native_module(), function_index,
wasm::WasmEngine::kOptimizedTier)) {
wasm::ExecutionTier::kOptimized)) {
return ReadOnlyRoots(isolate).exception();
}
return ReadOnlyRoots(isolate).undefined_value();
......
......@@ -16,13 +16,14 @@ namespace wasm {
namespace {
const char* GetCompilationModeAsString(
WasmCompilationUnit::CompilationMode mode) {
const char* GetExecutionTierAsString(ExecutionTier mode) {
switch (mode) {
case WasmCompilationUnit::CompilationMode::kLiftoff:
case ExecutionTier::kBaseline:
return "liftoff";
case WasmCompilationUnit::CompilationMode::kTurbofan:
case ExecutionTier::kOptimized:
return "turbofan";
case ExecutionTier::kInterpreter:
return "interpreter";
}
UNREACHABLE();
}
......@@ -37,9 +38,8 @@ void RecordStats(const WasmCode* code, Counters* counters) {
} // namespace
// static
WasmCompilationUnit::CompilationMode
WasmCompilationUnit::GetDefaultCompilationMode() {
return FLAG_liftoff ? CompilationMode::kLiftoff : CompilationMode::kTurbofan;
ExecutionTier WasmCompilationUnit::GetDefaultExecutionTier() {
return FLAG_liftoff ? ExecutionTier::kBaseline : ExecutionTier::kOptimized;
}
WasmCompilationUnit::WasmCompilationUnit(WasmEngine* wasm_engine,
......@@ -47,7 +47,7 @@ WasmCompilationUnit::WasmCompilationUnit(WasmEngine* wasm_engine,
NativeModule* native_module,
FunctionBody body, WasmName name,
int index, Counters* counters,
CompilationMode mode)
ExecutionTier mode)
: env_(env),
wasm_engine_(wasm_engine),
func_body_(body),
......@@ -61,10 +61,10 @@ WasmCompilationUnit::WasmCompilationUnit(WasmEngine* wasm_engine,
// Always disable Liftoff for asm.js, for two reasons:
// 1) asm-specific opcodes are not implemented, and
// 2) tier-up does not work with lazy compilation.
if (env->module->origin == kAsmJsOrigin) mode = CompilationMode::kTurbofan;
if (env->module->origin == kAsmJsOrigin) mode = ExecutionTier::kOptimized;
if (V8_UNLIKELY(FLAG_wasm_tier_mask_for_testing) && index < 32 &&
(FLAG_wasm_tier_mask_for_testing & (1 << index))) {
mode = CompilationMode::kTurbofan;
mode = ExecutionTier::kOptimized;
}
SwitchMode(mode);
}
......@@ -84,32 +84,34 @@ void WasmCompilationUnit::ExecuteCompilation() {
if (FLAG_trace_wasm_compiler) {
PrintF("Compiling wasm function %d with %s\n\n", func_index_,
GetCompilationModeAsString(mode_));
GetExecutionTierAsString(mode_));
}
switch (mode_) {
case WasmCompilationUnit::CompilationMode::kLiftoff:
case ExecutionTier::kBaseline:
if (liftoff_unit_->ExecuteCompilation()) break;
// Otherwise, fall back to turbofan.
SwitchMode(CompilationMode::kTurbofan);
SwitchMode(ExecutionTier::kOptimized);
V8_FALLTHROUGH;
case WasmCompilationUnit::CompilationMode::kTurbofan:
case ExecutionTier::kOptimized:
turbofan_unit_->ExecuteCompilation();
break;
case ExecutionTier::kInterpreter:
UNREACHABLE(); // TODO(titzer): compile interpreter entry stub.
}
}
WasmCode* WasmCompilationUnit::FinishCompilation(ErrorThrower* thrower) {
WasmCode* ret;
switch (mode_) {
case CompilationMode::kLiftoff:
case ExecutionTier::kBaseline:
ret = liftoff_unit_->FinishCompilation(thrower);
break;
case CompilationMode::kTurbofan:
case ExecutionTier::kOptimized:
ret = turbofan_unit_->FinishCompilation(thrower);
break;
default:
UNREACHABLE();
case ExecutionTier::kInterpreter:
UNREACHABLE(); // TODO(titzer): finish interpreter entry stub.
}
if (ret == nullptr) {
thrower->RuntimeError("Error finalizing code.");
......@@ -119,22 +121,24 @@ WasmCode* WasmCompilationUnit::FinishCompilation(ErrorThrower* thrower) {
return ret;
}
void WasmCompilationUnit::SwitchMode(CompilationMode new_mode) {
void WasmCompilationUnit::SwitchMode(ExecutionTier new_mode) {
// This method is being called in the constructor, where neither
// {liftoff_unit_} nor {turbofan_unit_} are set, or to switch mode from
// kLiftoff to kTurbofan, in which case {liftoff_unit_} is already set.
mode_ = new_mode;
switch (new_mode) {
case CompilationMode::kLiftoff:
case ExecutionTier::kBaseline:
DCHECK(!turbofan_unit_);
DCHECK(!liftoff_unit_);
liftoff_unit_.reset(new LiftoffCompilationUnit(this));
return;
case CompilationMode::kTurbofan:
case ExecutionTier::kOptimized:
DCHECK(!turbofan_unit_);
liftoff_unit_.reset();
turbofan_unit_.reset(new compiler::TurbofanWasmCompilationUnit(this));
return;
case ExecutionTier::kInterpreter:
UNREACHABLE(); // TODO(titzer): allow compiling interpreter entry stub.
}
UNREACHABLE();
}
......@@ -142,7 +146,7 @@ void WasmCompilationUnit::SwitchMode(CompilationMode new_mode) {
// static
WasmCode* WasmCompilationUnit::CompileWasmFunction(
NativeModule* native_module, ErrorThrower* thrower, Isolate* isolate,
ModuleEnv* env, const WasmFunction* function, CompilationMode mode) {
ModuleEnv* env, const WasmFunction* function, ExecutionTier mode) {
ModuleWireBytes wire_bytes(native_module->wire_bytes());
FunctionBody function_body{function->sig, function->code.offset(),
wire_bytes.start() + function->code.offset(),
......
......@@ -8,6 +8,7 @@
#include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-tier.h"
namespace v8 {
namespace internal {
......@@ -77,8 +78,7 @@ struct ModuleEnv {
class WasmCompilationUnit final {
public:
enum class CompilationMode : uint8_t { kLiftoff, kTurbofan };
static CompilationMode GetDefaultCompilationMode();
static ExecutionTier GetDefaultExecutionTier();
// If constructing from a background thread, pass in a Counters*, and ensure
// that the Counters live at least as long as this compilation unit (which
......@@ -87,7 +87,7 @@ class WasmCompilationUnit final {
// used by callers to pass Counters.
WasmCompilationUnit(WasmEngine* wasm_engine, ModuleEnv*, NativeModule*,
FunctionBody, WasmName, int index, Counters*,
CompilationMode = GetDefaultCompilationMode());
ExecutionTier = GetDefaultExecutionTier());
~WasmCompilationUnit();
......@@ -97,10 +97,10 @@ class WasmCompilationUnit final {
static WasmCode* CompileWasmFunction(
NativeModule* native_module, ErrorThrower* thrower, Isolate* isolate,
ModuleEnv* env, const WasmFunction* function,
CompilationMode = GetDefaultCompilationMode());
ExecutionTier = GetDefaultExecutionTier());
NativeModule* native_module() const { return native_module_; }
CompilationMode mode() const { return mode_; }
ExecutionTier mode() const { return mode_; }
private:
friend class LiftoffCompilationUnit;
......@@ -113,13 +113,13 @@ class WasmCompilationUnit final {
Counters* counters_;
int func_index_;
NativeModule* native_module_;
CompilationMode mode_;
ExecutionTier mode_;
// LiftoffCompilationUnit, set if {mode_ == kLiftoff}.
std::unique_ptr<LiftoffCompilationUnit> liftoff_unit_;
// TurbofanWasmCompilationUnit, set if {mode_ == kTurbofan}.
std::unique_ptr<compiler::TurbofanWasmCompilationUnit> turbofan_unit_;
void SwitchMode(CompilationMode new_mode);
void SwitchMode(ExecutionTier new_mode);
DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit);
};
......
......@@ -11,7 +11,7 @@ namespace v8 {
namespace internal {
namespace wasm {
void TraceMemoryOperation(ExecutionEngine engine, const MemoryTracingInfo* info,
void TraceMemoryOperation(ExecutionTier tier, const MemoryTracingInfo* info,
int func_index, int position, uint8_t* mem_start) {
EmbeddedVector<char, 64> value;
auto mem_rep = static_cast<MachineRepresentation>(info->mem_rep);
......@@ -35,14 +35,14 @@ void TraceMemoryOperation(ExecutionEngine engine, const MemoryTracingInfo* info,
SNPrintF(value, "???");
}
const char* eng = "?";
switch (engine) {
case ExecutionEngine::kTurbofan:
switch (tier) {
case ExecutionTier::kOptimized:
eng = "turbofan";
break;
case ExecutionEngine::kLiftoff:
case ExecutionTier::kBaseline:
eng = "liftoff";
break;
case ExecutionEngine::kInterpreter:
case ExecutionTier::kInterpreter:
eng = "interpreter";
break;
}
......
......@@ -8,13 +8,12 @@
#include <cstdint>
#include "src/machine-type.h"
#include "src/wasm/wasm-tier.h"
namespace v8 {
namespace internal {
namespace wasm {
enum class ExecutionEngine { kTurbofan, kLiftoff, kInterpreter };
// This struct is create in generated code, hence use low-level types.
struct MemoryTracingInfo {
uint32_t address;
......@@ -31,7 +30,7 @@ struct MemoryTracingInfo {
// Callback for tracing a memory operation for debugging.
// Triggered by --wasm-trace-memory.
void TraceMemoryOperation(ExecutionEngine, const MemoryTracingInfo* info,
void TraceMemoryOperation(ExecutionTier, const MemoryTracingInfo* info,
int func_index, int position, uint8_t* mem_start);
} // namespace wasm
......
......@@ -88,7 +88,7 @@ class CompilationState {
void OnError(ErrorThrower* thrower);
void OnFinishedUnit();
void ScheduleUnitForFinishing(std::unique_ptr<WasmCompilationUnit> unit,
WasmCompilationUnit::CompilationMode mode);
ExecutionTier mode);
void OnBackgroundTaskStopped();
void RestartBackgroundTasks(size_t max = std::numeric_limits<size_t>::max());
......@@ -450,17 +450,15 @@ class CompilationUnitBuilder {
Vector<const uint8_t> bytes, WasmName name) {
switch (compilation_state_->compile_mode()) {
case CompileMode::kTiering:
tiering_units_.emplace_back(
CreateUnit(function, buffer_offset, bytes, name,
WasmCompilationUnit::CompilationMode::kTurbofan));
baseline_units_.emplace_back(
CreateUnit(function, buffer_offset, bytes, name,
WasmCompilationUnit::CompilationMode::kLiftoff));
tiering_units_.emplace_back(CreateUnit(
function, buffer_offset, bytes, name, ExecutionTier::kOptimized));
baseline_units_.emplace_back(CreateUnit(
function, buffer_offset, bytes, name, ExecutionTier::kBaseline));
return;
case CompileMode::kRegular:
baseline_units_.emplace_back(
CreateUnit(function, buffer_offset, bytes, name,
WasmCompilationUnit::GetDefaultCompilationMode()));
WasmCompilationUnit::GetDefaultExecutionTier()));
return;
}
UNREACHABLE();
......@@ -479,10 +477,11 @@ class CompilationUnitBuilder {
}
private:
std::unique_ptr<WasmCompilationUnit> CreateUnit(
const WasmFunction* function, uint32_t buffer_offset,
Vector<const uint8_t> bytes, WasmName name,
WasmCompilationUnit::CompilationMode mode) {
std::unique_ptr<WasmCompilationUnit> CreateUnit(const WasmFunction* function,
uint32_t buffer_offset,
Vector<const uint8_t> bytes,
WasmName name,
ExecutionTier mode) {
return base::make_unique<WasmCompilationUnit>(
compilation_state_->wasm_engine(), compilation_state_->module_env(),
native_module_,
......@@ -513,7 +512,7 @@ bool FetchAndExecuteCompilationUnit(CompilationState* compilation_state) {
// to Turbofan if it cannot be compiled using Liftoff. This can be removed
// later as soon as Liftoff can compile any function. Then, we can directly
// access {unit->mode()} within {ScheduleUnitForFinishing()}.
WasmCompilationUnit::CompilationMode mode = unit->mode();
ExecutionTier mode = unit->mode();
unit->ExecuteCompilation();
compilation_state->ScheduleUnitForFinishing(std::move(unit), mode);
......@@ -2778,8 +2777,7 @@ void CompilationState::AddCompilationUnits(
if (compile_mode_ == CompileMode::kTiering) {
DCHECK_EQ(baseline_units.size(), tiering_units.size());
DCHECK_EQ(tiering_units.back()->mode(),
WasmCompilationUnit::CompilationMode::kTurbofan);
DCHECK_EQ(tiering_units.back()->mode(), ExecutionTier::kOptimized);
tiering_compilation_units_.insert(
tiering_compilation_units_.end(),
std::make_move_iterator(tiering_units.begin()),
......@@ -2866,11 +2864,10 @@ void CompilationState::OnFinishedUnit() {
}
void CompilationState::ScheduleUnitForFinishing(
std::unique_ptr<WasmCompilationUnit> unit,
WasmCompilationUnit::CompilationMode mode) {
std::unique_ptr<WasmCompilationUnit> unit, ExecutionTier mode) {
base::LockGuard<base::Mutex> guard(&mutex_);
if (compile_mode_ == CompileMode::kTiering &&
mode == WasmCompilationUnit::CompilationMode::kTurbofan) {
mode == ExecutionTier::kOptimized) {
tiering_finish_units_.push_back(std::move(unit));
} else {
baseline_finish_units_.push_back(std::move(unit));
......
......@@ -169,16 +169,12 @@ std::shared_ptr<StreamingDecoder> WasmEngine::StartStreamingCompilation(
}
bool WasmEngine::CompileFunction(Isolate* isolate, NativeModule* native_module,
uint32_t function_index,
CompilationTier tier) {
uint32_t function_index, ExecutionTier tier) {
ErrorThrower thrower(isolate, "Manually requested tier up");
WasmCompilationUnit::CompilationMode mode =
(tier == kBaselineTier) ? WasmCompilationUnit::CompilationMode::kLiftoff
: WasmCompilationUnit::CompilationMode::kTurbofan;
WasmCode* ret = WasmCompilationUnit::CompileWasmFunction(
native_module, &thrower, isolate,
GetModuleEnv(native_module->compilation_state()),
&native_module->module()->functions[function_index], mode);
&native_module->module()->functions[function_index], tier);
return ret != nullptr;
}
......
......@@ -9,6 +9,7 @@
#include "src/wasm/wasm-code-manager.h"
#include "src/wasm/wasm-memory.h"
#include "src/wasm/wasm-tier.h"
#include "src/zone/accounting-allocator.h"
namespace v8 {
......@@ -94,9 +95,8 @@ class V8_EXPORT_PRIVATE WasmEngine {
// Compiles the function with the given index at a specific compilation tier
// and returns true on success, false (and pending exception) otherwise. This
// is mostly used for testing to force a function into a specific tier.
enum CompilationTier { kBaselineTier, kOptimizedTier };
bool CompileFunction(Isolate* isolate, NativeModule* native_module,
uint32_t function_index, CompilationTier tier);
uint32_t function_index, ExecutionTier tier);
// Exports the sharable parts of the given module object so that they can be
// transferred to a different Context/Isolate using the same engine.
......
......@@ -1428,7 +1428,7 @@ class ThreadImpl {
if (FLAG_wasm_trace_memory) {
MemoryTracingInfo info(imm.offset + index, false, rep);
TraceMemoryOperation(ExecutionEngine::kInterpreter, &info,
TraceMemoryOperation(ExecutionTier::kInterpreter, &info,
code->function->func_index, static_cast<int>(pc),
instance_object_->memory_start());
}
......@@ -1454,7 +1454,7 @@ class ThreadImpl {
if (FLAG_wasm_trace_memory) {
MemoryTracingInfo info(imm.offset + index, true, rep);
TraceMemoryOperation(ExecutionEngine::kInterpreter, &info,
TraceMemoryOperation(ExecutionTier::kInterpreter, &info,
code->function->func_index, static_cast<int>(pc),
instance_object_->memory_start());
}
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_WASM_WASM_TIER_H_
#define V8_WASM_WASM_TIER_H_
namespace v8 {
namespace internal {
namespace wasm {
// All the tiers of WASM execution.
enum class ExecutionTier {
kInterpreter, // interpreter (used to provide debugging services).
kBaseline, // Liftoff.
kOptimized // TurboFan.
};
} // namespace wasm
} // namespace internal
} // namespace v8
#endif // V8_WASM_WASM_TIER_H_
......@@ -30,7 +30,7 @@ class CWasmEntryArgTester {
public:
CWasmEntryArgTester(std::initializer_list<uint8_t> wasm_function_bytes,
std::function<ReturnType(Args...)> expected_fn)
: runner_(kExecuteTurbofan),
: runner_(ExecutionTier::kOptimized),
isolate_(runner_.main_isolate()),
expected_fn_(expected_fn),
sig_(runner_.template CreateSig<ReturnType, Args...>()) {
......
......@@ -22,7 +22,7 @@ namespace wasm {
namespace test_run_wasm_64 {
WASM_EXEC_TEST(I64Const) {
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
const int64_t kExpectedValue = 0x1122334455667788LL;
// return(kExpectedValue)
BUILD(r, WASM_I64V_9(kExpectedValue));
......@@ -32,7 +32,7 @@ WASM_EXEC_TEST(I64Const) {
WASM_EXEC_TEST(I64Const_many) {
int cntr = 0;
FOR_INT32_INPUTS(i) {
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr;
// return(kExpectedValue)
BUILD(r, WASM_I64V(kExpectedValue));
......@@ -42,7 +42,7 @@ WASM_EXEC_TEST(I64Const_many) {
}
WASM_EXEC_TEST(Return_I64) {
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0)));
......@@ -50,7 +50,7 @@ WASM_EXEC_TEST(Return_I64) {
}
WASM_EXEC_TEST(I64Add) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); }
......@@ -63,7 +63,7 @@ WASM_EXEC_TEST(I64Add) {
const int64_t kHasBit33On = 0x100000000;
WASM_EXEC_TEST(Regress5800_Add) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_ADD(
WASM_I64V(0), WASM_I64V(kHasBit33On)))),
WASM_RETURN1(WASM_I32V(0))),
......@@ -72,7 +72,7 @@ WASM_EXEC_TEST(Regress5800_Add) {
}
WASM_EXEC_TEST(I64Sub) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); }
......@@ -80,7 +80,7 @@ WASM_EXEC_TEST(I64Sub) {
}
WASM_EXEC_TEST(Regress5800_Sub) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_SUB(
WASM_I64V(0), WASM_I64V(kHasBit33On)))),
WASM_RETURN1(WASM_I32V(0))),
......@@ -89,7 +89,7 @@ WASM_EXEC_TEST(Regress5800_Sub) {
}
WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
......@@ -100,7 +100,7 @@ WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
......@@ -111,7 +111,7 @@ WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
......@@ -122,7 +122,7 @@ WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
......@@ -134,7 +134,7 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_UINT64_INPUTS(i) {
......@@ -146,7 +146,7 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
......@@ -158,7 +158,7 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64DivS) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
......@@ -174,7 +174,7 @@ WASM_EXEC_TEST(I64DivS) {
}
WASM_EXEC_TEST(I64DivS_Trap) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(0, r.Call(int64_t{0}, int64_t{100}));
CHECK_TRAP64(r.Call(int64_t{100}, int64_t{0}));
......@@ -185,7 +185,7 @@ WASM_EXEC_TEST(I64DivS_Trap) {
WASM_EXEC_TEST(I64DivS_Byzero_Const) {
for (int8_t denom = -2; denom < 8; denom++) {
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(denom)));
for (int64_t val = -7; val < 8; val++) {
if (denom == 0) {
......@@ -198,7 +198,7 @@ WASM_EXEC_TEST(I64DivS_Byzero_Const) {
}
WASM_EXEC_TEST(I64DivU) {
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
......@@ -212,7 +212,7 @@ WASM_EXEC_TEST(I64DivU) {
}
WASM_EXEC_TEST(I64DivU_Trap) {
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(0, r.Call(uint64_t{0}, uint64_t{100}));
CHECK_TRAP64(r.Call(uint64_t{100}, uint64_t{0}));
......@@ -222,7 +222,7 @@ WASM_EXEC_TEST(I64DivU_Trap) {
WASM_EXEC_TEST(I64DivU_Byzero_Const) {
for (uint64_t denom = 0xFFFFFFFFFFFFFFFE; denom < 8; denom++) {
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(denom)));
for (uint64_t val = 0xFFFFFFFFFFFFFFF0; val < 8; val++) {
......@@ -236,7 +236,7 @@ WASM_EXEC_TEST(I64DivU_Byzero_Const) {
}
WASM_EXEC_TEST(I64RemS) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
......@@ -250,7 +250,7 @@ WASM_EXEC_TEST(I64RemS) {
}
WASM_EXEC_TEST(I64RemS_Trap) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(33, r.Call(int64_t{133}, int64_t{100}));
CHECK_EQ(0, r.Call(std::numeric_limits<int64_t>::min(), int64_t{-1}));
......@@ -260,7 +260,7 @@ WASM_EXEC_TEST(I64RemS_Trap) {
}
WASM_EXEC_TEST(I64RemU) {
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
......@@ -274,7 +274,7 @@ WASM_EXEC_TEST(I64RemU) {
}
WASM_EXEC_TEST(I64RemU_Trap) {
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(17, r.Call(uint64_t{217}, uint64_t{100}));
CHECK_TRAP64(r.Call(uint64_t{100}, uint64_t{0}));
......@@ -283,7 +283,7 @@ WASM_EXEC_TEST(I64RemU_Trap) {
}
WASM_EXEC_TEST(I64And) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); }
......@@ -291,7 +291,7 @@ WASM_EXEC_TEST(I64And) {
}
WASM_EXEC_TEST(I64Ior) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ((*i) | (*j), r.Call(*i, *j)); }
......@@ -299,7 +299,7 @@ WASM_EXEC_TEST(I64Ior) {
}
WASM_EXEC_TEST(I64Xor) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); }
......@@ -308,7 +308,7 @@ WASM_EXEC_TEST(I64Xor) {
WASM_EXEC_TEST(I64Shl) {
{
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
......@@ -319,22 +319,22 @@ WASM_EXEC_TEST(I64Shl) {
}
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); }
}
......@@ -342,7 +342,7 @@ WASM_EXEC_TEST(I64Shl) {
WASM_EXEC_TEST(I64ShrU) {
{
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
......@@ -353,22 +353,22 @@ WASM_EXEC_TEST(I64ShrU) {
}
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_mode);
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
}
......@@ -376,7 +376,7 @@ WASM_EXEC_TEST(I64ShrU) {
WASM_EXEC_TEST(I64ShrS) {
{
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
......@@ -387,29 +387,29 @@ WASM_EXEC_TEST(I64ShrS) {
}
}
{
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
}
}
WASM_EXEC_TEST(I64Eq) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -417,7 +417,7 @@ WASM_EXEC_TEST(I64Eq) {
}
WASM_EXEC_TEST(I64Ne) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -425,7 +425,7 @@ WASM_EXEC_TEST(I64Ne) {
}
WASM_EXEC_TEST(I64LtS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -433,7 +433,7 @@ WASM_EXEC_TEST(I64LtS) {
}
WASM_EXEC_TEST(I64LeS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -441,7 +441,7 @@ WASM_EXEC_TEST(I64LeS) {
}
WASM_EXEC_TEST(I64LtU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -449,7 +449,7 @@ WASM_EXEC_TEST(I64LtU) {
}
WASM_EXEC_TEST(I64LeU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -457,7 +457,7 @@ WASM_EXEC_TEST(I64LeU) {
}
WASM_EXEC_TEST(I64GtS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -465,7 +465,7 @@ WASM_EXEC_TEST(I64GtS) {
}
WASM_EXEC_TEST(I64GeS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -473,7 +473,7 @@ WASM_EXEC_TEST(I64GeS) {
}
WASM_EXEC_TEST(I64GtU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -481,7 +481,7 @@ WASM_EXEC_TEST(I64GtU) {
}
WASM_EXEC_TEST(I64GeU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
......@@ -490,20 +490,20 @@ WASM_EXEC_TEST(I64GeU) {
WASM_EXEC_TEST(I32ConvertI64) {
FOR_INT64_INPUTS(i) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(*i)));
CHECK_EQ(static_cast<int32_t>(*i), r.Call());
}
}
WASM_EXEC_TEST(I64SConvertI32) {
WasmRunner<int64_t, int32_t> r(execution_mode);
WasmRunner<int64_t, int32_t> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(I64UConvertI32) {
WasmRunner<int64_t, uint32_t> r(execution_mode);
WasmRunner<int64_t, uint32_t> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)));
FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
}
......@@ -518,7 +518,7 @@ WASM_EXEC_TEST(I64Popcnt) {
{26, 0x1123456782345678},
{38, 0xFFEDCBA09EDCBA09}};
WasmRunner<int64_t, uint64_t> r(execution_mode);
WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
......@@ -526,7 +526,7 @@ WASM_EXEC_TEST(I64Popcnt) {
}
WASM_EXEC_TEST(F32SConvertI64) {
WasmRunner<float, int64_t> r(execution_mode);
WasmRunner<float, int64_t> r(execution_tier);
BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); }
}
......@@ -611,7 +611,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
{0x8000008000000001, 0x5F000001},
{0x8000000000000400, 0x5F000000},
{0x8000000000000401, 0x5F000000}};
WasmRunner<float, uint64_t> r(execution_mode);
WasmRunner<float, uint64_t> r(execution_tier);
BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input));
......@@ -619,7 +619,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
}
WASM_EXEC_TEST(F64SConvertI64) {
WasmRunner<double, int64_t> r(execution_mode);
WasmRunner<double, int64_t> r(execution_tier);
BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); }
}
......@@ -703,7 +703,7 @@ WASM_EXEC_TEST(F64UConvertI64) {
{0x8000008000000001, 0x43E0000010000000},
{0x8000000000000400, 0x43E0000000000000},
{0x8000000000000401, 0x43E0000000000001}};
WasmRunner<double, uint64_t> r(execution_mode);
WasmRunner<double, uint64_t> r(execution_tier);
BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input));
......@@ -711,7 +711,7 @@ WASM_EXEC_TEST(F64UConvertI64) {
}
WASM_EXEC_TEST(I64SConvertF32) {
WasmRunner<int64_t, float> r(execution_mode);
WasmRunner<int64_t, float> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
......@@ -726,7 +726,7 @@ WASM_EXEC_TEST(I64SConvertF32) {
WASM_EXEC_TEST(I64SConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<int64_t, float> r(execution_mode);
WasmRunner<int64_t, float> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int64_t expected;
......@@ -746,7 +746,7 @@ WASM_EXEC_TEST(I64SConvertSatF32) {
}
WASM_EXEC_TEST(I64SConvertF64) {
WasmRunner<int64_t, double> r(execution_mode);
WasmRunner<int64_t, double> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
......@@ -761,7 +761,7 @@ WASM_EXEC_TEST(I64SConvertF64) {
WASM_EXEC_TEST(I64SConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<int64_t, double> r(execution_mode);
WasmRunner<int64_t, double> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
......@@ -781,7 +781,7 @@ WASM_EXEC_TEST(I64SConvertSatF64) {
}
WASM_EXEC_TEST(I64UConvertF32) {
WasmRunner<uint64_t, float> r(execution_mode);
WasmRunner<uint64_t, float> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
......@@ -796,7 +796,7 @@ WASM_EXEC_TEST(I64UConvertF32) {
WASM_EXEC_TEST(I64UConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<int64_t, float> r(execution_mode);
WasmRunner<int64_t, float> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
uint64_t expected;
......@@ -816,7 +816,7 @@ WASM_EXEC_TEST(I64UConvertSatF32) {
}
WASM_EXEC_TEST(I64UConvertF64) {
WasmRunner<uint64_t, double> r(execution_mode);
WasmRunner<uint64_t, double> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
......@@ -831,7 +831,7 @@ WASM_EXEC_TEST(I64UConvertF64) {
WASM_EXEC_TEST(I64UConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<int64_t, double> r(execution_mode);
WasmRunner<int64_t, double> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
......@@ -858,7 +858,7 @@ WASM_EXEC_TEST(CallI64Parameter) {
FunctionSig sig(1, 19, param_types);
for (int i = 0; i < 19; i++) {
if (i == 2 || i == 3) continue;
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(i));
......@@ -889,7 +889,7 @@ WASM_EXEC_TEST(CallI64Return) {
return_types[1] = kWasmI32;
FunctionSig sig(2, 1, return_types);
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(0), WASM_I32V(7));
......@@ -901,32 +901,32 @@ WASM_EXEC_TEST(CallI64Return) {
CHECK_EQ(0xBCD12340000000B, r.Call());
}
void TestI64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
void TestI64Binop(ExecutionTier execution_tier, WasmOpcode opcode,
int64_t expected, int64_t a, int64_t b) {
{
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b)));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
}
}
void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode,
void TestI64Cmp(ExecutionTier execution_tier, WasmOpcode opcode,
int64_t expected, int64_t a, int64_t b) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b)));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
......@@ -934,66 +934,66 @@ void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode,
}
WASM_EXEC_TEST(I64Binops) {
TestI64Binop(execution_mode, kExprI64Add, -5586332274295447011,
TestI64Binop(execution_tier, kExprI64Add, -5586332274295447011,
0x501B72EBABC26847, 0x625DE9793D8F79D6);
TestI64Binop(execution_mode, kExprI64Sub, 9001903251710731490,
TestI64Binop(execution_tier, kExprI64Sub, 9001903251710731490,
0xF24FE6474640002E, 0x7562B6F711991B4C);
TestI64Binop(execution_mode, kExprI64Mul, -4569547818546064176,
TestI64Binop(execution_tier, kExprI64Mul, -4569547818546064176,
0x231A263C2CBC6451, 0xEAD44DE6BD3E23D0);
TestI64Binop(execution_mode, kExprI64Mul, -25963122347507043,
TestI64Binop(execution_tier, kExprI64Mul, -25963122347507043,
0x4DA1FA47C9352B73, 0x91FE82317AA035AF);
TestI64Binop(execution_mode, kExprI64Mul, 7640290486138131960,
TestI64Binop(execution_tier, kExprI64Mul, 7640290486138131960,
0x185731ABE8EEA47C, 0x714EC59F1380D4C2);
TestI64Binop(execution_mode, kExprI64DivS, -91517, 0x93B1190A34DE56A0,
TestI64Binop(execution_tier, kExprI64DivS, -91517, 0x93B1190A34DE56A0,
0x00004D8F68863948);
TestI64Binop(execution_mode, kExprI64DivU, 149016, 0xE15B3727E8A2080A,
TestI64Binop(execution_tier, kExprI64DivU, 149016, 0xE15B3727E8A2080A,
0x0000631BFA72DB8B);
TestI64Binop(execution_mode, kExprI64RemS, -664128064149968,
TestI64Binop(execution_tier, kExprI64RemS, -664128064149968,
0x9A78B4E4FE708692, 0x0003E0B6B3BE7609);
TestI64Binop(execution_mode, kExprI64RemU, 1742040017332765,
TestI64Binop(execution_tier, kExprI64RemU, 1742040017332765,
0x0CE84708C6258C81, 0x000A6FDE82016697);
TestI64Binop(execution_mode, kExprI64And, 2531040582801836054,
TestI64Binop(execution_tier, kExprI64And, 2531040582801836054,
0xAF257D1602644A16, 0x33B290A91A10D997);
TestI64Binop(execution_mode, kExprI64Ior, 8556201506536114940,
TestI64Binop(execution_tier, kExprI64Ior, 8556201506536114940,
0x169D9BE7BD3F0A5C, 0x66BCA28D77AF40E8);
TestI64Binop(execution_mode, kExprI64Xor, -4605655183785456377,
TestI64Binop(execution_tier, kExprI64Xor, -4605655183785456377,
0xB6EA20A5D48E85B8, 0x76FF4DA6C80688BF);
TestI64Binop(execution_mode, kExprI64Shl, -7240704056088331264,
TestI64Binop(execution_tier, kExprI64Shl, -7240704056088331264,
0xEF4DC1ED030E8FFE, 9);
TestI64Binop(execution_mode, kExprI64ShrU, 12500673744059159,
TestI64Binop(execution_tier, kExprI64ShrU, 12500673744059159,
0xB1A52FA7DEEC5D14, 10);
TestI64Binop(execution_mode, kExprI64ShrS, 1725103446999874,
TestI64Binop(execution_tier, kExprI64ShrS, 1725103446999874,
0x3107C791461A112B, 11);
TestI64Binop(execution_mode, kExprI64Ror, -8960135652432576946,
TestI64Binop(execution_tier, kExprI64Ror, -8960135652432576946,
0x73418D1717E4E83A, 12);
TestI64Binop(execution_mode, kExprI64Ror, 7617662827409989779,
TestI64Binop(execution_tier, kExprI64Ror, 7617662827409989779,
0xEBFF67CF0C126D36, 13);
TestI64Binop(execution_mode, kExprI64Rol, -2097714064174346012,
TestI64Binop(execution_tier, kExprI64Rol, -2097714064174346012,
0x43938B8DB0B0F230, 14);
TestI64Binop(execution_mode, kExprI64Rol, 8728493013947314237,
TestI64Binop(execution_tier, kExprI64Rol, 8728493013947314237,
0xE07AF243AC4D219D, 15);
}
WASM_EXEC_TEST(I64Compare) {
TestI64Cmp(execution_mode, kExprI64Eq, 0, 0xB915D8FA494064F0,
TestI64Cmp(execution_tier, kExprI64Eq, 0, 0xB915D8FA494064F0,
0x04D700B2536019A3);
TestI64Cmp(execution_mode, kExprI64Ne, 1, 0xC2FAFAAAB0446CDC,
TestI64Cmp(execution_tier, kExprI64Ne, 1, 0xC2FAFAAAB0446CDC,
0x52A3328F780C97A3);
TestI64Cmp(execution_mode, kExprI64LtS, 0, 0x673636E6306B0578,
TestI64Cmp(execution_tier, kExprI64LtS, 0, 0x673636E6306B0578,
0x028EC9ECA78F7227);
TestI64Cmp(execution_mode, kExprI64LeS, 1, 0xAE5214114B86A0FA,
TestI64Cmp(execution_tier, kExprI64LeS, 1, 0xAE5214114B86A0FA,
0x7C1D21DA3DFD0CCF);
TestI64Cmp(execution_mode, kExprI64LtU, 0, 0x7D52166381EC1CE0,
TestI64Cmp(execution_tier, kExprI64LtU, 0, 0x7D52166381EC1CE0,
0x59F4A6A9E78CD3D8);
TestI64Cmp(execution_mode, kExprI64LeU, 1, 0xE4169A385C7EA0E0,
TestI64Cmp(execution_tier, kExprI64LeU, 1, 0xE4169A385C7EA0E0,
0xFBDBED2C8781E5BC);
TestI64Cmp(execution_mode, kExprI64GtS, 0, 0x9D08FF8FB5F42E81,
TestI64Cmp(execution_tier, kExprI64GtS, 0, 0x9D08FF8FB5F42E81,
0xD4E5C9D7FE09F621);
TestI64Cmp(execution_mode, kExprI64GeS, 1, 0x78DA3B2F73264E0F,
TestI64Cmp(execution_tier, kExprI64GeS, 1, 0x78DA3B2F73264E0F,
0x6FE5E2A67C501CBE);
TestI64Cmp(execution_mode, kExprI64GtU, 0, 0x8F691284E44F7DA9,
TestI64Cmp(execution_tier, kExprI64GtU, 0, 0x8F691284E44F7DA9,
0xD5EA9BC1EE149192);
TestI64Cmp(execution_mode, kExprI64GeU, 0, 0x0886A0C58C7AA224,
TestI64Cmp(execution_tier, kExprI64GeU, 0, 0x0886A0C58C7AA224,
0x5DDBE5A81FD7EE47);
}
......@@ -1035,7 +1035,7 @@ WASM_EXEC_TEST(I64Clz) {
{62, 0x0000000000000002}, {63, 0x0000000000000001},
{64, 0x0000000000000000}};
WasmRunner<int64_t, uint64_t> r(execution_mode);
WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_CLZ(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
......@@ -1080,7 +1080,7 @@ WASM_EXEC_TEST(I64Ctz) {
{2, 0x000000009AFDBC84}, {1, 0x000000009AFDBC82},
{0, 0x000000009AFDBC81}};
WasmRunner<int64_t, uint64_t> r(execution_mode);
WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_CTZ(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
......@@ -1097,7 +1097,7 @@ WASM_EXEC_TEST(I64Popcnt2) {
{26, 0x1123456782345678},
{38, 0xFFEDCBA09EDCBA09}};
WasmRunner<int64_t, uint64_t> r(execution_mode);
WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
......@@ -1107,25 +1107,25 @@ WASM_EXEC_TEST(I64Popcnt2) {
// Test the WasmRunner with an Int64 return value and different numbers of
// Int64 parameters.
WASM_EXEC_TEST(I64WasmRunner) {
{FOR_INT64_INPUTS(i){WasmRunner<int64_t> r(execution_mode);
{FOR_INT64_INPUTS(i){WasmRunner<int64_t> r(execution_tier);
BUILD(r, WASM_I64V(*i));
CHECK_EQ(*i, r.Call());
}
}
{
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0));
FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
{
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i ^ *j, r.Call(*i, *j)); }
}
}
{
WasmRunner<int64_t, int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))));
FOR_INT64_INPUTS(i) {
......@@ -1137,7 +1137,7 @@ WASM_EXEC_TEST(I64WasmRunner) {
}
}
{
WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
WASM_I64_XOR(WASM_GET_LOCAL(1),
WASM_I64_XOR(WASM_GET_LOCAL(2),
......@@ -1154,7 +1154,7 @@ WASM_EXEC_TEST(I64WasmRunner) {
}
WASM_EXEC_TEST(Call_Int64Sub) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
// Build the target function.
TestSignatures sigs;
WasmFunctionCompiler& t = r.NewFunction(sigs.l_ll());
......@@ -1183,7 +1183,7 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
kExprI64LoadMem};
for (size_t m = 0; m < arraysize(loads); m++) {
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
byte* memory = r.builder().AddMemoryElems<byte>(kWasmPageSize);
byte code[] = {
......@@ -1222,7 +1222,7 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
WASM_EXEC_TEST(I64ReinterpretF64) {
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
......@@ -1237,7 +1237,7 @@ WASM_EXEC_TEST(I64ReinterpretF64) {
}
WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) {
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
BUILD(r, WASM_I64_REINTERPRET_F64(WASM_SEQ(kExprF64Const, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0x7F)));
......@@ -1246,7 +1246,7 @@ WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) {
}
WASM_EXEC_TEST(F64ReinterpretI64) {
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
......@@ -1262,7 +1262,7 @@ WASM_EXEC_TEST(F64ReinterpretI64) {
}
WASM_EXEC_TEST(LoadMemI64) {
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
r.builder().RandomizeMemory(1111);
......@@ -1281,7 +1281,7 @@ WASM_EXEC_TEST(LoadMemI64) {
WASM_EXEC_TEST(LoadMemI64_alignment) {
for (byte alignment = 0; alignment <= 3; alignment++) {
WasmRunner<int64_t> r(execution_mode);
WasmRunner<int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
r.builder().RandomizeMemory(1111);
......@@ -1302,7 +1302,7 @@ WASM_EXEC_TEST(LoadMemI64_alignment) {
WASM_EXEC_TEST(MemI64_Sum) {
const int kNumElems = 20;
WasmRunner<uint64_t, int32_t> r(execution_mode);
WasmRunner<uint64_t, int32_t> r(execution_tier);
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
const byte kSum = r.AllocateLocal(kWasmI64);
......@@ -1334,7 +1334,7 @@ WASM_EXEC_TEST(StoreMemI64_alignment) {
const int64_t kWritten = 0x12345678ABCD0011ll;
for (byte i = 0; i <= 3; i++) {
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i,
......@@ -1349,7 +1349,7 @@ WASM_EXEC_TEST(StoreMemI64_alignment) {
}
WASM_EXEC_TEST(I64Global) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int64_t* global = r.builder().AddGlobal<int64_t>();
// global = global + p0
BUILD(r, WASM_SET_GLOBAL(
......@@ -1366,7 +1366,7 @@ WASM_EXEC_TEST(I64Global) {
}
WASM_EXEC_TEST(I64Eqz) {
WasmRunner<int32_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) {
......@@ -1376,7 +1376,7 @@ WASM_EXEC_TEST(I64Eqz) {
}
WASM_EXEC_TEST(I64Ror) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
......@@ -1388,7 +1388,7 @@ WASM_EXEC_TEST(I64Ror) {
}
WASM_EXEC_TEST(I64Rol) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
......@@ -1409,7 +1409,7 @@ WASM_EXEC_TEST(StoreMem_offset_oob_i64) {
constexpr size_t num_bytes = kWasmPageSize;
for (size_t m = 0; m < arraysize(machineTypes); m++) {
WasmRunner<int32_t, uint32_t> r(execution_mode);
WasmRunner<int32_t, uint32_t> r(execution_tier);
byte* memory = r.builder().AddMemoryElems<byte>(num_bytes);
r.builder().RandomizeMemory(1119 + static_cast<int>(m));
......@@ -1436,7 +1436,7 @@ WASM_EXEC_TEST(Store_i64_narrowed) {
stored_size_in_bytes = std::max(1, stored_size_in_bytes * 2);
constexpr int kBytes = 24;
uint8_t expected_memory[kBytes] = {0};
WasmRunner<int32_t, int32_t, int64_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int64_t> r(execution_tier);
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
constexpr uint64_t kPattern = 0x0123456789abcdef;
......@@ -1459,14 +1459,14 @@ WASM_EXEC_TEST(Store_i64_narrowed) {
}
WASM_EXEC_TEST(UnalignedInt64Load) {
WasmRunner<uint64_t> r(execution_mode);
WasmRunner<uint64_t> r(execution_tier);
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_ONE, 3));
r.Call();
}
WASM_EXEC_TEST(UnalignedInt64Store) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ONE, 3,
WASM_I64V_1(1)),
......@@ -1480,12 +1480,12 @@ WASM_EXEC_TEST(UnalignedInt64Store) {
for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \
} while (false)
static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) {
// Make sure we don't run out of registers when compiling indirect calls
// with many many parameters.
TestSignatures sigs;
for (byte num_params = 0; num_params < 40; num_params++) {
WasmRunner<void> r(mode);
WasmRunner<void> r(tier);
FunctionSig* sig = sigs.many(r.zone(), kWasmStmt, param, num_params);
r.builder().AddSignature(sig);
......@@ -1506,10 +1506,10 @@ static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
}
WASM_EXEC_TEST(Compile_Wasm_CallIndirect_Many_i64) {
CompileCallIndirectMany(execution_mode, kWasmI64);
CompileCallIndirectMany(execution_tier, kWasmI64);
}
static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) {
const int kExpected = 6333;
const int kElemSize = 8;
TestSignatures sigs;
......@@ -1525,7 +1525,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
for (int which = 0; which < num_params; which++) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
MachineType* memtypes = &mixed[start];
MachineType result = memtypes[which];
......@@ -1584,13 +1584,13 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
}
}
WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); }
WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); }
WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); }
WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); }
WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_tier, 0); }
WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_tier, 1); }
WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_tier, 2); }
WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_tier, 3); }
WASM_EXEC_TEST(Regress5874) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, kExprI64Const, 0x00, // --
......@@ -1604,7 +1604,7 @@ WASM_EXEC_TEST(Regress5874) {
WASM_EXEC_TEST(Regression_6858) {
// WasmRunner with 5 params and returns, which is the maximum.
WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
int64_t dividend = 15;
int64_t divisor = 0;
......
......@@ -20,7 +20,7 @@ namespace internal {
namespace wasm {
WASM_EXEC_TEST(Int32AsmjsDivS) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
......@@ -32,7 +32,7 @@ WASM_EXEC_TEST(Int32AsmjsDivS) {
}
WASM_EXEC_TEST(Int32AsmjsRemS) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
......@@ -44,7 +44,7 @@ WASM_EXEC_TEST(Int32AsmjsRemS) {
}
WASM_EXEC_TEST(Int32AsmjsDivU) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
......@@ -56,7 +56,7 @@ WASM_EXEC_TEST(Int32AsmjsDivU) {
}
WASM_EXEC_TEST(Int32AsmjsRemU) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
......@@ -68,7 +68,7 @@ WASM_EXEC_TEST(Int32AsmjsRemU) {
}
WASM_EXEC_TEST(I32AsmjsSConvertF32) {
WasmRunner<int32_t, float> r(execution_mode);
WasmRunner<int32_t, float> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0)));
......@@ -79,7 +79,7 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) {
}
WASM_EXEC_TEST(I32AsmjsSConvertF64) {
WasmRunner<int32_t, double> r(execution_mode);
WasmRunner<int32_t, double> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0)));
......@@ -90,7 +90,7 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) {
}
WASM_EXEC_TEST(I32AsmjsUConvertF32) {
WasmRunner<uint32_t, float> r(execution_mode);
WasmRunner<uint32_t, float> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0)));
......@@ -101,7 +101,7 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) {
}
WASM_EXEC_TEST(I32AsmjsUConvertF64) {
WasmRunner<uint32_t, double> r(execution_mode);
WasmRunner<uint32_t, double> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0)));
......@@ -112,7 +112,7 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) {
}
WASM_EXEC_TEST(LoadMemI32_oob_asm) {
WasmRunner<int32_t, uint32_t> r(execution_mode);
WasmRunner<int32_t, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
int32_t* memory = r.builder().AddMemoryElems<int32_t>(8);
r.builder().RandomizeMemory(1112);
......@@ -132,7 +132,7 @@ WASM_EXEC_TEST(LoadMemI32_oob_asm) {
}
WASM_EXEC_TEST(LoadMemF32_oob_asm) {
WasmRunner<float, uint32_t> r(execution_mode);
WasmRunner<float, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
float* memory = r.builder().AddMemoryElems<float>(8);
r.builder().RandomizeMemory(1112);
......@@ -152,7 +152,7 @@ WASM_EXEC_TEST(LoadMemF32_oob_asm) {
}
WASM_EXEC_TEST(LoadMemF64_oob_asm) {
WasmRunner<double, uint32_t> r(execution_mode);
WasmRunner<double, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
double* memory = r.builder().AddMemoryElems<double>(8);
r.builder().RandomizeMemory(1112);
......@@ -174,7 +174,7 @@ WASM_EXEC_TEST(LoadMemF64_oob_asm) {
}
WASM_EXEC_TEST(StoreMemI32_oob_asm) {
WasmRunner<int32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<int32_t, uint32_t, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
int32_t* memory = r.builder().AddMemoryElems<int32_t>(8);
r.builder().RandomizeMemory(1112);
......
......@@ -10,10 +10,10 @@ namespace internal {
namespace wasm {
namespace test_run_wasm_atomics {
void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint32BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
r.builder().SetHasSharedMemory();
......@@ -33,28 +33,28 @@ void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I32AtomicAdd) {
RunU32BinOp(execution_mode, kExprI32AtomicAdd, Add);
RunU32BinOp(execution_tier, kExprI32AtomicAdd, Add);
}
WASM_EXEC_TEST(I32AtomicSub) {
RunU32BinOp(execution_mode, kExprI32AtomicSub, Sub);
RunU32BinOp(execution_tier, kExprI32AtomicSub, Sub);
}
WASM_EXEC_TEST(I32AtomicAnd) {
RunU32BinOp(execution_mode, kExprI32AtomicAnd, And);
RunU32BinOp(execution_tier, kExprI32AtomicAnd, And);
}
WASM_EXEC_TEST(I32AtomicOr) {
RunU32BinOp(execution_mode, kExprI32AtomicOr, Or);
RunU32BinOp(execution_tier, kExprI32AtomicOr, Or);
}
WASM_EXEC_TEST(I32AtomicXor) {
RunU32BinOp(execution_mode, kExprI32AtomicXor, Xor);
RunU32BinOp(execution_tier, kExprI32AtomicXor, Xor);
}
WASM_EXEC_TEST(I32AtomicExchange) {
RunU32BinOp(execution_mode, kExprI32AtomicExchange, Exchange);
RunU32BinOp(execution_tier, kExprI32AtomicExchange, Exchange);
}
void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
Uint16BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t> r(mode);
WasmRunner<uint32_t, uint32_t> r(tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -74,28 +74,28 @@ void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I32AtomicAdd16U) {
RunU16BinOp(execution_mode, kExprI32AtomicAdd16U, Add);
RunU16BinOp(execution_tier, kExprI32AtomicAdd16U, Add);
}
WASM_EXEC_TEST(I32AtomicSub16U) {
RunU16BinOp(execution_mode, kExprI32AtomicSub16U, Sub);
RunU16BinOp(execution_tier, kExprI32AtomicSub16U, Sub);
}
WASM_EXEC_TEST(I32AtomicAnd16U) {
RunU16BinOp(execution_mode, kExprI32AtomicAnd16U, And);
RunU16BinOp(execution_tier, kExprI32AtomicAnd16U, And);
}
WASM_EXEC_TEST(I32AtomicOr16U) {
RunU16BinOp(execution_mode, kExprI32AtomicOr16U, Or);
RunU16BinOp(execution_tier, kExprI32AtomicOr16U, Or);
}
WASM_EXEC_TEST(I32AtomicXor16U) {
RunU16BinOp(execution_mode, kExprI32AtomicXor16U, Xor);
RunU16BinOp(execution_tier, kExprI32AtomicXor16U, Xor);
}
WASM_EXEC_TEST(I32AtomicExchange16U) {
RunU16BinOp(execution_mode, kExprI32AtomicExchange16U, Exchange);
RunU16BinOp(execution_tier, kExprI32AtomicExchange16U, Exchange);
}
void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint8BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
......@@ -114,27 +114,27 @@ void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I32AtomicAdd8U) {
RunU8BinOp(execution_mode, kExprI32AtomicAdd8U, Add);
RunU8BinOp(execution_tier, kExprI32AtomicAdd8U, Add);
}
WASM_EXEC_TEST(I32AtomicSub8U) {
RunU8BinOp(execution_mode, kExprI32AtomicSub8U, Sub);
RunU8BinOp(execution_tier, kExprI32AtomicSub8U, Sub);
}
WASM_EXEC_TEST(I32AtomicAnd8U) {
RunU8BinOp(execution_mode, kExprI32AtomicAnd8U, And);
RunU8BinOp(execution_tier, kExprI32AtomicAnd8U, And);
}
WASM_EXEC_TEST(I32AtomicOr8U) {
RunU8BinOp(execution_mode, kExprI32AtomicOr8U, Or);
RunU8BinOp(execution_tier, kExprI32AtomicOr8U, Or);
}
WASM_EXEC_TEST(I32AtomicXor8U) {
RunU8BinOp(execution_mode, kExprI32AtomicXor8U, Xor);
RunU8BinOp(execution_tier, kExprI32AtomicXor8U, Xor);
}
WASM_EXEC_TEST(I32AtomicExchange8U) {
RunU8BinOp(execution_mode, kExprI32AtomicExchange8U, Exchange);
RunU8BinOp(execution_tier, kExprI32AtomicExchange8U, Exchange);
}
WASM_EXEC_TEST(I32AtomicCompareExchange) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
......@@ -155,7 +155,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange) {
WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -177,7 +177,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r,
......@@ -198,7 +198,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
WASM_EXEC_TEST(I32AtomicLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t> r(execution_mode);
WasmRunner<uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
......@@ -214,7 +214,7 @@ WASM_EXEC_TEST(I32AtomicLoad) {
WASM_EXEC_TEST(I32AtomicLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t> r(execution_mode);
WasmRunner<uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -230,7 +230,7 @@ WASM_EXEC_TEST(I32AtomicLoad16U) {
WASM_EXEC_TEST(I32AtomicLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t> r(execution_mode);
WasmRunner<uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad8U, WASM_ZERO,
......@@ -245,7 +245,7 @@ WASM_EXEC_TEST(I32AtomicLoad8U) {
WASM_EXEC_TEST(I32AtomicStoreLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
......@@ -265,7 +265,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad) {
WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -286,7 +286,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
......@@ -305,7 +305,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
WASM_EXEC_TEST(I32AtomicStoreParameter) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
r.builder().SetHasSharedMemory();
......
......@@ -10,10 +10,10 @@ namespace internal {
namespace wasm {
namespace test_run_wasm_atomics_64 {
void RunU64BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
void RunU64BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint64BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
r.builder().SetHasSharedMemory();
......@@ -33,28 +33,28 @@ void RunU64BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd) {
RunU64BinOp(execution_mode, kExprI64AtomicAdd, Add);
RunU64BinOp(execution_tier, kExprI64AtomicAdd, Add);
}
WASM_EXEC_TEST(I64AtomicSub) {
RunU64BinOp(execution_mode, kExprI64AtomicSub, Sub);
RunU64BinOp(execution_tier, kExprI64AtomicSub, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd) {
RunU64BinOp(execution_mode, kExprI64AtomicAnd, And);
RunU64BinOp(execution_tier, kExprI64AtomicAnd, And);
}
WASM_EXEC_TEST(I64AtomicOr) {
RunU64BinOp(execution_mode, kExprI64AtomicOr, Or);
RunU64BinOp(execution_tier, kExprI64AtomicOr, Or);
}
WASM_EXEC_TEST(I64AtomicXor) {
RunU64BinOp(execution_mode, kExprI64AtomicXor, Xor);
RunU64BinOp(execution_tier, kExprI64AtomicXor, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange) {
RunU64BinOp(execution_mode, kExprI64AtomicExchange, Exchange);
RunU64BinOp(execution_tier, kExprI64AtomicExchange, Exchange);
}
void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint32BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
r.builder().SetHasSharedMemory();
......@@ -74,28 +74,28 @@ void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd32U) {
RunU32BinOp(execution_mode, kExprI64AtomicAdd32U, Add);
RunU32BinOp(execution_tier, kExprI64AtomicAdd32U, Add);
}
WASM_EXEC_TEST(I64AtomicSub32U) {
RunU32BinOp(execution_mode, kExprI64AtomicSub32U, Sub);
RunU32BinOp(execution_tier, kExprI64AtomicSub32U, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd32U) {
RunU32BinOp(execution_mode, kExprI64AtomicAnd32U, And);
RunU32BinOp(execution_tier, kExprI64AtomicAnd32U, And);
}
WASM_EXEC_TEST(I64AtomicOr32U) {
RunU32BinOp(execution_mode, kExprI64AtomicOr32U, Or);
RunU32BinOp(execution_tier, kExprI64AtomicOr32U, Or);
}
WASM_EXEC_TEST(I64AtomicXor32U) {
RunU32BinOp(execution_mode, kExprI64AtomicXor32U, Xor);
RunU32BinOp(execution_tier, kExprI64AtomicXor32U, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange32U) {
RunU32BinOp(execution_mode, kExprI64AtomicExchange32U, Exchange);
RunU32BinOp(execution_tier, kExprI64AtomicExchange32U, Exchange);
}
void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
Uint16BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(mode);
WasmRunner<uint64_t, uint64_t> r(tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -115,28 +115,28 @@ void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd16U) {
RunU16BinOp(execution_mode, kExprI64AtomicAdd16U, Add);
RunU16BinOp(execution_tier, kExprI64AtomicAdd16U, Add);
}
WASM_EXEC_TEST(I64AtomicSub16U) {
RunU16BinOp(execution_mode, kExprI64AtomicSub16U, Sub);
RunU16BinOp(execution_tier, kExprI64AtomicSub16U, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd16U) {
RunU16BinOp(execution_mode, kExprI64AtomicAnd16U, And);
RunU16BinOp(execution_tier, kExprI64AtomicAnd16U, And);
}
WASM_EXEC_TEST(I64AtomicOr16U) {
RunU16BinOp(execution_mode, kExprI64AtomicOr16U, Or);
RunU16BinOp(execution_tier, kExprI64AtomicOr16U, Or);
}
WASM_EXEC_TEST(I64AtomicXor16U) {
RunU16BinOp(execution_mode, kExprI64AtomicXor16U, Xor);
RunU16BinOp(execution_tier, kExprI64AtomicXor16U, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange16U) {
RunU16BinOp(execution_mode, kExprI64AtomicExchange16U, Exchange);
RunU16BinOp(execution_tier, kExprI64AtomicExchange16U, Exchange);
}
void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint8BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
......@@ -155,27 +155,27 @@ void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd8U) {
RunU8BinOp(execution_mode, kExprI64AtomicAdd8U, Add);
RunU8BinOp(execution_tier, kExprI64AtomicAdd8U, Add);
}
WASM_EXEC_TEST(I64AtomicSub8U) {
RunU8BinOp(execution_mode, kExprI64AtomicSub8U, Sub);
RunU8BinOp(execution_tier, kExprI64AtomicSub8U, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd8U) {
RunU8BinOp(execution_mode, kExprI64AtomicAnd8U, And);
RunU8BinOp(execution_tier, kExprI64AtomicAnd8U, And);
}
WASM_EXEC_TEST(I64AtomicOr8U) {
RunU8BinOp(execution_mode, kExprI64AtomicOr8U, Or);
RunU8BinOp(execution_tier, kExprI64AtomicOr8U, Or);
}
WASM_EXEC_TEST(I64AtomicXor8U) {
RunU8BinOp(execution_mode, kExprI64AtomicXor8U, Xor);
RunU8BinOp(execution_tier, kExprI64AtomicXor8U, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange8U) {
RunU8BinOp(execution_mode, kExprI64AtomicExchange8U, Exchange);
RunU8BinOp(execution_tier, kExprI64AtomicExchange8U, Exchange);
}
WASM_EXEC_TEST(I64AtomicCompareExchange) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
......@@ -196,7 +196,7 @@ WASM_EXEC_TEST(I64AtomicCompareExchange) {
WASM_EXEC_TEST(I64AtomicCompareExchange32U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
......@@ -218,7 +218,7 @@ WASM_EXEC_TEST(I64AtomicCompareExchange32U) {
WASM_EXEC_TEST(I64AtomicCompareExchange16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -240,7 +240,7 @@ WASM_EXEC_TEST(I64AtomicCompareExchange16U) {
WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r,
......@@ -260,7 +260,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
WASM_EXEC_TEST(I64AtomicLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t> r(execution_mode);
WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
......@@ -276,7 +276,7 @@ WASM_EXEC_TEST(I64AtomicLoad) {
WASM_EXEC_TEST(I64AtomicLoad32U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t> r(execution_mode);
WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
......@@ -292,7 +292,7 @@ WASM_EXEC_TEST(I64AtomicLoad32U) {
WASM_EXEC_TEST(I64AtomicLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t> r(execution_mode);
WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -308,7 +308,7 @@ WASM_EXEC_TEST(I64AtomicLoad16U) {
WASM_EXEC_TEST(I64AtomicLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t> r(execution_mode);
WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r, WASM_ATOMICS_LOAD_OP(kExprI64AtomicLoad8U, WASM_ZERO,
......@@ -323,7 +323,7 @@ WASM_EXEC_TEST(I64AtomicLoad8U) {
WASM_EXEC_TEST(I64AtomicStoreLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
......@@ -343,7 +343,7 @@ WASM_EXEC_TEST(I64AtomicStoreLoad) {
WASM_EXEC_TEST(I64AtomicStoreLoad32U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
......@@ -364,7 +364,7 @@ WASM_EXEC_TEST(I64AtomicStoreLoad32U) {
WASM_EXEC_TEST(I64AtomicStoreLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
......@@ -385,7 +385,7 @@ WASM_EXEC_TEST(I64AtomicStoreLoad16U) {
WASM_EXEC_TEST(I64AtomicStoreLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint64_t, uint64_t> r(execution_mode);
WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
......
......@@ -22,7 +22,7 @@ namespace wasm {
namespace test_run_wasm_interpreter {
TEST(Run_WasmInt8Const_i) {
WasmRunner<int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
const byte kExpectedValue = 109;
// return(kExpectedValue)
BUILD(r, WASM_I32V_2(kExpectedValue));
......@@ -30,14 +30,14 @@ TEST(Run_WasmInt8Const_i) {
}
TEST(Run_WasmIfElse) {
WasmRunner<int32_t, int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, int32_t> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9), WASM_I32V_1(10)));
CHECK_EQ(10, r.Call(0));
CHECK_EQ(9, r.Call(1));
}
TEST(Run_WasmIfReturn) {
WasmRunner<int32_t, int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, int32_t> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_RETURN1(WASM_I32V_2(77))),
WASM_I32V_2(65));
CHECK_EQ(65, r.Call(0));
......@@ -53,7 +53,7 @@ TEST(Run_WasmNopsN) {
code[nops] = kExprI32Const;
code[nops + 1] = expected;
WasmRunner<int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + nops + 2);
CHECK_EQ(expected, r.Call());
}
......@@ -76,7 +76,7 @@ TEST(Run_WasmConstsN) {
}
}
WasmRunner<int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + (count * 3));
CHECK_EQ(expected, r.Call());
}
......@@ -95,7 +95,7 @@ TEST(Run_WasmBlocksN) {
code[2 + nops + 1] = expected;
code[2 + nops + 2] = kExprEnd;
WasmRunner<int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + nops + kExtra);
CHECK_EQ(expected, r.Call());
}
......@@ -120,7 +120,7 @@ TEST(Run_WasmBlockBreakN) {
code[2 + index + 2] = kExprBr;
code[2 + index + 3] = 0;
WasmRunner<int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + kMaxNops + kExtra);
CHECK_EQ(expected, r.Call());
}
......@@ -128,7 +128,7 @@ TEST(Run_WasmBlockBreakN) {
}
TEST(Run_Wasm_nested_ifs_i) {
WasmRunner<int32_t, int32_t, int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, int32_t, int32_t> r(ExecutionTier::kInterpreter);
BUILD(
r,
......@@ -178,7 +178,7 @@ TEST(Breakpoint_I32Add) {
Find(code, sizeof(code), kNumBreakpoints, kExprGetLocal, kExprGetLocal,
kExprI32Add);
WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + arraysize(code));
......@@ -217,7 +217,7 @@ TEST(Step_I32Mul) {
static const int kTraceLength = 4;
byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + arraysize(code));
......@@ -255,7 +255,7 @@ TEST(Breakpoint_I32And_disable) {
std::unique_ptr<int[]> offsets =
Find(code, sizeof(code), kNumBreakpoints, kExprI32And);
WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + arraysize(code));
......@@ -293,14 +293,14 @@ TEST(Breakpoint_I32And_disable) {
TEST(GrowMemory) {
{
WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
r.builder().SetMaxMemPages(10);
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
CHECK_EQ(1, r.Call(1));
}
{
WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
r.builder().SetMaxMemPages(10);
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
......@@ -311,7 +311,7 @@ TEST(GrowMemory) {
TEST(GrowMemoryPreservesData) {
int32_t index = 16;
int32_t value = 2335;
WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index),
WASM_I32V(value)),
......@@ -322,7 +322,7 @@ TEST(GrowMemoryPreservesData) {
TEST(GrowMemoryInvalidSize) {
// Grow memory by an invalid amount without initial memory.
WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
CHECK_EQ(-1, r.Call(1048575));
......@@ -330,7 +330,7 @@ TEST(GrowMemoryInvalidSize) {
TEST(TestPossibleNondeterminism) {
{
WasmRunner<int32_t, float> r(kExecuteInterpreter);
WasmRunner<int32_t, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_I32_REINTERPRET_F32(WASM_GET_LOCAL(0)));
r.Call(1048575.5f);
CHECK(!r.possible_nondeterminism());
......@@ -338,7 +338,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
WasmRunner<int64_t, double> r(kExecuteInterpreter);
WasmRunner<int64_t, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_I64_REINTERPRET_F64(WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
......@@ -346,7 +346,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
WasmRunner<float, float> r(kExecuteInterpreter);
WasmRunner<float, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_COPYSIGN(WASM_F32(42.0f), WASM_GET_LOCAL(0)));
r.Call(16.0f);
CHECK(!r.possible_nondeterminism());
......@@ -354,7 +354,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
WasmRunner<double, double> r(kExecuteInterpreter);
WasmRunner<double, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_COPYSIGN(WASM_F64(42.0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
......@@ -363,7 +363,7 @@ TEST(TestPossibleNondeterminism) {
}
{
int32_t index = 16;
WasmRunner<int32_t, float> r(kExecuteInterpreter);
WasmRunner<int32_t, float> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_STORE_MEM(MachineType::Float32(), WASM_I32V(index),
WASM_GET_LOCAL(0)),
......@@ -375,7 +375,7 @@ TEST(TestPossibleNondeterminism) {
}
{
int32_t index = 16;
WasmRunner<int32_t, double> r(kExecuteInterpreter);
WasmRunner<int32_t, double> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_I32V(index),
WASM_GET_LOCAL(0)),
......@@ -386,7 +386,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
WasmRunner<float, float> r(kExecuteInterpreter);
WasmRunner<float, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(1048575.5f);
CHECK(!r.possible_nondeterminism());
......@@ -394,7 +394,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(r.possible_nondeterminism());
}
{
WasmRunner<double, double> r(kExecuteInterpreter);
WasmRunner<double, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
......@@ -402,7 +402,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(r.possible_nondeterminism());
}
{
WasmRunner<int32_t, float> r(kExecuteInterpreter);
WasmRunner<int32_t, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
......@@ -410,7 +410,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
WasmRunner<int32_t, double> r(kExecuteInterpreter);
WasmRunner<int32_t, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
......@@ -418,7 +418,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
WasmRunner<float, float> r(kExecuteInterpreter);
WasmRunner<float, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(1048575.5f);
CHECK(!r.possible_nondeterminism());
......@@ -426,7 +426,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(r.possible_nondeterminism());
}
{
WasmRunner<double, double> r(kExecuteInterpreter);
WasmRunner<double, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
......@@ -436,7 +436,7 @@ TEST(TestPossibleNondeterminism) {
}
TEST(WasmInterpreterActivations) {
WasmRunner<void> r(kExecuteInterpreter);
WasmRunner<void> r(ExecutionTier::kInterpreter);
Isolate* isolate = r.main_isolate();
BUILD(r, WASM_NOP);
......@@ -466,7 +466,7 @@ TEST(WasmInterpreterActivations) {
}
TEST(InterpreterLoadWithoutMemory) {
WasmRunner<int32_t, int32_t> r(kExecuteInterpreter);
WasmRunner<int32_t, int32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(0);
BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0)));
CHECK_TRAP32(r.Call(0));
......
......@@ -96,7 +96,7 @@ void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a,
} // namespace
WASM_EXEC_TEST(Run_Int32Sub_jswrapped) {
WasmRunner<int, int, int> r(execution_mode);
WasmRunner<int, int, int> r(execution_tier);
BUILD(r, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
......@@ -105,7 +105,7 @@ WASM_EXEC_TEST(Run_Int32Sub_jswrapped) {
}
WASM_EXEC_TEST(Run_Float32Div_jswrapped) {
WasmRunner<float, float, float> r(execution_mode);
WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
......@@ -114,7 +114,7 @@ WASM_EXEC_TEST(Run_Float32Div_jswrapped) {
}
WASM_EXEC_TEST(Run_Float64Add_jswrapped) {
WasmRunner<double, double, double> r(execution_mode);
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
......@@ -123,7 +123,7 @@ WASM_EXEC_TEST(Run_Float64Add_jswrapped) {
}
WASM_EXEC_TEST(Run_I32Popcount_jswrapped) {
WasmRunner<int, int> r(execution_mode);
WasmRunner<int, int> r(execution_tier);
BUILD(r, WASM_I32_POPCNT(WASM_GET_LOCAL(0)));
Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
......@@ -140,7 +140,7 @@ WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Local<v8::Function>::Cast(CompileRun(source))));
ManuallyImportedJSFunction import = {sigs.i_i(), js_function};
WasmRunner<int, int> r(execution_mode, &import);
WasmRunner<int, int> r(execution_tier, &import);
uint32_t js_index = 0;
WasmFunctionCompiler& t = r.NewFunction(sigs.i_i());
......@@ -153,7 +153,7 @@ WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
EXPECT_CALL(-666666801, jsfunc, -666666900, -1);
}
void RunJSSelectTest(WasmExecutionMode mode, int which) {
void RunJSSelectTest(ExecutionTier tier, int which) {
const int kMaxParams = 8;
PredictableInputValues inputs(0x100);
ValueType type = kWasmF64;
......@@ -164,7 +164,7 @@ void RunJSSelectTest(WasmExecutionMode mode, int which) {
FunctionSig sig(1, num_params, types);
ManuallyImportedJSFunction import = CreateJSSelector(&sig, which);
WasmRunner<void> r(mode, &import);
WasmRunner<void> r(tier, &import);
uint32_t js_index = 0;
WasmFunctionCompiler& t = r.NewFunction(&sig);
......@@ -191,45 +191,45 @@ void RunJSSelectTest(WasmExecutionMode mode, int which) {
WASM_EXEC_TEST(Run_JSSelect_0) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 0);
RunJSSelectTest(execution_tier, 0);
}
WASM_EXEC_TEST(Run_JSSelect_1) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 1);
RunJSSelectTest(execution_tier, 1);
}
WASM_EXEC_TEST(Run_JSSelect_2) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 2);
RunJSSelectTest(execution_tier, 2);
}
WASM_EXEC_TEST(Run_JSSelect_3) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 3);
RunJSSelectTest(execution_tier, 3);
}
WASM_EXEC_TEST(Run_JSSelect_4) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 4);
RunJSSelectTest(execution_tier, 4);
}
WASM_EXEC_TEST(Run_JSSelect_5) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 5);
RunJSSelectTest(execution_tier, 5);
}
WASM_EXEC_TEST(Run_JSSelect_6) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 6);
RunJSSelectTest(execution_tier, 6);
}
WASM_EXEC_TEST(Run_JSSelect_7) {
CcTest::InitializeVM();
RunJSSelectTest(execution_mode, 7);
RunJSSelectTest(execution_tier, 7);
}
void RunWASMSelectTest(WasmExecutionMode mode, int which) {
void RunWASMSelectTest(ExecutionTier tier, int which) {
PredictableInputValues inputs(0x200);
Isolate* isolate = CcTest::InitIsolateOnce();
const int kMaxParams = 8;
......@@ -239,7 +239,7 @@ void RunWASMSelectTest(WasmExecutionMode mode, int which) {
type, type, type, type};
FunctionSig sig(1, num_params, types);
WasmRunner<void> r(mode);
WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
......@@ -262,46 +262,45 @@ void RunWASMSelectTest(WasmExecutionMode mode, int which) {
WASM_EXEC_TEST(Run_WASMSelect_0) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 0);
RunWASMSelectTest(execution_tier, 0);
}
WASM_EXEC_TEST(Run_WASMSelect_1) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 1);
RunWASMSelectTest(execution_tier, 1);
}
WASM_EXEC_TEST(Run_WASMSelect_2) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 2);
RunWASMSelectTest(execution_tier, 2);
}
WASM_EXEC_TEST(Run_WASMSelect_3) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 3);
RunWASMSelectTest(execution_tier, 3);
}
WASM_EXEC_TEST(Run_WASMSelect_4) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 4);
RunWASMSelectTest(execution_tier, 4);
}
WASM_EXEC_TEST(Run_WASMSelect_5) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 5);
RunWASMSelectTest(execution_tier, 5);
}
WASM_EXEC_TEST(Run_WASMSelect_6) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 6);
RunWASMSelectTest(execution_tier, 6);
}
WASM_EXEC_TEST(Run_WASMSelect_7) {
CcTest::InitializeVM();
RunWASMSelectTest(execution_mode, 7);
RunWASMSelectTest(execution_tier, 7);
}
void RunWASMSelectAlignTest(WasmExecutionMode mode, int num_args,
int num_params) {
void RunWASMSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
PredictableInputValues inputs(0x300);
Isolate* isolate = CcTest::InitIsolateOnce();
const int kMaxParams = 10;
......@@ -312,7 +311,7 @@ void RunWASMSelectAlignTest(WasmExecutionMode mode, int num_args,
FunctionSig sig(1, num_params, types);
for (int which = 0; which < num_params; which++) {
WasmRunner<void> r(mode);
WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
......@@ -336,67 +335,66 @@ void RunWASMSelectAlignTest(WasmExecutionMode mode, int num_args,
WASM_EXEC_TEST(Run_WASMSelectAlign_0) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 0, 1);
RunWASMSelectAlignTest(execution_mode, 0, 2);
RunWASMSelectAlignTest(execution_tier, 0, 1);
RunWASMSelectAlignTest(execution_tier, 0, 2);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_1) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 1, 2);
RunWASMSelectAlignTest(execution_mode, 1, 3);
RunWASMSelectAlignTest(execution_tier, 1, 2);
RunWASMSelectAlignTest(execution_tier, 1, 3);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_2) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 2, 3);
RunWASMSelectAlignTest(execution_mode, 2, 4);
RunWASMSelectAlignTest(execution_tier, 2, 3);
RunWASMSelectAlignTest(execution_tier, 2, 4);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_3) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 3, 3);
RunWASMSelectAlignTest(execution_mode, 3, 4);
RunWASMSelectAlignTest(execution_tier, 3, 3);
RunWASMSelectAlignTest(execution_tier, 3, 4);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_4) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 4, 3);
RunWASMSelectAlignTest(execution_mode, 4, 4);
RunWASMSelectAlignTest(execution_tier, 4, 3);
RunWASMSelectAlignTest(execution_tier, 4, 4);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_7) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 7, 5);
RunWASMSelectAlignTest(execution_mode, 7, 6);
RunWASMSelectAlignTest(execution_mode, 7, 7);
RunWASMSelectAlignTest(execution_tier, 7, 5);
RunWASMSelectAlignTest(execution_tier, 7, 6);
RunWASMSelectAlignTest(execution_tier, 7, 7);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_8) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 8, 5);
RunWASMSelectAlignTest(execution_mode, 8, 6);
RunWASMSelectAlignTest(execution_mode, 8, 7);
RunWASMSelectAlignTest(execution_mode, 8, 8);
RunWASMSelectAlignTest(execution_tier, 8, 5);
RunWASMSelectAlignTest(execution_tier, 8, 6);
RunWASMSelectAlignTest(execution_tier, 8, 7);
RunWASMSelectAlignTest(execution_tier, 8, 8);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_9) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 9, 6);
RunWASMSelectAlignTest(execution_mode, 9, 7);
RunWASMSelectAlignTest(execution_mode, 9, 8);
RunWASMSelectAlignTest(execution_mode, 9, 9);
RunWASMSelectAlignTest(execution_tier, 9, 6);
RunWASMSelectAlignTest(execution_tier, 9, 7);
RunWASMSelectAlignTest(execution_tier, 9, 8);
RunWASMSelectAlignTest(execution_tier, 9, 9);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_10) {
CcTest::InitializeVM();
RunWASMSelectAlignTest(execution_mode, 10, 7);
RunWASMSelectAlignTest(execution_mode, 10, 8);
RunWASMSelectAlignTest(execution_mode, 10, 9);
RunWASMSelectAlignTest(execution_mode, 10, 10);
RunWASMSelectAlignTest(execution_tier, 10, 7);
RunWASMSelectAlignTest(execution_tier, 10, 8);
RunWASMSelectAlignTest(execution_tier, 10, 9);
RunWASMSelectAlignTest(execution_tier, 10, 10);
}
void RunJSSelectAlignTest(WasmExecutionMode mode, int num_args,
int num_params) {
void RunJSSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
PredictableInputValues inputs(0x400);
Isolate* isolate = CcTest::InitIsolateOnce();
Factory* factory = isolate->factory();
......@@ -427,7 +425,7 @@ void RunJSSelectAlignTest(WasmExecutionMode mode, int num_args,
for (int which = 0; which < num_params; which++) {
HandleScope scope(isolate);
ManuallyImportedJSFunction import = CreateJSSelector(&sig, which);
WasmRunner<void> r(mode, &import);
WasmRunner<void> r(tier, &import);
WasmFunctionCompiler& t = r.NewFunction(&sig);
t.Build(&code[0], &code[end]);
......@@ -454,64 +452,64 @@ void RunJSSelectAlignTest(WasmExecutionMode mode, int num_args,
WASM_EXEC_TEST(Run_JSSelectAlign_0) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 0, 1);
RunJSSelectAlignTest(execution_mode, 0, 2);
RunJSSelectAlignTest(execution_tier, 0, 1);
RunJSSelectAlignTest(execution_tier, 0, 2);
}
WASM_EXEC_TEST(Run_JSSelectAlign_1) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 1, 2);
RunJSSelectAlignTest(execution_mode, 1, 3);
RunJSSelectAlignTest(execution_tier, 1, 2);
RunJSSelectAlignTest(execution_tier, 1, 3);
}
WASM_EXEC_TEST(Run_JSSelectAlign_2) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 2, 3);
RunJSSelectAlignTest(execution_mode, 2, 4);
RunJSSelectAlignTest(execution_tier, 2, 3);
RunJSSelectAlignTest(execution_tier, 2, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_3) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 3, 3);
RunJSSelectAlignTest(execution_mode, 3, 4);
RunJSSelectAlignTest(execution_tier, 3, 3);
RunJSSelectAlignTest(execution_tier, 3, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_4) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 4, 3);
RunJSSelectAlignTest(execution_mode, 4, 4);
RunJSSelectAlignTest(execution_tier, 4, 3);
RunJSSelectAlignTest(execution_tier, 4, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_7) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 7, 3);
RunJSSelectAlignTest(execution_mode, 7, 4);
RunJSSelectAlignTest(execution_mode, 7, 4);
RunJSSelectAlignTest(execution_mode, 7, 4);
RunJSSelectAlignTest(execution_tier, 7, 3);
RunJSSelectAlignTest(execution_tier, 7, 4);
RunJSSelectAlignTest(execution_tier, 7, 4);
RunJSSelectAlignTest(execution_tier, 7, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_8) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 8, 5);
RunJSSelectAlignTest(execution_mode, 8, 6);
RunJSSelectAlignTest(execution_mode, 8, 7);
RunJSSelectAlignTest(execution_mode, 8, 8);
RunJSSelectAlignTest(execution_tier, 8, 5);
RunJSSelectAlignTest(execution_tier, 8, 6);
RunJSSelectAlignTest(execution_tier, 8, 7);
RunJSSelectAlignTest(execution_tier, 8, 8);
}
WASM_EXEC_TEST(Run_JSSelectAlign_9) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 9, 6);
RunJSSelectAlignTest(execution_mode, 9, 7);
RunJSSelectAlignTest(execution_mode, 9, 8);
RunJSSelectAlignTest(execution_mode, 9, 9);
RunJSSelectAlignTest(execution_tier, 9, 6);
RunJSSelectAlignTest(execution_tier, 9, 7);
RunJSSelectAlignTest(execution_tier, 9, 8);
RunJSSelectAlignTest(execution_tier, 9, 9);
}
WASM_EXEC_TEST(Run_JSSelectAlign_10) {
CcTest::InitializeVM();
RunJSSelectAlignTest(execution_mode, 10, 7);
RunJSSelectAlignTest(execution_mode, 10, 8);
RunJSSelectAlignTest(execution_mode, 10, 9);
RunJSSelectAlignTest(execution_mode, 10, 10);
RunJSSelectAlignTest(execution_tier, 10, 7);
RunJSSelectAlignTest(execution_tier, 10, 8);
RunJSSelectAlignTest(execution_tier, 10, 9);
RunJSSelectAlignTest(execution_tier, 10, 10);
}
#undef ADD_CODE
......
......@@ -13,7 +13,7 @@ namespace wasm {
// TODO(gdeepti): Enable tests to run in the interpreter.
WASM_EXEC_TEST(I32SExtendI8) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_SIGN_EXT_I8(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
......@@ -24,7 +24,7 @@ WASM_EXEC_TEST(I32SExtendI8) {
WASM_EXEC_TEST(I32SExtendI16) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_SIGN_EXT_I16(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
......@@ -35,7 +35,7 @@ WASM_EXEC_TEST(I32SExtendI16) {
WASM_EXEC_TEST(I64SExtendI8) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I8(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
......@@ -46,7 +46,7 @@ WASM_EXEC_TEST(I64SExtendI8) {
WASM_EXEC_TEST(I64SExtendI16) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I16(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
......@@ -57,7 +57,7 @@ WASM_EXEC_TEST(I64SExtendI16) {
WASM_EXEC_TEST(I64SExtendI32) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int64_t, int64_t> r(execution_mode);
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I32(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
......
......@@ -32,23 +32,22 @@ typedef int8_t (*Int8BinOp)(int8_t, int8_t);
typedef int (*Int8CompareOp)(int8_t, int8_t);
typedef int8_t (*Int8ShiftOp)(int8_t, int);
#define WASM_SIMD_TEST(name) \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
WasmExecutionMode execution_mode); \
TEST(RunWasm_##name##_turbofan) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kNoLowerSimd, kExecuteTurbofan); \
} \
TEST(RunWasm_##name##_interpreter) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kNoLowerSimd, kExecuteInterpreter); \
} \
TEST(RunWasm_##name##_simd_lowered) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kLowerSimd, kExecuteTurbofan); \
} \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
WasmExecutionMode execution_mode)
#define WASM_SIMD_TEST(name) \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
ExecutionTier execution_tier); \
TEST(RunWasm_##name##_turbofan) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kOptimized); \
} \
TEST(RunWasm_##name##_interpreter) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kInterpreter); \
} \
TEST(RunWasm_##name##_simd_lowered) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kLowerSimd, ExecutionTier::kOptimized); \
} \
void RunWasm_##name##_Impl(LowerSimd lower_simd, ExecutionTier execution_tier)
// Generic expected value functions.
template <typename T>
......@@ -400,7 +399,7 @@ bool SkipFPValue(float x) {
bool SkipFPExpectedValue(float x) { return std::isnan(x) || SkipFPValue(x); }
WASM_SIMD_TEST(F32x4Splat) {
WasmRunner<int32_t, float> r(execution_mode, lower_simd);
WasmRunner<int32_t, float> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
......@@ -414,7 +413,7 @@ WASM_SIMD_TEST(F32x4Splat) {
}
WASM_SIMD_TEST(F32x4ReplaceLane) {
WasmRunner<int32_t, float, float> r(execution_mode, lower_simd);
WasmRunner<int32_t, float, float> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -443,7 +442,7 @@ WASM_SIMD_TEST(F32x4ReplaceLane) {
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
// Tests both signed and unsigned conversion.
WASM_SIMD_TEST(F32x4ConvertI32x4) {
WasmRunner<int32_t, int32_t, float, float> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, float, float> r(execution_tier, lower_simd);
byte a = 0;
byte expected_signed = 1;
byte expected_unsigned = 2;
......@@ -467,10 +466,10 @@ WASM_SIMD_TEST(F32x4ConvertI32x4) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
void RunF32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunF32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, FloatUnOp expected_op,
float error = 0.0f) {
WasmRunner<int32_t, float, float, float> r(execution_mode, lower_simd);
WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd);
byte a = 0;
byte low = 1;
byte high = 2;
......@@ -490,27 +489,27 @@ void RunF32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(F32x4Abs) {
RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4Abs, std::abs);
RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4Abs, std::abs);
}
WASM_SIMD_TEST(F32x4Neg) {
RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4Neg, Negate);
RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4Neg, Negate);
}
static const float kApproxError = 0.01f;
WASM_SIMD_TEST(F32x4RecipApprox) {
RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4RecipApprox, Recip,
RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipApprox, Recip,
kApproxError);
}
WASM_SIMD_TEST(F32x4RecipSqrtApprox) {
RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4RecipSqrtApprox,
RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipSqrtApprox,
RecipSqrt, kApproxError);
}
void RunF32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunF32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, FloatBinOp expected_op) {
WasmRunner<int32_t, float, float, float> r(execution_mode, lower_simd);
WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -534,25 +533,24 @@ void RunF32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(F32x4Add) {
RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Add, Add);
RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Add, Add);
}
WASM_SIMD_TEST(F32x4Sub) {
RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Sub, Sub);
RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Sub, Sub);
}
WASM_SIMD_TEST(F32x4Mul) {
RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Mul, Mul);
RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Mul, Mul);
}
WASM_SIMD_TEST(F32x4_Min) {
RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Min, JSMin);
RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Min, JSMin);
}
WASM_SIMD_TEST(F32x4_Max) {
RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Max, JSMax);
RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Max, JSMax);
}
void RunF32x4CompareOpTest(WasmExecutionMode execution_mode,
LowerSimd lower_simd, WasmOpcode simd_op,
FloatCompareOp expected_op) {
WasmRunner<int32_t, float, float, int32_t> r(execution_mode, lower_simd);
void RunF32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, FloatCompareOp expected_op) {
WasmRunner<int32_t, float, float, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -576,27 +574,27 @@ void RunF32x4CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(F32x4Eq) {
RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Eq, Equal);
RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Eq, Equal);
}
WASM_SIMD_TEST(F32x4Ne) {
RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Ne, NotEqual);
RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Ne, NotEqual);
}
WASM_SIMD_TEST(F32x4Gt) {
RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Gt, Greater);
RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Gt, Greater);
}
WASM_SIMD_TEST(F32x4Ge) {
RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Ge, GreaterEqual);
RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Ge, GreaterEqual);
}
WASM_SIMD_TEST(F32x4Lt) {
RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Lt, Less);
RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Lt, Less);
}
WASM_SIMD_TEST(F32x4Le) {
RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Le, LessEqual);
RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Le, LessEqual);
}
WASM_SIMD_TEST(I32x4Splat) {
......@@ -610,7 +608,7 @@ WASM_SIMD_TEST(I32x4Splat) {
// return 0
//
// return 1
WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
......@@ -621,7 +619,7 @@ WASM_SIMD_TEST(I32x4Splat) {
}
WASM_SIMD_TEST(I32x4ReplaceLane) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -647,7 +645,7 @@ WASM_SIMD_TEST(I32x4ReplaceLane) {
}
WASM_SIMD_TEST(I16x8Splat) {
WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
......@@ -658,7 +656,7 @@ WASM_SIMD_TEST(I16x8Splat) {
}
WASM_SIMD_TEST(I16x8ReplaceLane) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -707,7 +705,7 @@ WASM_SIMD_TEST(I16x8ReplaceLane) {
}
WASM_SIMD_TEST(I8x16Splat) {
WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
......@@ -718,7 +716,7 @@ WASM_SIMD_TEST(I8x16Splat) {
}
WASM_SIMD_TEST(I8x16ReplaceLane) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -839,7 +837,7 @@ int32_t ConvertToInt(double val, bool unsigned_integer) {
// Tests both signed and unsigned conversion.
WASM_SIMD_TEST(I32x4ConvertF32x4) {
WasmRunner<int32_t, float, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, float, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected_signed = 1;
byte expected_unsigned = 2;
......@@ -864,7 +862,7 @@ WASM_SIMD_TEST(I32x4ConvertF32x4) {
// Tests both signed and unsigned conversion from I16x8 (unpacking).
WASM_SIMD_TEST(I32x4ConvertI16x8) {
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_mode,
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_tier,
lower_simd);
byte a = 0;
byte unpacked_signed = 1;
......@@ -905,9 +903,9 @@ WASM_SIMD_TEST(I32x4ConvertI16x8) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
void RunI32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int32UnOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -919,16 +917,16 @@ void RunI32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I32x4Neg) {
RunI32x4UnOpTest(execution_mode, lower_simd, kExprI32x4Neg, Negate);
RunI32x4UnOpTest(execution_tier, lower_simd, kExprI32x4Neg, Negate);
}
WASM_SIMD_TEST(S128Not) {
RunI32x4UnOpTest(execution_mode, lower_simd, kExprS128Not, Not);
RunI32x4UnOpTest(execution_tier, lower_simd, kExprS128Not, Not);
}
void RunI32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int32BinOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -946,51 +944,50 @@ void RunI32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I32x4Add) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4Add, Add);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4Add, Add);
}
WASM_SIMD_TEST(I32x4Sub) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4Sub, Sub);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4Sub, Sub);
}
WASM_SIMD_TEST(I32x4Mul) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4Mul, Mul);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4Mul, Mul);
}
WASM_SIMD_TEST(I32x4MinS) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MinS, Minimum);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MinS, Minimum);
}
WASM_SIMD_TEST(I32x4MaxS) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MaxS, Maximum);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MaxS, Maximum);
}
WASM_SIMD_TEST(I32x4MinU) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MinU,
RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MinU,
UnsignedMinimum);
}
WASM_SIMD_TEST(I32x4MaxU) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MaxU,
RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MaxU,
UnsignedMaximum);
}
WASM_SIMD_TEST(S128And) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprS128And, And);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprS128And, And);
}
WASM_SIMD_TEST(S128Or) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprS128Or, Or);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprS128Or, Or);
}
WASM_SIMD_TEST(S128Xor) {
RunI32x4BinOpTest(execution_mode, lower_simd, kExprS128Xor, Xor);
RunI32x4BinOpTest(execution_tier, lower_simd, kExprS128Xor, Xor);
}
void RunI32x4CompareOpTest(WasmExecutionMode execution_mode,
LowerSimd lower_simd, WasmOpcode simd_op,
Int32CompareOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
void RunI32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int32CompareOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -1008,54 +1005,54 @@ void RunI32x4CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(I32x4Eq) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4Eq, Equal);
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4Eq, Equal);
}
WASM_SIMD_TEST(I32x4Ne) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4Ne, NotEqual);
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4Ne, NotEqual);
}
WASM_SIMD_TEST(I32x4LtS) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LtS, Less);
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LtS, Less);
}
WASM_SIMD_TEST(I32x4LeS) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LeS, LessEqual);
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LeS, LessEqual);
}
WASM_SIMD_TEST(I32x4GtS) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GtS, Greater);
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GtS, Greater);
}
WASM_SIMD_TEST(I32x4GeS) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GeS,
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GeS,
GreaterEqual);
}
WASM_SIMD_TEST(I32x4LtU) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LtU,
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LtU,
UnsignedLess);
}
WASM_SIMD_TEST(I32x4LeU) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LeU,
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LeU,
UnsignedLessEqual);
}
WASM_SIMD_TEST(I32x4GtU) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GtU,
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GtU,
UnsignedGreater);
}
WASM_SIMD_TEST(I32x4GeU) {
RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GeU,
RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GeU,
UnsignedGreaterEqual);
}
void RunI32x4ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI32x4ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int32ShiftOp expected_op) {
for (int shift = 1; shift < 32; ++shift) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -1069,17 +1066,17 @@ void RunI32x4ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I32x4Shl) {
RunI32x4ShiftOpTest(execution_mode, lower_simd, kExprI32x4Shl,
RunI32x4ShiftOpTest(execution_tier, lower_simd, kExprI32x4Shl,
LogicalShiftLeft);
}
WASM_SIMD_TEST(I32x4ShrS) {
RunI32x4ShiftOpTest(execution_mode, lower_simd, kExprI32x4ShrS,
RunI32x4ShiftOpTest(execution_tier, lower_simd, kExprI32x4ShrS,
ArithmeticShiftRight);
}
WASM_SIMD_TEST(I32x4ShrU) {
RunI32x4ShiftOpTest(execution_mode, lower_simd, kExprI32x4ShrU,
RunI32x4ShiftOpTest(execution_tier, lower_simd, kExprI32x4ShrU,
LogicalShiftRight);
}
......@@ -1087,7 +1084,7 @@ WASM_SIMD_TEST(I32x4ShrU) {
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
// Tests both signed and unsigned conversion from I8x16 (unpacking).
WASM_SIMD_TEST(I16x8ConvertI8x16) {
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_mode,
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_tier,
lower_simd);
byte a = 0;
byte unpacked_signed = 1;
......@@ -1130,9 +1127,9 @@ WASM_SIMD_TEST(I16x8ConvertI8x16) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
void RunI16x8UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI16x8UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int16UnOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -1144,7 +1141,7 @@ void RunI16x8UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I16x8Neg) {
RunI16x8UnOpTest(execution_mode, lower_simd, kExprI16x8Neg, Negate);
RunI16x8UnOpTest(execution_tier, lower_simd, kExprI16x8Neg, Negate);
}
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
......@@ -1152,7 +1149,7 @@ WASM_SIMD_TEST(I16x8Neg) {
// Tests both signed and unsigned conversion from I32x4 (packing).
WASM_SIMD_TEST(I16x8ConvertI32x4) {
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t> r(
execution_mode, lower_simd);
execution_tier, lower_simd);
byte a = 0;
byte b = 1;
// indices for packed signed params
......@@ -1196,9 +1193,9 @@ WASM_SIMD_TEST(I16x8ConvertI32x4) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
void RunI16x8BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI16x8BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int16BinOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -1216,59 +1213,58 @@ void RunI16x8BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I16x8Add) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8Add, Add);
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8Add, Add);
}
WASM_SIMD_TEST(I16x8AddSaturateS) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8AddSaturateS,
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8AddSaturateS,
AddSaturate);
}
WASM_SIMD_TEST(I16x8Sub) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8Sub, Sub);
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8Sub, Sub);
}
WASM_SIMD_TEST(I16x8SubSaturateS) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8SubSaturateS,
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8SubSaturateS,
SubSaturate);
}
WASM_SIMD_TEST(I16x8Mul) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8Mul, Mul);
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8Mul, Mul);
}
WASM_SIMD_TEST(I16x8MinS) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MinS, Minimum);
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MinS, Minimum);
}
WASM_SIMD_TEST(I16x8MaxS) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MaxS, Maximum);
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MaxS, Maximum);
}
WASM_SIMD_TEST(I16x8AddSaturateU) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8AddSaturateU,
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8AddSaturateU,
UnsignedAddSaturate);
}
WASM_SIMD_TEST(I16x8SubSaturateU) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8SubSaturateU,
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8SubSaturateU,
UnsignedSubSaturate);
}
WASM_SIMD_TEST(I16x8MinU) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MinU,
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MinU,
UnsignedMinimum);
}
WASM_SIMD_TEST(I16x8MaxU) {
RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MaxU,
RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MaxU,
UnsignedMaximum);
}
void RunI16x8CompareOpTest(WasmExecutionMode execution_mode,
LowerSimd lower_simd, WasmOpcode simd_op,
Int16CompareOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
void RunI16x8CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int16CompareOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -1286,54 +1282,54 @@ void RunI16x8CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(I16x8Eq) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8Eq, Equal);
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8Eq, Equal);
}
WASM_SIMD_TEST(I16x8Ne) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8Ne, NotEqual);
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8Ne, NotEqual);
}
WASM_SIMD_TEST(I16x8LtS) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LtS, Less);
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LtS, Less);
}
WASM_SIMD_TEST(I16x8LeS) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LeS, LessEqual);
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LeS, LessEqual);
}
WASM_SIMD_TEST(I16x8GtS) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GtS, Greater);
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GtS, Greater);
}
WASM_SIMD_TEST(I16x8GeS) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GeS,
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GeS,
GreaterEqual);
}
WASM_SIMD_TEST(I16x8GtU) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GtU,
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GtU,
UnsignedGreater);
}
WASM_SIMD_TEST(I16x8GeU) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GeU,
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GeU,
UnsignedGreaterEqual);
}
WASM_SIMD_TEST(I16x8LtU) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LtU,
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LtU,
UnsignedLess);
}
WASM_SIMD_TEST(I16x8LeU) {
RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LeU,
RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LeU,
UnsignedLessEqual);
}
void RunI16x8ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI16x8ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int16ShiftOp expected_op) {
for (int shift = 1; shift < 16; ++shift) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -1347,23 +1343,23 @@ void RunI16x8ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I16x8Shl) {
RunI16x8ShiftOpTest(execution_mode, lower_simd, kExprI16x8Shl,
RunI16x8ShiftOpTest(execution_tier, lower_simd, kExprI16x8Shl,
LogicalShiftLeft);
}
WASM_SIMD_TEST(I16x8ShrS) {
RunI16x8ShiftOpTest(execution_mode, lower_simd, kExprI16x8ShrS,
RunI16x8ShiftOpTest(execution_tier, lower_simd, kExprI16x8ShrS,
ArithmeticShiftRight);
}
WASM_SIMD_TEST(I16x8ShrU) {
RunI16x8ShiftOpTest(execution_mode, lower_simd, kExprI16x8ShrU,
RunI16x8ShiftOpTest(execution_tier, lower_simd, kExprI16x8ShrU,
LogicalShiftRight);
}
void RunI8x16UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI8x16UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int8UnOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -1375,7 +1371,7 @@ void RunI8x16UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I8x16Neg) {
RunI8x16UnOpTest(execution_mode, lower_simd, kExprI8x16Neg, Negate);
RunI8x16UnOpTest(execution_tier, lower_simd, kExprI8x16Neg, Negate);
}
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
......@@ -1383,7 +1379,7 @@ WASM_SIMD_TEST(I8x16Neg) {
// Tests both signed and unsigned conversion from I16x8 (packing).
WASM_SIMD_TEST(I8x16ConvertI16x8) {
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t> r(
execution_mode, lower_simd);
execution_tier, lower_simd);
byte a = 0;
byte b = 1;
// indices for packed signed params
......@@ -1429,9 +1425,9 @@ WASM_SIMD_TEST(I8x16ConvertI16x8) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
void RunI8x16BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI8x16BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int8BinOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -1449,55 +1445,54 @@ void RunI8x16BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I8x16Add) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16Add, Add);
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16Add, Add);
}
WASM_SIMD_TEST(I8x16AddSaturateS) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16AddSaturateS,
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16AddSaturateS,
AddSaturate);
}
WASM_SIMD_TEST(I8x16Sub) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16Sub, Sub);
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16Sub, Sub);
}
WASM_SIMD_TEST(I8x16SubSaturateS) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16SubSaturateS,
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16SubSaturateS,
SubSaturate);
}
WASM_SIMD_TEST(I8x16MinS) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MinS, Minimum);
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MinS, Minimum);
}
WASM_SIMD_TEST(I8x16MaxS) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MaxS, Maximum);
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MaxS, Maximum);
}
WASM_SIMD_TEST(I8x16AddSaturateU) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16AddSaturateU,
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16AddSaturateU,
UnsignedAddSaturate);
}
WASM_SIMD_TEST(I8x16SubSaturateU) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16SubSaturateU,
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16SubSaturateU,
UnsignedSubSaturate);
}
WASM_SIMD_TEST(I8x16MinU) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MinU,
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MinU,
UnsignedMinimum);
}
WASM_SIMD_TEST(I8x16MaxU) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MaxU,
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MaxU,
UnsignedMaximum);
}
void RunI8x16CompareOpTest(WasmExecutionMode execution_mode,
LowerSimd lower_simd, WasmOpcode simd_op,
Int8CompareOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
void RunI8x16CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int8CompareOp expected_op) {
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
......@@ -1515,62 +1510,62 @@ void RunI8x16CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(I8x16Eq) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16Eq, Equal);
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16Eq, Equal);
}
WASM_SIMD_TEST(I8x16Ne) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16Ne, NotEqual);
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16Ne, NotEqual);
}
WASM_SIMD_TEST(I8x16GtS) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GtS, Greater);
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GtS, Greater);
}
WASM_SIMD_TEST(I8x16GeS) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GeS,
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GeS,
GreaterEqual);
}
WASM_SIMD_TEST(I8x16LtS) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LtS, Less);
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LtS, Less);
}
WASM_SIMD_TEST(I8x16LeS) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LeS, LessEqual);
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LeS, LessEqual);
}
WASM_SIMD_TEST(I8x16GtU) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GtU,
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GtU,
UnsignedGreater);
}
WASM_SIMD_TEST(I8x16GeU) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GeU,
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GeU,
UnsignedGreaterEqual);
}
WASM_SIMD_TEST(I8x16LtU) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LtU,
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LtU,
UnsignedLess);
}
WASM_SIMD_TEST(I8x16LeU) {
RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LeU,
RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LeU,
UnsignedLessEqual);
}
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST(I8x16Mul) {
RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16Mul, Mul);
RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16Mul, Mul);
}
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
void RunI8x16ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunI8x16ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int8ShiftOp expected_op) {
for (int shift = 1; shift < 8; ++shift) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
......@@ -1586,17 +1581,17 @@ void RunI8x16ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST(I8x16Shl) {
RunI8x16ShiftOpTest(execution_mode, lower_simd, kExprI8x16Shl,
RunI8x16ShiftOpTest(execution_tier, lower_simd, kExprI8x16Shl,
LogicalShiftLeft);
}
WASM_SIMD_TEST(I8x16ShrS) {
RunI8x16ShiftOpTest(execution_mode, lower_simd, kExprI8x16ShrS,
RunI8x16ShiftOpTest(execution_tier, lower_simd, kExprI8x16ShrS,
ArithmeticShiftRight);
}
WASM_SIMD_TEST(I8x16ShrU) {
RunI8x16ShiftOpTest(execution_mode, lower_simd, kExprI8x16ShrU,
RunI8x16ShiftOpTest(execution_tier, lower_simd, kExprI8x16ShrU,
LogicalShiftRight);
}
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
......@@ -1607,7 +1602,7 @@ WASM_SIMD_TEST(I8x16ShrU) {
// vector.
#define WASM_SIMD_SELECT_TEST(format) \
WASM_SIMD_TEST(S##format##Select) { \
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd); \
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd); \
byte val1 = 0; \
byte val2 = 1; \
byte src1 = r.AllocateLocal(kWasmS128); \
......@@ -1647,7 +1642,7 @@ WASM_SIMD_SELECT_TEST(8x16)
// rest 0. The mask is not the result of a comparison op.
#define WASM_SIMD_NON_CANONICAL_SELECT_TEST(format) \
WASM_SIMD_TEST(S##format##NonCanonicalSelect) { \
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, \
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, \
lower_simd); \
byte val1 = 0; \
byte val2 = 1; \
......@@ -1684,9 +1679,9 @@ WASM_SIMD_NON_CANONICAL_SELECT_TEST(8x16)
// Test binary ops with two lane test patterns, all lanes distinct.
template <typename T>
void RunBinaryLaneOpTest(
WasmExecutionMode execution_mode, LowerSimd lower_simd, WasmOpcode simd_op,
ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode simd_op,
const std::array<T, kSimd128Size / sizeof(T)>& expected) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
// Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7].
T* src0 = r.builder().AddGlobal<T>(kWasmS128);
T* src1 = r.builder().AddGlobal<T>(kWasmS128);
......@@ -1716,44 +1711,44 @@ void RunBinaryLaneOpTest(
WASM_SIMD_TEST(I32x4AddHoriz) {
// Inputs are [0 1 2 3] and [4 5 6 7].
RunBinaryLaneOpTest<int32_t>(execution_mode, lower_simd, kExprI32x4AddHoriz,
RunBinaryLaneOpTest<int32_t>(execution_tier, lower_simd, kExprI32x4AddHoriz,
{{1, 5, 9, 13}});
}
WASM_SIMD_TEST(I16x8AddHoriz) {
// Inputs are [0 1 2 3 4 5 6 7] and [8 9 10 11 12 13 14 15].
RunBinaryLaneOpTest<int16_t>(execution_mode, lower_simd, kExprI16x8AddHoriz,
RunBinaryLaneOpTest<int16_t>(execution_tier, lower_simd, kExprI16x8AddHoriz,
{{1, 5, 9, 13, 17, 21, 25, 29}});
}
WASM_SIMD_TEST(F32x4AddHoriz) {
// Inputs are [0.0f 1.0f 2.0f 3.0f] and [4.0f 5.0f 6.0f 7.0f].
RunBinaryLaneOpTest<float>(execution_mode, lower_simd, kExprF32x4AddHoriz,
RunBinaryLaneOpTest<float>(execution_tier, lower_simd, kExprF32x4AddHoriz,
{{1.0f, 5.0f, 9.0f, 13.0f}});
}
// Test shuffle ops.
void RunShuffleOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
void RunShuffleOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op,
const std::array<int8_t, kSimd128Size>& shuffle) {
// Test the original shuffle.
RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op, shuffle);
RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op, shuffle);
// Test a non-canonical (inputs reversed) version of the shuffle.
std::array<int8_t, kSimd128Size> other_shuffle(shuffle);
for (size_t i = 0; i < shuffle.size(); ++i) other_shuffle[i] ^= kSimd128Size;
RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op,
RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op,
other_shuffle);
// Test the swizzle (one-operand) version of the shuffle.
std::array<int8_t, kSimd128Size> swizzle(shuffle);
for (size_t i = 0; i < shuffle.size(); ++i) swizzle[i] &= (kSimd128Size - 1);
RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op, swizzle);
RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op, swizzle);
// Test the non-canonical swizzle (one-operand) version of the shuffle.
std::array<int8_t, kSimd128Size> other_swizzle(shuffle);
for (size_t i = 0; i < shuffle.size(); ++i) other_swizzle[i] |= kSimd128Size;
RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op,
RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op,
other_swizzle);
}
......@@ -1868,7 +1863,7 @@ ShuffleMap test_shuffles = {
WASM_SIMD_TEST(Name) { \
ShuffleMap::const_iterator it = test_shuffles.find(k##Name); \
DCHECK_NE(it, test_shuffles.end()); \
RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, \
RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, \
it->second); \
}
SHUFFLE_LIST(SHUFFLE_TEST)
......@@ -1881,7 +1876,7 @@ WASM_SIMD_TEST(S8x16Blend) {
for (int bias = 1; bias < kSimd128Size; bias++) {
for (int i = 0; i < bias; i++) expected[i] = i;
for (int i = bias; i < kSimd128Size; i++) expected[i] = i + kSimd128Size;
RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, expected);
RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, expected);
}
}
......@@ -1899,7 +1894,7 @@ WASM_SIMD_TEST(S8x16Concat) {
for (int j = 0; j < n; ++j) {
expected[i++] = j + kSimd128Size;
}
RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, expected);
RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, expected);
}
}
......@@ -1926,7 +1921,7 @@ WASM_SIMD_TEST(S8x16ShuffleFuzz) {
for (int i = 0; i < kTests; ++i) {
auto shuffle = Combine(GetRandomTestShuffle(rng), GetRandomTestShuffle(rng),
GetRandomTestShuffle(rng));
RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, shuffle);
RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, shuffle);
}
}
......@@ -1957,24 +1952,23 @@ void BuildShuffle(std::vector<Shuffle>& shuffles, std::vector<byte>* buffer) {
}
// Runs tests of compiled code, using the interpreter as a reference.
#define WASM_SIMD_COMPILED_TEST(name) \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
WasmExecutionMode execution_mode); \
TEST(RunWasm_##name##_turbofan) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kNoLowerSimd, kExecuteTurbofan); \
} \
TEST(RunWasm_##name##_simd_lowered) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kLowerSimd, kExecuteTurbofan); \
} \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
WasmExecutionMode execution_mode)
void RunWasmCode(WasmExecutionMode execution_mode, LowerSimd lower_simd,
#define WASM_SIMD_COMPILED_TEST(name) \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
ExecutionTier execution_tier); \
TEST(RunWasm_##name##_turbofan) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kOptimized); \
} \
TEST(RunWasm_##name##_simd_lowered) { \
EXPERIMENTAL_FLAG_SCOPE(simd); \
RunWasm_##name##_Impl(kLowerSimd, ExecutionTier::kOptimized); \
} \
void RunWasm_##name##_Impl(LowerSimd lower_simd, ExecutionTier execution_tier)
void RunWasmCode(ExecutionTier execution_tier, LowerSimd lower_simd,
const std::vector<byte>& code,
std::array<int8_t, kSimd128Size>* result) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
// Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7].
int8_t* src0 = r.builder().AddGlobal<int8_t>(kWasmS128);
int8_t* src1 = r.builder().AddGlobal<int8_t>(kWasmS128);
......@@ -2009,10 +2003,10 @@ WASM_SIMD_COMPILED_TEST(S8x16MultiShuffleFuzz) {
// Run the code using the interpreter to get the expected result.
std::array<int8_t, kSimd128Size> expected;
RunWasmCode(kExecuteInterpreter, kNoLowerSimd, buffer, &expected);
RunWasmCode(ExecutionTier::kInterpreter, kNoLowerSimd, buffer, &expected);
// Run the SIMD or scalar lowered compiled code and compare results.
std::array<int8_t, kSimd128Size> result;
RunWasmCode(execution_mode, lower_simd, buffer, &result);
RunWasmCode(execution_tier, lower_simd, buffer, &result);
for (size_t i = 0; i < kSimd128Size; ++i) {
CHECK_EQ(result[i], expected[i]);
}
......@@ -2024,7 +2018,7 @@ WASM_SIMD_COMPILED_TEST(S8x16MultiShuffleFuzz) {
// test inputs. Test inputs with all true, all false, one true, and one false.
#define WASM_SIMD_BOOL_REDUCTION_TEST(format, lanes) \
WASM_SIMD_TEST(ReductionTest##lanes) { \
WasmRunner<int32_t> r(execution_mode, lower_simd); \
WasmRunner<int32_t> r(execution_tier, lower_simd); \
byte zero = r.AllocateLocal(kWasmS128); \
byte one_one = r.AllocateLocal(kWasmS128); \
byte reduced = r.AllocateLocal(kWasmI32); \
......@@ -2097,7 +2091,7 @@ WASM_SIMD_BOOL_REDUCTION_TEST(16x8, 8)
WASM_SIMD_BOOL_REDUCTION_TEST(8x16, 16)
WASM_SIMD_TEST(SimdI32x4ExtractWithF32x4) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_IF_ELSE_I(
WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE(
0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))),
......@@ -2109,7 +2103,7 @@ WASM_SIMD_TEST(SimdI32x4ExtractWithF32x4) {
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST(SimdF32x4ExtractWithI32x4) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r,
WASM_IF_ELSE_I(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))),
......@@ -2123,7 +2117,7 @@ WASM_SIMD_TEST(SimdF32x4AddWithI32x4) {
// representable as a float.
const int kOne = 0x3F800000;
const int kTwo = 0x40000000;
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r,
WASM_IF_ELSE_I(
WASM_F32_EQ(
......@@ -2138,7 +2132,7 @@ WASM_SIMD_TEST(SimdF32x4AddWithI32x4) {
}
WASM_SIMD_TEST(SimdI32x4AddWithF32x4) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r,
WASM_IF_ELSE_I(
WASM_I32_EQ(
......@@ -2153,7 +2147,7 @@ WASM_SIMD_TEST(SimdI32x4AddWithF32x4) {
}
WASM_SIMD_TEST(SimdI32x4Local) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmS128);
BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))),
......@@ -2162,7 +2156,7 @@ WASM_SIMD_TEST(SimdI32x4Local) {
}
WASM_SIMD_TEST(SimdI32x4SplatFromExtract) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmS128);
BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_EXTRACT_LANE(
......@@ -2173,7 +2167,7 @@ WASM_SIMD_TEST(SimdI32x4SplatFromExtract) {
}
WASM_SIMD_TEST(SimdI32x4For) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmS128);
BUILD(r,
......@@ -2207,7 +2201,7 @@ WASM_SIMD_TEST(SimdI32x4For) {
}
WASM_SIMD_TEST(SimdF32x4For) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmS128);
BUILD(r, WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))),
......@@ -2247,7 +2241,7 @@ const T GetScalar(T* v, int lane) {
}
WASM_SIMD_TEST(SimdI32x4GetGlobal) {
WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
// Pad the globals with a few unused slots to get a non-zero offset.
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
......@@ -2275,7 +2269,7 @@ WASM_SIMD_TEST(SimdI32x4GetGlobal) {
}
WASM_SIMD_TEST(SimdI32x4SetGlobal) {
WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
// Pad the globals with a few unused slots to get a non-zero offset.
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
......@@ -2298,7 +2292,7 @@ WASM_SIMD_TEST(SimdI32x4SetGlobal) {
}
WASM_SIMD_TEST(SimdF32x4GetGlobal) {
WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
float* global = r.builder().AddGlobal<float>(kWasmS128);
SetVectorByLanes<float>(global, {{0.0, 1.5, 2.25, 3.5}});
r.AllocateLocal(kWasmI32);
......@@ -2321,7 +2315,7 @@ WASM_SIMD_TEST(SimdF32x4GetGlobal) {
}
WASM_SIMD_TEST(SimdF32x4SetGlobal) {
WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
float* global = r.builder().AddGlobal<float>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))),
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_GLOBAL(0),
......@@ -2339,7 +2333,7 @@ WASM_SIMD_TEST(SimdF32x4SetGlobal) {
}
WASM_SIMD_TEST(SimdLoadStoreLoad) {
WasmRunner<int32_t> r(execution_mode, lower_simd);
WasmRunner<int32_t> r(execution_tier, lower_simd);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
// Load memory, store it, then reload it and extract the first lane. Use a
......
......@@ -27,7 +27,7 @@ namespace test_run_wasm {
#define RET_I8(x) WASM_I32V_2(x), kExprReturn
WASM_EXEC_TEST(Int32Const) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
const int32_t kExpectedValue = 0x11223344;
// return(kExpectedValue)
BUILD(r, WASM_I32V_5(kExpectedValue));
......@@ -36,7 +36,7 @@ WASM_EXEC_TEST(Int32Const) {
WASM_EXEC_TEST(Int32Const_many) {
FOR_INT32_INPUTS(i) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
const int32_t kExpectedValue = *i;
// return(kExpectedValue)
BUILD(r, WASM_I32V(kExpectedValue));
......@@ -46,58 +46,58 @@ WASM_EXEC_TEST(Int32Const_many) {
WASM_EXEC_TEST(GraphTrimming) {
// This WebAssembly code requires graph trimming in the TurboFan compiler.
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprGetLocal, 0, kExprGetLocal, 0, kExprGetLocal, 0, kExprI32RemS,
kExprI32Eq, kExprGetLocal, 0, kExprI32DivS, kExprUnreachable);
r.Call(1);
}
WASM_EXEC_TEST(Int32Param0) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// return(local[0])
BUILD(r, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Int32Param0_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// local[0]
BUILD(r, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Int32Param1) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// local[1]
BUILD(r, WASM_GET_LOCAL(1));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); }
}
WASM_EXEC_TEST(Int32Add) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// 11 + 44
BUILD(r, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(44)));
CHECK_EQ(55, r.Call());
}
WASM_EXEC_TEST(Int32Add_P) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); }
}
WASM_EXEC_TEST(Int32Add_P_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); }
}
static void RunInt32AddTest(WasmExecutionMode execution_mode, const byte* code,
static void RunInt32AddTest(ExecutionTier execution_tier, const byte* code,
size_t size) {
TestSignatures sigs;
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().AddSignature(sigs.ii_v());
r.builder().AddSignature(sigs.iii_v());
r.Build(code, code + size);
......@@ -114,7 +114,7 @@ WASM_EXEC_TEST(Int32Add_P2) {
EXPERIMENTAL_FLAG_SCOPE(mv);
static const byte code[] = {
WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
RunInt32AddTest(execution_mode, code, sizeof(code));
RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Int32Add_block1) {
......@@ -122,7 +122,7 @@ WASM_EXEC_TEST(Int32Add_block1) {
static const byte code[] = {
WASM_BLOCK_X(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
kExprI32Add};
RunInt32AddTest(execution_mode, code, sizeof(code));
RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Int32Add_block2) {
......@@ -130,7 +130,7 @@ WASM_EXEC_TEST(Int32Add_block2) {
static const byte code[] = {
WASM_BLOCK_X(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), kExprBr, DEPTH_0),
kExprI32Add};
RunInt32AddTest(execution_mode, code, sizeof(code));
RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Int32Add_multi_if) {
......@@ -140,11 +140,11 @@ WASM_EXEC_TEST(Int32Add_multi_if) {
WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
kExprI32Add};
RunInt32AddTest(execution_mode, code, sizeof(code));
RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Float32Add) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// int(11.5f + 44.5f)
BUILD(r,
WASM_I32_SCONVERT_F32(WASM_F32_ADD(WASM_F32(11.5f), WASM_F32(44.5f))));
......@@ -152,7 +152,7 @@ WASM_EXEC_TEST(Float32Add) {
}
WASM_EXEC_TEST(Float64Add) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return int(13.5d + 43.5d)
BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5))));
CHECK_EQ(57, r.Call());
......@@ -161,18 +161,18 @@ WASM_EXEC_TEST(Float64Add) {
// clang-format messes up the FOR_INT32_INPUTS macros.
// clang-format off
template<typename ctype>
static void TestInt32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
static void TestInt32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
ctype(*expected)(ctype, ctype)) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
WasmRunner<ctype> r(execution_mode);
WasmRunner<ctype> r(execution_tier);
// Apply {opcode} on two constants.
BUILD(r, WASM_BINOP(opcode, WASM_I32V(*i), WASM_I32V(*j)));
CHECK_EQ(expected(*i, *j), r.Call());
}
}
{
WasmRunner<ctype, ctype, ctype> r(execution_mode);
WasmRunner<ctype, ctype, ctype> r(execution_tier);
// Apply {opcode} on two parameters.
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT32_INPUTS(i) {
......@@ -186,7 +186,7 @@ static void TestInt32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
#define WASM_I32_BINOP_TEST(expr, ctype, expected) \
WASM_EXEC_TEST(I32Binop_##expr) { \
TestInt32Binop<ctype>(execution_mode, kExprI32##expr, \
TestInt32Binop<ctype>(execution_tier, kExprI32##expr, \
[](ctype a, ctype b) -> ctype { return expected; }); \
}
......@@ -221,16 +221,16 @@ WASM_I32_BINOP_TEST(GeU, uint32_t, a >= b)
#undef WASM_I32_BINOP_TEST
void TestInt32Unop(WasmExecutionMode execution_mode, WasmOpcode opcode,
void TestInt32Unop(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, int32_t a) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return op K
BUILD(r, WASM_UNOP(opcode, WASM_I32V(a)));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// return op a
BUILD(r, WASM_UNOP(opcode, WASM_GET_LOCAL(0)));
CHECK_EQ(expected, r.Call(a));
......@@ -238,96 +238,96 @@ void TestInt32Unop(WasmExecutionMode execution_mode, WasmOpcode opcode,
}
WASM_EXEC_TEST(Int32Clz) {
TestInt32Unop(execution_mode, kExprI32Clz, 0, 0x80001000);
TestInt32Unop(execution_mode, kExprI32Clz, 1, 0x40000500);
TestInt32Unop(execution_mode, kExprI32Clz, 2, 0x20000300);
TestInt32Unop(execution_mode, kExprI32Clz, 3, 0x10000003);
TestInt32Unop(execution_mode, kExprI32Clz, 4, 0x08050000);
TestInt32Unop(execution_mode, kExprI32Clz, 5, 0x04006000);
TestInt32Unop(execution_mode, kExprI32Clz, 6, 0x02000000);
TestInt32Unop(execution_mode, kExprI32Clz, 7, 0x010000A0);
TestInt32Unop(execution_mode, kExprI32Clz, 8, 0x00800C00);
TestInt32Unop(execution_mode, kExprI32Clz, 9, 0x00400000);
TestInt32Unop(execution_mode, kExprI32Clz, 10, 0x0020000D);
TestInt32Unop(execution_mode, kExprI32Clz, 11, 0x00100F00);
TestInt32Unop(execution_mode, kExprI32Clz, 12, 0x00080000);
TestInt32Unop(execution_mode, kExprI32Clz, 13, 0x00041000);
TestInt32Unop(execution_mode, kExprI32Clz, 14, 0x00020020);
TestInt32Unop(execution_mode, kExprI32Clz, 15, 0x00010300);
TestInt32Unop(execution_mode, kExprI32Clz, 16, 0x00008040);
TestInt32Unop(execution_mode, kExprI32Clz, 17, 0x00004005);
TestInt32Unop(execution_mode, kExprI32Clz, 18, 0x00002050);
TestInt32Unop(execution_mode, kExprI32Clz, 19, 0x00001700);
TestInt32Unop(execution_mode, kExprI32Clz, 20, 0x00000870);
TestInt32Unop(execution_mode, kExprI32Clz, 21, 0x00000405);
TestInt32Unop(execution_mode, kExprI32Clz, 22, 0x00000203);
TestInt32Unop(execution_mode, kExprI32Clz, 23, 0x00000101);
TestInt32Unop(execution_mode, kExprI32Clz, 24, 0x00000089);
TestInt32Unop(execution_mode, kExprI32Clz, 25, 0x00000041);
TestInt32Unop(execution_mode, kExprI32Clz, 26, 0x00000022);
TestInt32Unop(execution_mode, kExprI32Clz, 27, 0x00000013);
TestInt32Unop(execution_mode, kExprI32Clz, 28, 0x00000008);
TestInt32Unop(execution_mode, kExprI32Clz, 29, 0x00000004);
TestInt32Unop(execution_mode, kExprI32Clz, 30, 0x00000002);
TestInt32Unop(execution_mode, kExprI32Clz, 31, 0x00000001);
TestInt32Unop(execution_mode, kExprI32Clz, 32, 0x00000000);
TestInt32Unop(execution_tier, kExprI32Clz, 0, 0x80001000);
TestInt32Unop(execution_tier, kExprI32Clz, 1, 0x40000500);
TestInt32Unop(execution_tier, kExprI32Clz, 2, 0x20000300);
TestInt32Unop(execution_tier, kExprI32Clz, 3, 0x10000003);
TestInt32Unop(execution_tier, kExprI32Clz, 4, 0x08050000);
TestInt32Unop(execution_tier, kExprI32Clz, 5, 0x04006000);
TestInt32Unop(execution_tier, kExprI32Clz, 6, 0x02000000);
TestInt32Unop(execution_tier, kExprI32Clz, 7, 0x010000A0);
TestInt32Unop(execution_tier, kExprI32Clz, 8, 0x00800C00);
TestInt32Unop(execution_tier, kExprI32Clz, 9, 0x00400000);
TestInt32Unop(execution_tier, kExprI32Clz, 10, 0x0020000D);
TestInt32Unop(execution_tier, kExprI32Clz, 11, 0x00100F00);
TestInt32Unop(execution_tier, kExprI32Clz, 12, 0x00080000);
TestInt32Unop(execution_tier, kExprI32Clz, 13, 0x00041000);
TestInt32Unop(execution_tier, kExprI32Clz, 14, 0x00020020);
TestInt32Unop(execution_tier, kExprI32Clz, 15, 0x00010300);
TestInt32Unop(execution_tier, kExprI32Clz, 16, 0x00008040);
TestInt32Unop(execution_tier, kExprI32Clz, 17, 0x00004005);
TestInt32Unop(execution_tier, kExprI32Clz, 18, 0x00002050);
TestInt32Unop(execution_tier, kExprI32Clz, 19, 0x00001700);
TestInt32Unop(execution_tier, kExprI32Clz, 20, 0x00000870);
TestInt32Unop(execution_tier, kExprI32Clz, 21, 0x00000405);
TestInt32Unop(execution_tier, kExprI32Clz, 22, 0x00000203);
TestInt32Unop(execution_tier, kExprI32Clz, 23, 0x00000101);
TestInt32Unop(execution_tier, kExprI32Clz, 24, 0x00000089);
TestInt32Unop(execution_tier, kExprI32Clz, 25, 0x00000041);
TestInt32Unop(execution_tier, kExprI32Clz, 26, 0x00000022);
TestInt32Unop(execution_tier, kExprI32Clz, 27, 0x00000013);
TestInt32Unop(execution_tier, kExprI32Clz, 28, 0x00000008);
TestInt32Unop(execution_tier, kExprI32Clz, 29, 0x00000004);
TestInt32Unop(execution_tier, kExprI32Clz, 30, 0x00000002);
TestInt32Unop(execution_tier, kExprI32Clz, 31, 0x00000001);
TestInt32Unop(execution_tier, kExprI32Clz, 32, 0x00000000);
}
WASM_EXEC_TEST(Int32Ctz) {
TestInt32Unop(execution_mode, kExprI32Ctz, 32, 0x00000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 31, 0x80000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 30, 0x40000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 29, 0x20000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 28, 0x10000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 27, 0xA8000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 26, 0xF4000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 25, 0x62000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 24, 0x91000000);
TestInt32Unop(execution_mode, kExprI32Ctz, 23, 0xCD800000);
TestInt32Unop(execution_mode, kExprI32Ctz, 22, 0x09400000);
TestInt32Unop(execution_mode, kExprI32Ctz, 21, 0xAF200000);
TestInt32Unop(execution_mode, kExprI32Ctz, 20, 0xAC100000);
TestInt32Unop(execution_mode, kExprI32Ctz, 19, 0xE0B80000);
TestInt32Unop(execution_mode, kExprI32Ctz, 18, 0x9CE40000);
TestInt32Unop(execution_mode, kExprI32Ctz, 17, 0xC7920000);
TestInt32Unop(execution_mode, kExprI32Ctz, 16, 0xB8F10000);
TestInt32Unop(execution_mode, kExprI32Ctz, 15, 0x3B9F8000);
TestInt32Unop(execution_mode, kExprI32Ctz, 14, 0xDB4C4000);
TestInt32Unop(execution_mode, kExprI32Ctz, 13, 0xE9A32000);
TestInt32Unop(execution_mode, kExprI32Ctz, 12, 0xFCA61000);
TestInt32Unop(execution_mode, kExprI32Ctz, 11, 0x6C8A7800);
TestInt32Unop(execution_mode, kExprI32Ctz, 10, 0x8CE5A400);
TestInt32Unop(execution_mode, kExprI32Ctz, 9, 0xCB7D0200);
TestInt32Unop(execution_mode, kExprI32Ctz, 8, 0xCB4DC100);
TestInt32Unop(execution_mode, kExprI32Ctz, 7, 0xDFBEC580);
TestInt32Unop(execution_mode, kExprI32Ctz, 6, 0x27A9DB40);
TestInt32Unop(execution_mode, kExprI32Ctz, 5, 0xDE3BCB20);
TestInt32Unop(execution_mode, kExprI32Ctz, 4, 0xD7E8A610);
TestInt32Unop(execution_mode, kExprI32Ctz, 3, 0x9AFDBC88);
TestInt32Unop(execution_mode, kExprI32Ctz, 2, 0x9AFDBC84);
TestInt32Unop(execution_mode, kExprI32Ctz, 1, 0x9AFDBC82);
TestInt32Unop(execution_mode, kExprI32Ctz, 0, 0x9AFDBC81);
TestInt32Unop(execution_tier, kExprI32Ctz, 32, 0x00000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 31, 0x80000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 30, 0x40000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 29, 0x20000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 28, 0x10000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 27, 0xA8000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 26, 0xF4000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 25, 0x62000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 24, 0x91000000);
TestInt32Unop(execution_tier, kExprI32Ctz, 23, 0xCD800000);
TestInt32Unop(execution_tier, kExprI32Ctz, 22, 0x09400000);
TestInt32Unop(execution_tier, kExprI32Ctz, 21, 0xAF200000);
TestInt32Unop(execution_tier, kExprI32Ctz, 20, 0xAC100000);
TestInt32Unop(execution_tier, kExprI32Ctz, 19, 0xE0B80000);
TestInt32Unop(execution_tier, kExprI32Ctz, 18, 0x9CE40000);
TestInt32Unop(execution_tier, kExprI32Ctz, 17, 0xC7920000);
TestInt32Unop(execution_tier, kExprI32Ctz, 16, 0xB8F10000);
TestInt32Unop(execution_tier, kExprI32Ctz, 15, 0x3B9F8000);
TestInt32Unop(execution_tier, kExprI32Ctz, 14, 0xDB4C4000);
TestInt32Unop(execution_tier, kExprI32Ctz, 13, 0xE9A32000);
TestInt32Unop(execution_tier, kExprI32Ctz, 12, 0xFCA61000);
TestInt32Unop(execution_tier, kExprI32Ctz, 11, 0x6C8A7800);
TestInt32Unop(execution_tier, kExprI32Ctz, 10, 0x8CE5A400);
TestInt32Unop(execution_tier, kExprI32Ctz, 9, 0xCB7D0200);
TestInt32Unop(execution_tier, kExprI32Ctz, 8, 0xCB4DC100);
TestInt32Unop(execution_tier, kExprI32Ctz, 7, 0xDFBEC580);
TestInt32Unop(execution_tier, kExprI32Ctz, 6, 0x27A9DB40);
TestInt32Unop(execution_tier, kExprI32Ctz, 5, 0xDE3BCB20);
TestInt32Unop(execution_tier, kExprI32Ctz, 4, 0xD7E8A610);
TestInt32Unop(execution_tier, kExprI32Ctz, 3, 0x9AFDBC88);
TestInt32Unop(execution_tier, kExprI32Ctz, 2, 0x9AFDBC84);
TestInt32Unop(execution_tier, kExprI32Ctz, 1, 0x9AFDBC82);
TestInt32Unop(execution_tier, kExprI32Ctz, 0, 0x9AFDBC81);
}
WASM_EXEC_TEST(Int32Popcnt) {
TestInt32Unop(execution_mode, kExprI32Popcnt, 32, 0xFFFFFFFF);
TestInt32Unop(execution_mode, kExprI32Popcnt, 0, 0x00000000);
TestInt32Unop(execution_mode, kExprI32Popcnt, 1, 0x00008000);
TestInt32Unop(execution_mode, kExprI32Popcnt, 13, 0x12345678);
TestInt32Unop(execution_mode, kExprI32Popcnt, 19, 0xFEDCBA09);
TestInt32Unop(execution_tier, kExprI32Popcnt, 32, 0xFFFFFFFF);
TestInt32Unop(execution_tier, kExprI32Popcnt, 0, 0x00000000);
TestInt32Unop(execution_tier, kExprI32Popcnt, 1, 0x00008000);
TestInt32Unop(execution_tier, kExprI32Popcnt, 13, 0x12345678);
TestInt32Unop(execution_tier, kExprI32Popcnt, 19, 0xFEDCBA09);
}
WASM_EXEC_TEST(I32Eqz) {
TestInt32Unop(execution_mode, kExprI32Eqz, 0, 1);
TestInt32Unop(execution_mode, kExprI32Eqz, 0, -1);
TestInt32Unop(execution_mode, kExprI32Eqz, 0, -827343);
TestInt32Unop(execution_mode, kExprI32Eqz, 0, 8888888);
TestInt32Unop(execution_mode, kExprI32Eqz, 1, 0);
TestInt32Unop(execution_tier, kExprI32Eqz, 0, 1);
TestInt32Unop(execution_tier, kExprI32Eqz, 0, -1);
TestInt32Unop(execution_tier, kExprI32Eqz, 0, -827343);
TestInt32Unop(execution_tier, kExprI32Eqz, 0, 8888888);
TestInt32Unop(execution_tier, kExprI32Eqz, 1, 0);
}
WASM_EXEC_TEST(Int32DivS_trap) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(0, r.Call(0, 100));
......@@ -338,7 +338,7 @@ WASM_EXEC_TEST(Int32DivS_trap) {
}
WASM_EXEC_TEST(Int32RemS_trap) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(33, r.Call(133, 100));
......@@ -349,7 +349,7 @@ WASM_EXEC_TEST(Int32RemS_trap) {
}
WASM_EXEC_TEST(Int32DivU_trap) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(0, r.Call(0, 100));
......@@ -360,7 +360,7 @@ WASM_EXEC_TEST(Int32DivU_trap) {
}
WASM_EXEC_TEST(Int32RemU_trap) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(17, r.Call(217, 100));
const int32_t kMin = std::numeric_limits<int32_t>::min();
......@@ -372,7 +372,7 @@ WASM_EXEC_TEST(Int32RemU_trap) {
WASM_EXEC_TEST(Int32DivS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
for (int32_t val = -7; val < 8; ++val) {
if (denom == 0) {
......@@ -386,7 +386,7 @@ WASM_EXEC_TEST(Int32DivS_byzero_const) {
WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
......@@ -403,7 +403,7 @@ WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
......@@ -420,7 +420,7 @@ WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
WASM_EXEC_TEST(Int32DivU_byzero_const) {
for (uint32_t denom = 0xFFFFFFFE; denom < 8; ++denom) {
WasmRunner<uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
for (uint32_t val = 0xFFFFFFF0; val < 8; ++val) {
......@@ -434,7 +434,7 @@ WASM_EXEC_TEST(Int32DivU_byzero_const) {
}
WASM_EXEC_TEST(Int32DivS_trap_effect) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_IF_ELSE_I(
......@@ -455,34 +455,34 @@ WASM_EXEC_TEST(Int32DivS_trap_effect) {
CHECK_TRAP(r.Call(0, 0));
}
void TestFloat32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
void TestFloat32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, float a, float b) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b)));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, float, float> r(execution_mode);
WasmRunner<int32_t, float, float> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
}
}
void TestFloat32BinopWithConvert(WasmExecutionMode execution_mode,
void TestFloat32BinopWithConvert(ExecutionTier execution_tier,
WasmOpcode opcode, int32_t expected, float a,
float b) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return int(K op K)
BUILD(r,
WASM_I32_SCONVERT_F32(WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b))));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, float, float> r(execution_mode);
WasmRunner<int32_t, float, float> r(execution_tier);
// return int(a op b)
BUILD(r, WASM_I32_SCONVERT_F32(
WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
......@@ -490,66 +490,66 @@ void TestFloat32BinopWithConvert(WasmExecutionMode execution_mode,
}
}
void TestFloat32UnopWithConvert(WasmExecutionMode execution_mode,
WasmOpcode opcode, int32_t expected, float a) {
void TestFloat32UnopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, float a) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return int(op(K))
BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_F32(a))));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, float> r(execution_mode);
WasmRunner<int32_t, float> r(execution_tier);
// return int(op(a))
BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_GET_LOCAL(0))));
CHECK_EQ(expected, r.Call(a));
}
}
void TestFloat64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
void TestFloat64Binop(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, double a, double b) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b)));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, double, double> r(execution_mode);
WasmRunner<int32_t, double, double> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
}
}
void TestFloat64BinopWithConvert(WasmExecutionMode execution_mode,
void TestFloat64BinopWithConvert(ExecutionTier execution_tier,
WasmOpcode opcode, int32_t expected, double a,
double b) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return int(K op K)
BUILD(r,
WASM_I32_SCONVERT_F64(WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b))));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, double, double> r(execution_mode);
WasmRunner<int32_t, double, double> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_F64(
WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
CHECK_EQ(expected, r.Call(a, b));
}
}
void TestFloat64UnopWithConvert(WasmExecutionMode execution_mode,
WasmOpcode opcode, int32_t expected, double a) {
void TestFloat64UnopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, double a) {
{
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// return int(op(K))
BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_F64(a))));
CHECK_EQ(expected, r.Call());
}
{
WasmRunner<int32_t, double> r(execution_mode);
WasmRunner<int32_t, double> r(execution_tier);
// return int(op(a))
BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_GET_LOCAL(0))));
CHECK_EQ(expected, r.Call(a));
......@@ -557,50 +557,50 @@ void TestFloat64UnopWithConvert(WasmExecutionMode execution_mode,
}
WASM_EXEC_TEST(Float32Binops) {
TestFloat32Binop(execution_mode, kExprF32Eq, 1, 8.125f, 8.125f);
TestFloat32Binop(execution_mode, kExprF32Ne, 1, 8.125f, 8.127f);
TestFloat32Binop(execution_mode, kExprF32Lt, 1, -9.5f, -9.0f);
TestFloat32Binop(execution_mode, kExprF32Le, 1, -1111.0f, -1111.0f);
TestFloat32Binop(execution_mode, kExprF32Gt, 1, -9.0f, -9.5f);
TestFloat32Binop(execution_mode, kExprF32Ge, 1, -1111.0f, -1111.0f);
TestFloat32Binop(execution_tier, kExprF32Eq, 1, 8.125f, 8.125f);
TestFloat32Binop(execution_tier, kExprF32Ne, 1, 8.125f, 8.127f);
TestFloat32Binop(execution_tier, kExprF32Lt, 1, -9.5f, -9.0f);
TestFloat32Binop(execution_tier, kExprF32Le, 1, -1111.0f, -1111.0f);
TestFloat32Binop(execution_tier, kExprF32Gt, 1, -9.0f, -9.5f);
TestFloat32Binop(execution_tier, kExprF32Ge, 1, -1111.0f, -1111.0f);
TestFloat32BinopWithConvert(execution_mode, kExprF32Add, 10, 3.5f, 6.5f);
TestFloat32BinopWithConvert(execution_mode, kExprF32Sub, 2, 44.5f, 42.5f);
TestFloat32BinopWithConvert(execution_mode, kExprF32Mul, -66, -132.1f, 0.5f);
TestFloat32BinopWithConvert(execution_mode, kExprF32Div, 11, 22.1f, 2.0f);
TestFloat32BinopWithConvert(execution_tier, kExprF32Add, 10, 3.5f, 6.5f);
TestFloat32BinopWithConvert(execution_tier, kExprF32Sub, 2, 44.5f, 42.5f);
TestFloat32BinopWithConvert(execution_tier, kExprF32Mul, -66, -132.1f, 0.5f);
TestFloat32BinopWithConvert(execution_tier, kExprF32Div, 11, 22.1f, 2.0f);
}
WASM_EXEC_TEST(Float32Unops) {
TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 8, 8.125f);
TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 9, -9.125f);
TestFloat32UnopWithConvert(execution_mode, kExprF32Neg, -213, 213.125f);
TestFloat32UnopWithConvert(execution_mode, kExprF32Sqrt, 12, 144.4f);
TestFloat32UnopWithConvert(execution_tier, kExprF32Abs, 8, 8.125f);
TestFloat32UnopWithConvert(execution_tier, kExprF32Abs, 9, -9.125f);
TestFloat32UnopWithConvert(execution_tier, kExprF32Neg, -213, 213.125f);
TestFloat32UnopWithConvert(execution_tier, kExprF32Sqrt, 12, 144.4f);
}
WASM_EXEC_TEST(Float64Binops) {
TestFloat64Binop(execution_mode, kExprF64Eq, 1, 16.25, 16.25);
TestFloat64Binop(execution_mode, kExprF64Ne, 1, 16.25, 16.15);
TestFloat64Binop(execution_mode, kExprF64Lt, 1, -32.4, 11.7);
TestFloat64Binop(execution_mode, kExprF64Le, 1, -88.9, -88.9);
TestFloat64Binop(execution_mode, kExprF64Gt, 1, 11.7, -32.4);
TestFloat64Binop(execution_mode, kExprF64Ge, 1, -88.9, -88.9);
TestFloat64BinopWithConvert(execution_mode, kExprF64Add, 100, 43.5, 56.5);
TestFloat64BinopWithConvert(execution_mode, kExprF64Sub, 200, 12200.1,
TestFloat64Binop(execution_tier, kExprF64Eq, 1, 16.25, 16.25);
TestFloat64Binop(execution_tier, kExprF64Ne, 1, 16.25, 16.15);
TestFloat64Binop(execution_tier, kExprF64Lt, 1, -32.4, 11.7);
TestFloat64Binop(execution_tier, kExprF64Le, 1, -88.9, -88.9);
TestFloat64Binop(execution_tier, kExprF64Gt, 1, 11.7, -32.4);
TestFloat64Binop(execution_tier, kExprF64Ge, 1, -88.9, -88.9);
TestFloat64BinopWithConvert(execution_tier, kExprF64Add, 100, 43.5, 56.5);
TestFloat64BinopWithConvert(execution_tier, kExprF64Sub, 200, 12200.1,
12000.1);
TestFloat64BinopWithConvert(execution_mode, kExprF64Mul, -33, 134, -0.25);
TestFloat64BinopWithConvert(execution_mode, kExprF64Div, -1111, -2222.3, 2);
TestFloat64BinopWithConvert(execution_tier, kExprF64Mul, -33, 134, -0.25);
TestFloat64BinopWithConvert(execution_tier, kExprF64Div, -1111, -2222.3, 2);
}
WASM_EXEC_TEST(Float64Unops) {
TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 108, 108.125);
TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 209, -209.125);
TestFloat64UnopWithConvert(execution_mode, kExprF64Neg, -209, 209.125);
TestFloat64UnopWithConvert(execution_mode, kExprF64Sqrt, 13, 169.4);
TestFloat64UnopWithConvert(execution_tier, kExprF64Abs, 108, 108.125);
TestFloat64UnopWithConvert(execution_tier, kExprF64Abs, 209, -209.125);
TestFloat64UnopWithConvert(execution_tier, kExprF64Neg, -209, 209.125);
TestFloat64UnopWithConvert(execution_tier, kExprF64Sqrt, 13, 169.4);
}
WASM_EXEC_TEST(Float32Neg) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
......@@ -610,7 +610,7 @@ WASM_EXEC_TEST(Float32Neg) {
}
WASM_EXEC_TEST(Float64Neg) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
......@@ -620,7 +620,7 @@ WASM_EXEC_TEST(Float64Neg) {
}
WASM_EXEC_TEST(IfElse_P) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// if (p0) return 11; else return 22;
BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // --
WASM_I32V_1(11), // --
......@@ -632,34 +632,34 @@ WASM_EXEC_TEST(IfElse_P) {
}
WASM_EXEC_TEST(If_empty1) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprEnd, WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 9, *i)); }
}
WASM_EXEC_TEST(IfElse_empty1) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, kExprEnd,
WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 8, *i)); }
}
WASM_EXEC_TEST(IfElse_empty2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, WASM_NOP, kExprElse,
kExprEnd, WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 7, *i)); }
}
WASM_EXEC_TEST(IfElse_empty3) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, WASM_NOP,
kExprEnd, WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 6, *i)); }
}
WASM_EXEC_TEST(If_chain1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// if (p0) 13; if (p0) 14; 15
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP),
WASM_IF(WASM_GET_LOCAL(0), WASM_NOP), WASM_I32V_1(15));
......@@ -667,7 +667,7 @@ WASM_EXEC_TEST(If_chain1) {
}
WASM_EXEC_TEST(If_chain_set) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// if (p0) p1 = 73; if (p0) p1 = 74; p1
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(73))),
WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(74))),
......@@ -679,7 +679,7 @@ WASM_EXEC_TEST(If_chain_set) {
}
WASM_EXEC_TEST(IfElse_Unreachable1) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// 0 ? unreachable : 27
BUILD(r, WASM_IF_ELSE_I(WASM_ZERO, // --
WASM_UNREACHABLE, // --
......@@ -688,7 +688,7 @@ WASM_EXEC_TEST(IfElse_Unreachable1) {
}
WASM_EXEC_TEST(IfElse_Unreachable2) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// 1 ? 28 : unreachable
BUILD(r, WASM_IF_ELSE_I(WASM_I32V_1(1), // --
WASM_I32V_1(28), // --
......@@ -697,21 +697,21 @@ WASM_EXEC_TEST(IfElse_Unreachable2) {
}
WASM_EXEC_TEST(Return12) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, RET_I8(12));
CHECK_EQ(12, r.Call());
}
WASM_EXEC_TEST(Return17) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(RET_I8(17)), WASM_ZERO);
CHECK_EQ(17, r.Call());
}
WASM_EXEC_TEST(Return_I32) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, RET(WASM_GET_LOCAL(0)));
......@@ -719,7 +719,7 @@ WASM_EXEC_TEST(Return_I32) {
}
WASM_EXEC_TEST(Return_F32) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, RET(WASM_GET_LOCAL(0)));
......@@ -735,7 +735,7 @@ WASM_EXEC_TEST(Return_F32) {
}
WASM_EXEC_TEST(Return_F64) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, RET(WASM_GET_LOCAL(0)));
......@@ -751,7 +751,7 @@ WASM_EXEC_TEST(Return_F64) {
}
WASM_EXEC_TEST(Select_float_parameters) {
WasmRunner<float, float, float, int32_t> r(execution_mode);
WasmRunner<float, float, float, int32_t> r(execution_tier);
// return select(11, 22, a);
BUILD(r,
WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)));
......@@ -759,7 +759,7 @@ WASM_EXEC_TEST(Select_float_parameters) {
}
WASM_EXEC_TEST(Select) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// return select(11, 22, a);
BUILD(r, WASM_SELECT(WASM_I32V_1(11), WASM_I32V_1(22), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
......@@ -769,7 +769,7 @@ WASM_EXEC_TEST(Select) {
}
WASM_EXEC_TEST(Select_strict1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// select(a=0, a=1, a=2); return a
BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(0, WASM_ZERO),
WASM_TEE_LOCAL(0, WASM_I32V_1(1)),
......@@ -779,7 +779,7 @@ WASM_EXEC_TEST(Select_strict1) {
}
WASM_EXEC_TEST(Select_strict2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmI32);
// select(b=5, c=6, a)
......@@ -792,7 +792,7 @@ WASM_EXEC_TEST(Select_strict2) {
}
WASM_EXEC_TEST(Select_strict3) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmI32);
// select(b=5, c=6, a=b)
......@@ -806,7 +806,7 @@ WASM_EXEC_TEST(Select_strict3) {
}
WASM_EXEC_TEST(BrIf_strict) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0),
WASM_TEE_LOCAL(0, WASM_I32V_2(99)))));
......@@ -814,7 +814,7 @@ WASM_EXEC_TEST(BrIf_strict) {
}
WASM_EXEC_TEST(Br_height) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(
WASM_BLOCK(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)),
WASM_RETURN1(WASM_I32V_1(9))),
......@@ -827,7 +827,7 @@ WASM_EXEC_TEST(Br_height) {
}
WASM_EXEC_TEST(Regression_660262) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, kExprI32Const, 0x00, kExprI32Const, 0x00, kExprI32LoadMem, 0x00,
0x0F, kExprBrTable, 0x00, 0x80, 0x00); // entries=0
......@@ -835,14 +835,14 @@ WASM_EXEC_TEST(Regression_660262) {
}
WASM_EXEC_TEST(BrTable0a) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))),
WASM_I32V_2(91));
FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); }
}
WASM_EXEC_TEST(BrTable0b) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r,
B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0)))),
WASM_I32V_2(92));
......@@ -850,7 +850,7 @@ WASM_EXEC_TEST(BrTable0b) {
}
WASM_EXEC_TEST(BrTable0c) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(
r,
B1(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(1))),
......@@ -863,13 +863,13 @@ WASM_EXEC_TEST(BrTable0c) {
}
WASM_EXEC_TEST(BrTable1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), RET_I8(93));
FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(*i)); }
}
WASM_EXEC_TEST(BrTable_loop) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r,
B2(B1(WASM_LOOP(WASM_BR_TABLE(WASM_INC_LOCAL_BYV(0, 1), 2, BR_TARGET(2),
BR_TARGET(1), BR_TARGET(0)))),
......@@ -883,7 +883,7 @@ WASM_EXEC_TEST(BrTable_loop) {
}
WASM_EXEC_TEST(BrTable_br) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r,
B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(1), BR_TARGET(0))),
RET_I8(91)),
......@@ -895,7 +895,7 @@ WASM_EXEC_TEST(BrTable_br) {
}
WASM_EXEC_TEST(BrTable_br2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(1),
BR_TARGET(2), BR_TARGET(3), BR_TARGET(0))),
......@@ -926,7 +926,7 @@ WASM_EXEC_TEST(BrTable4) {
RET_I8(73)),
WASM_I32V_2(75)};
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
for (int x = -3; x < 50; ++x) {
......@@ -956,7 +956,7 @@ WASM_EXEC_TEST(BrTable4x4) {
RET_I8(53)),
WASM_I32V_2(55)};
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
for (int x = -6; x < 47; ++x) {
......@@ -981,7 +981,7 @@ WASM_EXEC_TEST(BrTable4_fallthru) {
WASM_INC_LOCAL_BY(1, 8)),
WASM_GET_LOCAL(1)};
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
CHECK_EQ(15, r.Call(0, 0));
......@@ -1005,14 +1005,14 @@ WASM_EXEC_TEST(BrTable_loop_target) {
BR_TARGET(0), BR_TARGET(1), BR_TARGET(1))),
WASM_ONE)};
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
CHECK_EQ(1, r.Call(0));
}
WASM_EXEC_TEST(F32ReinterpretI32) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
......@@ -1027,7 +1027,7 @@ WASM_EXEC_TEST(F32ReinterpretI32) {
}
WASM_EXEC_TEST(I32ReinterpretF32) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
......@@ -1046,7 +1046,7 @@ WASM_EXEC_TEST(I32ReinterpretF32) {
#ifndef USE_SIMULATOR
WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_I32_REINTERPRET_F32(
WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xA0, 0x7F)));
......@@ -1058,7 +1058,7 @@ WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) {
#endif
WASM_EXEC_TEST(LoadMaxUint32Offset) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_OFFSET(MachineType::Int32(), // type
......@@ -1069,7 +1069,7 @@ WASM_EXEC_TEST(LoadMaxUint32Offset) {
}
WASM_EXEC_TEST(LoadStoreLoad) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
......@@ -1085,28 +1085,28 @@ WASM_EXEC_TEST(LoadStoreLoad) {
}
WASM_EXEC_TEST(UnalignedFloat32Load) {
WasmRunner<float> r(execution_mode);
WasmRunner<float> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Float32(), WASM_ONE, 2));
r.Call();
}
WASM_EXEC_TEST(UnalignedFloat64Load) {
WasmRunner<double> r(execution_mode);
WasmRunner<double> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Float64(), WASM_ONE, 3));
r.Call();
}
WASM_EXEC_TEST(UnalignedInt32Load) {
WasmRunner<uint32_t> r(execution_mode);
WasmRunner<uint32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int32(), WASM_ONE, 2));
r.Call();
}
WASM_EXEC_TEST(UnalignedInt32Store) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ONE, 2,
WASM_I32V_1(1)),
......@@ -1115,7 +1115,7 @@ WASM_EXEC_TEST(UnalignedInt32Store) {
}
WASM_EXEC_TEST(UnalignedFloat32Store) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Float32(), WASM_ONE,
2, WASM_F32(1.0)),
......@@ -1124,7 +1124,7 @@ WASM_EXEC_TEST(UnalignedFloat32Store) {
}
WASM_EXEC_TEST(UnalignedFloat64Store) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Float64(), WASM_ONE,
3, WASM_F64(1.0)),
......@@ -1134,7 +1134,7 @@ WASM_EXEC_TEST(UnalignedFloat64Store) {
WASM_EXEC_TEST(VoidReturn1) {
const int32_t kExpected = -414444;
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// Build the test function.
WasmFunctionCompiler& test_func = r.NewFunction<void>();
......@@ -1151,7 +1151,7 @@ WASM_EXEC_TEST(VoidReturn1) {
WASM_EXEC_TEST(VoidReturn2) {
const int32_t kExpected = -414444;
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// Build the test function.
WasmFunctionCompiler& test_func = r.NewFunction<void>();
......@@ -1167,67 +1167,67 @@ WASM_EXEC_TEST(VoidReturn2) {
}
WASM_EXEC_TEST(BrEmpty) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BRV(0, WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(BrIfEmpty) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Block_empty) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprBlock, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Block_empty_br1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_BR(0)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Block_empty_brif1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Block_empty_brif2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
}
WASM_EXEC_TEST(Block_i) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Block_f) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_BLOCK_F(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Block_d) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_BLOCK_D(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Block_br2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, static_cast<uint32_t>(r.Call(*i))); }
}
WASM_EXEC_TEST(Block_If_P) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// block { if (p0) break 51; 52; }
BUILD(r, WASM_BLOCK_I( // --
WASM_IF(WASM_GET_LOCAL(0), // --
......@@ -1240,49 +1240,49 @@ WASM_EXEC_TEST(Block_If_P) {
}
WASM_EXEC_TEST(Loop_empty) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprLoop, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_i) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_f) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_LOOP_F(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_d) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_LOOP_D(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_empty_br1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_BR(1))), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_empty_brif1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_BR_IF(1, WASM_ZERO))), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_empty_brif2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_BRV_IF(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
}
WASM_EXEC_TEST(Loop_empty_brif3) {
WasmRunner<uint32_t, uint32_t, uint32_t, uint32_t> r(execution_mode);
WasmRunner<uint32_t, uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_BRV_IFD(1, WASM_GET_LOCAL(2), WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) {
......@@ -1294,7 +1294,7 @@ WASM_EXEC_TEST(Loop_empty_brif3) {
}
WASM_EXEC_TEST(Block_BrIf_P) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(51), WASM_GET_LOCAL(0)),
WASM_I32V_1(52)));
FOR_INT32_INPUTS(i) {
......@@ -1304,7 +1304,7 @@ WASM_EXEC_TEST(Block_BrIf_P) {
}
WASM_EXEC_TEST(Block_IfElse_P_assign) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// { if (p0) p0 = 71; else p0 = 72; return p0; }
BUILD(r, // --
WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
......@@ -1318,7 +1318,7 @@ WASM_EXEC_TEST(Block_IfElse_P_assign) {
}
WASM_EXEC_TEST(Block_IfElse_P_return) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// if (p0) return 81; else return 82;
BUILD(r, // --
WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
......@@ -1332,7 +1332,7 @@ WASM_EXEC_TEST(Block_IfElse_P_return) {
}
WASM_EXEC_TEST(Block_If_P_assign) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// { if (p0) p0 = 61; p0; }
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32V_1(61))),
WASM_GET_LOCAL(0));
......@@ -1343,14 +1343,14 @@ WASM_EXEC_TEST(Block_If_P_assign) {
}
WASM_EXEC_TEST(DanglingAssign) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// { return 0; p0 = 0; }
BUILD(r, WASM_BLOCK_I(RET_I8(99), WASM_TEE_LOCAL(0, WASM_ZERO)));
CHECK_EQ(99, r.Call(1));
}
WASM_EXEC_TEST(ExprIf_P) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 ? 11 : 22;
BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // --
WASM_I32V_1(11), // --
......@@ -1362,7 +1362,7 @@ WASM_EXEC_TEST(ExprIf_P) {
}
WASM_EXEC_TEST(CountDown) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_IFB(WASM_GET_LOCAL(0),
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0),
WASM_I32V_1(1))),
......@@ -1374,7 +1374,7 @@ WASM_EXEC_TEST(CountDown) {
}
WASM_EXEC_TEST(CountDown_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(
r,
WASM_LOOP(
......@@ -1388,7 +1388,7 @@ WASM_EXEC_TEST(CountDown_fallthru) {
}
WASM_EXEC_TEST(WhileCountDown) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_WHILE(WASM_GET_LOCAL(0),
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V_1(1)))),
......@@ -1399,7 +1399,7 @@ WASM_EXEC_TEST(WhileCountDown) {
}
WASM_EXEC_TEST(Loop_if_break1) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(2, WASM_GET_LOCAL(1))),
WASM_SET_LOCAL(0, WASM_I32V_2(99))),
WASM_GET_LOCAL(0));
......@@ -1410,7 +1410,7 @@ WASM_EXEC_TEST(Loop_if_break1) {
}
WASM_EXEC_TEST(Loop_if_break2) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_BRV_IF(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)),
WASM_DROP, WASM_SET_LOCAL(0, WASM_I32V_2(99))),
WASM_GET_LOCAL(0));
......@@ -1421,7 +1421,7 @@ WASM_EXEC_TEST(Loop_if_break2) {
}
WASM_EXEC_TEST(Loop_if_break_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)),
WASM_SET_LOCAL(0, WASM_I32V_2(93)))),
WASM_GET_LOCAL(0));
......@@ -1432,7 +1432,7 @@ WASM_EXEC_TEST(Loop_if_break_fallthru) {
}
WASM_EXEC_TEST(Loop_if_break_fallthru2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)),
WASM_SET_LOCAL(0, WASM_I32V_2(93))))),
WASM_GET_LOCAL(0));
......@@ -1443,7 +1443,7 @@ WASM_EXEC_TEST(Loop_if_break_fallthru2) {
}
WASM_EXEC_TEST(IfBreak1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)),
WASM_I32V_2(91));
CHECK_EQ(91, r.Call(0));
......@@ -1452,7 +1452,7 @@ WASM_EXEC_TEST(IfBreak1) {
}
WASM_EXEC_TEST(IfBreak2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))),
WASM_I32V_2(81));
CHECK_EQ(81, r.Call(0));
......@@ -1461,7 +1461,7 @@ WASM_EXEC_TEST(IfBreak2) {
}
WASM_EXEC_TEST(LoadMemI32) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
......@@ -1480,7 +1480,7 @@ WASM_EXEC_TEST(LoadMemI32) {
WASM_EXEC_TEST(LoadMemI32_alignment) {
for (byte alignment = 0; alignment <= 2; ++alignment) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
......@@ -1500,7 +1500,7 @@ WASM_EXEC_TEST(LoadMemI32_alignment) {
}
WASM_EXEC_TEST(LoadMemI32_oob) {
WasmRunner<int32_t, uint32_t> r(execution_mode);
WasmRunner<int32_t, uint32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
......@@ -1529,7 +1529,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) {
constexpr size_t num_bytes = kWasmPageSize;
for (size_t m = 0; m < arraysize(machineTypes); ++m) {
WasmRunner<int32_t, uint32_t> r(execution_mode);
WasmRunner<int32_t, uint32_t> r(execution_tier);
r.builder().AddMemoryElems<byte>(num_bytes);
r.builder().RandomizeMemory(1116 + static_cast<int>(m));
......@@ -1549,7 +1549,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) {
}
WASM_EXEC_TEST(LoadMemI32_offset) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
......@@ -1581,7 +1581,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) {
for (byte offset = 0; offset < kRunwayLength + 5; ++offset) {
for (uint32_t index = kWasmPageSize - kRunwayLength;
index < kWasmPageSize + 5; ++index) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<byte>(kWasmPageSize);
r.builder().RandomizeMemory();
......@@ -1604,7 +1604,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob) {
for (byte offset = 0; offset < kRunwayLength + 5; offset += 4) {
for (uint32_t index = kWasmPageSize - kRunwayLength;
index < kWasmPageSize + 5; index += 4) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<byte>(kWasmPageSize);
r.builder().RandomizeMemory();
......@@ -1624,7 +1624,7 @@ WASM_EXEC_TEST(StoreMemI32_alignment) {
const int32_t kWritten = 0x12345678;
for (byte i = 0; i <= 2; ++i) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ZERO, i,
......@@ -1639,7 +1639,7 @@ WASM_EXEC_TEST(StoreMemI32_alignment) {
}
WASM_EXEC_TEST(StoreMemI32_offset) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
const int32_t kWritten = 0xAABBCCDD;
......@@ -1672,7 +1672,7 @@ WASM_EXEC_TEST(StoreMem_offset_oob) {
constexpr size_t num_bytes = kWasmPageSize;
for (size_t m = 0; m < arraysize(machineTypes); ++m) {
WasmRunner<int32_t, uint32_t> r(execution_mode);
WasmRunner<int32_t, uint32_t> r(execution_tier);
byte* memory = r.builder().AddMemoryElems<byte>(num_bytes);
r.builder().RandomizeMemory(1119 + static_cast<int>(m));
......@@ -1700,7 +1700,7 @@ WASM_EXEC_TEST(Store_i32_narrowed) {
stored_size_in_bytes = std::max(1, stored_size_in_bytes * 2);
constexpr int kBytes = 24;
uint8_t expected_memory[kBytes] = {0};
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
constexpr uint32_t kPattern = 0x12345678;
......@@ -1724,7 +1724,7 @@ WASM_EXEC_TEST(Store_i32_narrowed) {
WASM_EXEC_TEST(LoadMemI32_P) {
const int kNumElems = 8;
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(2222);
......@@ -1738,7 +1738,7 @@ WASM_EXEC_TEST(LoadMemI32_P) {
WASM_EXEC_TEST(MemI32_Sum) {
const int kNumElems = 20;
WasmRunner<uint32_t, int32_t> r(execution_mode);
WasmRunner<uint32_t, int32_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(int32_t));
const byte kSum = r.AllocateLocal(kWasmI32);
......@@ -1768,7 +1768,7 @@ WASM_EXEC_TEST(MemI32_Sum) {
WASM_EXEC_TEST(CheckMachIntsZero) {
const int kNumElems = 55;
WasmRunner<uint32_t, int32_t> r(execution_mode);
WasmRunner<uint32_t, int32_t> r(execution_tier);
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
BUILD(r, // --
......@@ -1796,7 +1796,7 @@ WASM_EXEC_TEST(CheckMachIntsZero) {
WASM_EXEC_TEST(MemF32_Sum) {
const int kSize = 5;
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().AddMemoryElems<float>(kWasmPageSize / sizeof(float));
float* buffer = r.builder().raw_mem_start<float>();
r.builder().WriteMemory(&buffer[0], -99.25f);
......@@ -1824,10 +1824,9 @@ WASM_EXEC_TEST(MemF32_Sum) {
}
template <typename T>
T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop,
T* buffer, uint32_t size, ValueType astType,
MachineType memType) {
WasmRunner<int32_t, int32_t> r(execution_mode);
T GenerateAndRunFold(ExecutionTier execution_tier, WasmOpcode binop, T* buffer,
uint32_t size, ValueType astType, MachineType memType) {
WasmRunner<int32_t, int32_t> r(execution_tier);
T* memory = r.builder().AddMemoryElems<T>(static_cast<uint32_t>(
RoundUp(size * sizeof(T), kWasmPageSize) / sizeof(sizeof(T))));
for (uint32_t i = 0; i < size; ++i) {
......@@ -1855,19 +1854,19 @@ WASM_EXEC_TEST(MemF64_Mul) {
const size_t kSize = 6;
double buffer[kSize] = {1, 2, 2, 2, 2, 2};
double result =
GenerateAndRunFold<double>(execution_mode, kExprF64Mul, buffer, kSize,
GenerateAndRunFold<double>(execution_tier, kExprF64Mul, buffer, kSize,
kWasmF64, MachineType::Float64());
CHECK_EQ(32, result);
}
WASM_EXEC_TEST(Build_Wasm_Infinite_Loop) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// Only build the graph and compile, don't run.
BUILD(r, WASM_INFINITE_LOOP, WASM_ZERO);
}
WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
// Only build the graph and compile, don't run.
......@@ -1876,49 +1875,49 @@ WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) {
}
WASM_EXEC_TEST(Unreachable0a) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(9)), RET(WASM_GET_LOCAL(0))));
CHECK_EQ(9, r.Call(0));
CHECK_EQ(9, r.Call(1));
}
WASM_EXEC_TEST(Unreachable0b) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(7)), WASM_UNREACHABLE));
CHECK_EQ(7, r.Call(0));
CHECK_EQ(7, r.Call(1));
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable3) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_UnreachableIf1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE,
WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_GET_LOCAL(0), WASM_DROP)),
WASM_ZERO);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_UnreachableIf2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE,
WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE));
}
WASM_EXEC_TEST(Unreachable_Load) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)),
WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0))));
......@@ -1927,21 +1926,21 @@ WASM_EXEC_TEST(Unreachable_Load) {
}
WASM_EXEC_TEST(BrV_Fallthrough) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BLOCK(WASM_BRV(1, WASM_I32V_1(42))),
WASM_I32V_1(22)));
CHECK_EQ(42, r.Call());
}
WASM_EXEC_TEST(Infinite_Loop_not_taken1) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I32V_1(45));
// Run the code, but don't go into the infinite loop.
CHECK_EQ(45, r.Call(0));
}
WASM_EXEC_TEST(Infinite_Loop_not_taken2) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(
WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(45)),
WASM_INFINITE_LOOP),
......@@ -1951,7 +1950,7 @@ WASM_EXEC_TEST(Infinite_Loop_not_taken2) {
}
WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I32V_1(45), WASM_GET_LOCAL(0)),
WASM_INFINITE_LOOP));
// Run the code, but don't go into the infinite loop.
......@@ -2005,7 +2004,7 @@ TEST(Build_Wasm_SimpleExprs) {
}
WASM_EXEC_TEST(Int32LoadInt8_signext) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumElems = kWasmPageSize;
int8_t* memory = r.builder().AddMemoryElems<int8_t>(kNumElems);
r.builder().RandomizeMemory();
......@@ -2018,7 +2017,7 @@ WASM_EXEC_TEST(Int32LoadInt8_signext) {
}
WASM_EXEC_TEST(Int32LoadInt8_zeroext) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumElems = kWasmPageSize;
byte* memory = r.builder().AddMemory(kNumElems);
r.builder().RandomizeMemory(77);
......@@ -2031,7 +2030,7 @@ WASM_EXEC_TEST(Int32LoadInt8_zeroext) {
}
WASM_EXEC_TEST(Int32LoadInt16_signext) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumBytes = kWasmPageSize;
byte* memory = r.builder().AddMemory(kNumBytes);
r.builder().RandomizeMemory(888);
......@@ -2045,7 +2044,7 @@ WASM_EXEC_TEST(Int32LoadInt16_signext) {
}
WASM_EXEC_TEST(Int32LoadInt16_zeroext) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumBytes = kWasmPageSize;
byte* memory = r.builder().AddMemory(kNumBytes);
r.builder().RandomizeMemory(9999);
......@@ -2059,7 +2058,7 @@ WASM_EXEC_TEST(Int32LoadInt16_zeroext) {
}
WASM_EXEC_TEST(Int32Global) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* global = r.builder().AddGlobal<int32_t>();
// global = global + p0
BUILD(r,
......@@ -2078,7 +2077,7 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) {
const int kNumGlobals = 3;
for (int g = 0; g < kNumGlobals; ++g) {
// global = global + p0
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* globals[] = {r.builder().AddGlobal<int32_t>(),
r.builder().AddGlobal<int32_t>(),
r.builder().AddGlobal<int32_t>()};
......@@ -2105,7 +2104,7 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) {
}
WASM_EXEC_TEST(Float32Global) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
float* global = r.builder().AddGlobal<float>();
// global = global + p0
BUILD(r, WASM_SET_GLOBAL(
......@@ -2122,7 +2121,7 @@ WASM_EXEC_TEST(Float32Global) {
}
WASM_EXEC_TEST(Float64Global) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
double* global = r.builder().AddGlobal<double>();
// global = global + p0
BUILD(r, WASM_SET_GLOBAL(
......@@ -2139,7 +2138,7 @@ WASM_EXEC_TEST(Float64Global) {
}
WASM_EXEC_TEST(MixedGlobals) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* unused = r.builder().AddGlobal<int32_t>();
byte* memory = r.builder().AddMemory(kWasmPageSize);
......@@ -2178,7 +2177,7 @@ WASM_EXEC_TEST(MixedGlobals) {
WASM_EXEC_TEST(CallEmpty) {
const int32_t kExpected = -414444;
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& target_func = r.NewFunction<int>();
......@@ -2192,7 +2191,7 @@ WASM_EXEC_TEST(CallEmpty) {
}
WASM_EXEC_TEST(CallF32StackParameter) {
WasmRunner<float> r(execution_mode);
WasmRunner<float> r(execution_tier);
// Build the target function.
ValueType param_types[20];
......@@ -2215,7 +2214,7 @@ WASM_EXEC_TEST(CallF32StackParameter) {
}
WASM_EXEC_TEST(CallF64StackParameter) {
WasmRunner<double> r(execution_mode);
WasmRunner<double> r(execution_tier);
// Build the target function.
ValueType param_types[20];
......@@ -2238,7 +2237,7 @@ WASM_EXEC_TEST(CallF64StackParameter) {
}
WASM_EXEC_TEST(CallVoid) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
const byte kMemOffset = 8;
const int32_t kElemNum = kMemOffset / sizeof(int32_t);
......@@ -2263,7 +2262,7 @@ WASM_EXEC_TEST(CallVoid) {
}
WASM_EXEC_TEST(Call_Int32Add) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& t = r.NewFunction<int32_t, int32_t, int32_t>();
......@@ -2283,7 +2282,7 @@ WASM_EXEC_TEST(Call_Int32Add) {
}
WASM_EXEC_TEST(Call_Float32Sub) {
WasmRunner<float, float, float> r(execution_mode);
WasmRunner<float, float, float> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& target_func = r.NewFunction<float, float, float>();
......@@ -2299,7 +2298,7 @@ WASM_EXEC_TEST(Call_Float32Sub) {
}
WASM_EXEC_TEST(Call_Float64Sub) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
double* memory =
r.builder().AddMemoryElems<double>(kWasmPageSize / sizeof(double));
......@@ -2333,7 +2332,7 @@ WASM_EXEC_TEST(Call_Float64Sub) {
for (size_t i = 0; i < sizeof(__buf); ++i) vec.push_back(__buf[i]); \
} while (false)
static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) {
const int kExpected = 6333;
const int kElemSize = 8;
TestSignatures sigs;
......@@ -2349,7 +2348,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
for (int which = 0; which < num_params; ++which) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
MachineType* memtypes = &mixed[start];
MachineType result = memtypes[which];
......@@ -2408,13 +2407,13 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
}
}
WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(execution_mode, 0); }
WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(execution_mode, 1); }
WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(execution_mode, 2); }
WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(execution_mode, 3); }
WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(execution_tier, 0); }
WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(execution_tier, 1); }
WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(execution_tier, 2); }
WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(execution_tier, 3); }
WASM_EXEC_TEST(AddCall) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction<int32_t, int32_t, int32_t>();
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......@@ -2433,7 +2432,7 @@ WASM_EXEC_TEST(AddCall) {
WASM_EXEC_TEST(MultiReturnSub) {
EXPERIMENTAL_FLAG_SCOPE(mv);
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
ValueType storage[] = {kWasmI32, kWasmI32, kWasmI32, kWasmI32};
FunctionSig sig_ii_ii(2, 2, storage);
......@@ -2453,7 +2452,7 @@ WASM_EXEC_TEST(MultiReturnSub) {
}
template <typename T>
void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) {
void RunMultiReturnSelect(ExecutionTier execution_tier, const T* inputs) {
EXPERIMENTAL_FLAG_SCOPE(mv);
ValueType type = ValueTypes::ValueTypeFor(MachineTypeForC<T>());
ValueType storage[] = {type, type, type, type, type, type};
......@@ -2464,7 +2463,7 @@ void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) {
for (size_t i = 0; i < kNumParams; i++) {
for (size_t j = 0; j < kNumParams; j++) {
for (int k = 0; k < 2; k++) {
WasmRunner<T, T, T, T, T> r(execution_mode);
WasmRunner<T, T, T, T, T> r(execution_tier);
WasmFunctionCompiler& r1 = r.NewFunction(&sig);
BUILD(r1, WASM_GET_LOCAL(i), WASM_GET_LOCAL(j));
......@@ -2490,12 +2489,12 @@ void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) {
WASM_EXEC_TEST(MultiReturnSelect_i32) {
static const int32_t inputs[] = {3333333, 4444444, -55555555, -7777777};
RunMultiReturnSelect<int32_t>(execution_mode, inputs);
RunMultiReturnSelect<int32_t>(execution_tier, inputs);
}
WASM_EXEC_TEST(MultiReturnSelect_f32) {
static const float inputs[] = {33.33333f, 444.4444f, -55555.555f, -77777.77f};
RunMultiReturnSelect<float>(execution_mode, inputs);
RunMultiReturnSelect<float>(execution_tier, inputs);
}
WASM_EXEC_TEST(MultiReturnSelect_i64) {
......@@ -2503,17 +2502,17 @@ WASM_EXEC_TEST(MultiReturnSelect_i64) {
// TODO(titzer): implement int64-lowering for multiple return values
static const int64_t inputs[] = {33333338888, 44444446666, -555555553333,
-77777771111};
RunMultiReturnSelect<int64_t>(execution_mode, inputs);
RunMultiReturnSelect<int64_t>(execution_tier, inputs);
#endif
}
WASM_EXEC_TEST(MultiReturnSelect_f64) {
static const double inputs[] = {3.333333, 44444.44, -55.555555, -7777.777};
RunMultiReturnSelect<double>(execution_mode, inputs);
RunMultiReturnSelect<double>(execution_tier, inputs);
}
WASM_EXEC_TEST(ExprBlock2a) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(1))),
WASM_I32V_1(1)));
CHECK_EQ(1, r.Call(0));
......@@ -2521,7 +2520,7 @@ WASM_EXEC_TEST(ExprBlock2a) {
}
WASM_EXEC_TEST(ExprBlock2b) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(1))),
WASM_I32V_1(2)));
CHECK_EQ(2, r.Call(0));
......@@ -2529,7 +2528,7 @@ WASM_EXEC_TEST(ExprBlock2b) {
}
WASM_EXEC_TEST(ExprBlock2c) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(1), WASM_GET_LOCAL(0)),
WASM_I32V_1(1)));
CHECK_EQ(1, r.Call(0));
......@@ -2537,7 +2536,7 @@ WASM_EXEC_TEST(ExprBlock2c) {
}
WASM_EXEC_TEST(ExprBlock2d) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(1), WASM_GET_LOCAL(0)),
WASM_I32V_1(2)));
CHECK_EQ(2, r.Call(0));
......@@ -2545,7 +2544,7 @@ WASM_EXEC_TEST(ExprBlock2d) {
}
WASM_EXEC_TEST(ExprBlock_ManualSwitch) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(1)),
WASM_BRV(1, WASM_I32V_1(11))),
WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(2)),
......@@ -2567,7 +2566,7 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch) {
}
WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(
WASM_BRV_IFD(0, WASM_I32V_1(11),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(1))),
......@@ -2590,7 +2589,7 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) {
}
WASM_EXEC_TEST(If_nested) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(
r,
......@@ -2606,7 +2605,7 @@ WASM_EXEC_TEST(If_nested) {
}
WASM_EXEC_TEST(ExprBlock_if) {
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE_I(WASM_GET_LOCAL(0),
WASM_BRV(0, WASM_I32V_1(11)),
......@@ -2617,7 +2616,7 @@ WASM_EXEC_TEST(ExprBlock_if) {
}
WASM_EXEC_TEST(ExprBlock_nested_ifs) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE_I(
WASM_GET_LOCAL(0),
......@@ -2634,7 +2633,7 @@ WASM_EXEC_TEST(ExprBlock_nested_ifs) {
WASM_EXEC_TEST(SimpleCallIndirect) {
TestSignatures sigs;
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......@@ -2668,7 +2667,7 @@ WASM_EXEC_TEST(SimpleCallIndirect) {
WASM_EXEC_TEST(MultipleCallIndirect) {
TestSignatures sigs;
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......@@ -2711,7 +2710,7 @@ WASM_EXEC_TEST(MultipleCallIndirect) {
WASM_EXEC_TEST(CallIndirect_EmptyTable) {
TestSignatures sigs;
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
// One function.
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
......@@ -2734,7 +2733,7 @@ WASM_EXEC_TEST(CallIndirect_EmptyTable) {
WASM_EXEC_TEST(CallIndirect_canonical) {
TestSignatures sigs;
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......@@ -2776,63 +2775,63 @@ WASM_EXEC_TEST(CallIndirect_canonical) {
}
WASM_EXEC_TEST(F32Floor) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F32Ceil) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F32Trunc) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F32NearestInt) {
WasmRunner<float, float> r(execution_mode);
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F64Floor) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_FLOOR(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F64Ceil) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_CEIL(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F64Trunc) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_TRUNC(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F64NearestInt) {
WasmRunner<double, double> r(execution_mode);
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_NEARESTINT(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(F32Min) {
WasmRunner<float, float, float> r(execution_mode);
WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
......@@ -2841,7 +2840,7 @@ WASM_EXEC_TEST(F32Min) {
}
WASM_EXEC_TEST(F64Min) {
WasmRunner<double, double, double> r(execution_mode);
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
......@@ -2850,7 +2849,7 @@ WASM_EXEC_TEST(F64Min) {
}
WASM_EXEC_TEST(F32Max) {
WasmRunner<float, float, float> r(execution_mode);
WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
......@@ -2859,7 +2858,7 @@ WASM_EXEC_TEST(F32Max) {
}
WASM_EXEC_TEST(F64Max) {
WasmRunner<double, double, double> r(execution_mode);
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
......@@ -2871,7 +2870,7 @@ WASM_EXEC_TEST(F64Max) {
}
WASM_EXEC_TEST(I32SConvertF32) {
WasmRunner<int32_t, float> r(execution_mode);
WasmRunner<int32_t, float> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
......@@ -2885,7 +2884,7 @@ WASM_EXEC_TEST(I32SConvertF32) {
WASM_EXEC_TEST(I32SConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<int32_t, float> r(execution_mode);
WasmRunner<int32_t, float> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
......@@ -2901,7 +2900,7 @@ WASM_EXEC_TEST(I32SConvertSatF32) {
}
WASM_EXEC_TEST(I32SConvertF64) {
WasmRunner<int32_t, double> r(execution_mode);
WasmRunner<int32_t, double> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
......@@ -2915,7 +2914,7 @@ WASM_EXEC_TEST(I32SConvertF64) {
WASM_EXEC_TEST(I32SConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<int32_t, double> r(execution_mode);
WasmRunner<int32_t, double> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
......@@ -2930,7 +2929,7 @@ WASM_EXEC_TEST(I32SConvertSatF64) {
}
WASM_EXEC_TEST(I32UConvertF32) {
WasmRunner<uint32_t, float> r(execution_mode);
WasmRunner<uint32_t, float> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
if (is_inbounds<uint32_t>(*i)) {
......@@ -2943,7 +2942,7 @@ WASM_EXEC_TEST(I32UConvertF32) {
WASM_EXEC_TEST(I32UConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<uint32_t, float> r(execution_mode);
WasmRunner<uint32_t, float> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int32_t expected =
......@@ -2958,7 +2957,7 @@ WASM_EXEC_TEST(I32UConvertSatF32) {
}
WASM_EXEC_TEST(I32UConvertF64) {
WasmRunner<uint32_t, double> r(execution_mode);
WasmRunner<uint32_t, double> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
if (is_inbounds<uint32_t>(*i)) {
......@@ -2971,7 +2970,7 @@ WASM_EXEC_TEST(I32UConvertF64) {
WASM_EXEC_TEST(I32UConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
WasmRunner<uint32_t, double> r(execution_mode);
WasmRunner<uint32_t, double> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
......@@ -2986,7 +2985,7 @@ WASM_EXEC_TEST(I32UConvertSatF64) {
}
WASM_EXEC_TEST(F64CopySign) {
WasmRunner<double, double, double> r(execution_mode);
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
......@@ -2995,7 +2994,7 @@ WASM_EXEC_TEST(F64CopySign) {
}
WASM_EXEC_TEST(F32CopySign) {
WasmRunner<float, float, float> r(execution_mode);
WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
......@@ -3003,12 +3002,12 @@ WASM_EXEC_TEST(F32CopySign) {
}
}
static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) {
// Make sure we don't run out of registers when compiling indirect calls
// with many many parameters.
TestSignatures sigs;
for (byte num_params = 0; num_params < 40; ++num_params) {
WasmRunner<void> r(mode);
WasmRunner<void> r(tier);
FunctionSig* sig = sigs.many(r.zone(), kWasmStmt, param, num_params);
r.builder().AddSignature(sig);
......@@ -3029,19 +3028,19 @@ static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
}
WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_i32) {
CompileCallIndirectMany(execution_mode, kWasmI32);
CompileCallIndirectMany(execution_tier, kWasmI32);
}
WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_f32) {
CompileCallIndirectMany(execution_mode, kWasmF32);
CompileCallIndirectMany(execution_tier, kWasmF32);
}
WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_f64) {
CompileCallIndirectMany(execution_mode, kWasmF64);
CompileCallIndirectMany(execution_tier, kWasmF64);
}
WASM_EXEC_TEST(Int32RemS_dead) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
WASM_ZERO);
const int32_t kMin = std::numeric_limits<int32_t>::min();
......@@ -3054,7 +3053,7 @@ WASM_EXEC_TEST(Int32RemS_dead) {
}
WASM_EXEC_TEST(BrToLoopWithValue) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// Subtracts <1> times 3 from <0> and returns the result.
BUILD(r,
// loop i32
......@@ -3074,7 +3073,7 @@ WASM_EXEC_TEST(BrToLoopWithValue) {
WASM_EXEC_TEST(BrToLoopWithoutValue) {
// This was broken in the interpreter, see http://crbug.com/715454
WasmRunner<int32_t, int32_t> r(execution_mode);
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(
r, kExprLoop, kLocalI32, // loop i32
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_ONE)), // dec <0>
......@@ -3085,31 +3084,31 @@ WASM_EXEC_TEST(BrToLoopWithoutValue) {
}
WASM_EXEC_TEST(LoopsWithValues) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_LOOP_I(WASM_ONE), WASM_ONE, kExprI32Add));
CHECK_EQ(2, r.Call());
}
WASM_EXEC_TEST(InvalidStackAfterUnreachable) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, kExprUnreachable, kExprI32Add);
CHECK_TRAP32(r.Call());
}
WASM_EXEC_TEST(InvalidStackAfterBr) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BRV(0, WASM_I32V_1(27)), kExprI32Add);
CHECK_EQ(27, r.Call());
}
WASM_EXEC_TEST(InvalidStackAfterReturn) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_RETURN1(WASM_I32V_1(17)), kExprI32Add);
CHECK_EQ(17, r.Call());
}
WASM_EXEC_TEST(BranchOverUnreachableCode) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r,
// Start a block which breaks in the middle (hence unreachable code
// afterwards) and continue execution after this block.
......@@ -3120,7 +3119,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCode) {
}
WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop0) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r,
WASM_BLOCK_I(
// Start a loop which breaks in the middle (hence unreachable code
......@@ -3134,7 +3133,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop0) {
}
WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop1) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r,
WASM_BLOCK_I(
// Start a loop which breaks in the middle (hence unreachable code
......@@ -3147,7 +3146,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop1) {
}
WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop2) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r,
WASM_BLOCK_I(
// Start a loop which breaks in the middle (hence unreachable code
......@@ -3161,13 +3160,13 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop2) {
}
WASM_EXEC_TEST(BlockInsideUnreachable) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_RETURN1(WASM_I32V_1(17)), WASM_BLOCK(WASM_BR(0)));
CHECK_EQ(17, r.Call());
}
WASM_EXEC_TEST(IfInsideUnreachable) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
BUILD(
r, WASM_RETURN1(WASM_I32V_1(17)),
WASM_IF_ELSE_I(WASM_ONE, WASM_BRV(0, WASM_ONE), WASM_RETURN1(WASM_ONE)));
......@@ -3181,9 +3180,8 @@ WASM_EXEC_TEST(IfInsideUnreachable) {
// not overwritten.
template <typename ctype>
void BinOpOnDifferentRegisters(
WasmExecutionMode execution_mode, ValueType type,
Vector<const ctype> inputs, WasmOpcode opcode,
std::function<ctype(ctype, ctype, bool*)> expect_fn) {
ExecutionTier execution_tier, ValueType type, Vector<const ctype> inputs,
WasmOpcode opcode, std::function<ctype(ctype, ctype, bool*)> expect_fn) {
static constexpr int kMaxNumLocals = 8;
for (int num_locals = 1; num_locals < kMaxNumLocals; ++num_locals) {
// {init_locals_code} is shared by all code generated in the loop below.
......@@ -3206,7 +3204,7 @@ void BinOpOnDifferentRegisters(
}
for (int lhs = 0; lhs < num_locals; ++lhs) {
for (int rhs = 0; rhs < num_locals; ++rhs) {
WasmRunner<int32_t> r(execution_mode);
WasmRunner<int32_t> r(execution_tier);
ctype* memory =
r.builder().AddMemoryElems<ctype>(kWasmPageSize / sizeof(ctype));
for (int i = 0; i < num_locals; ++i) {
......@@ -3261,37 +3259,37 @@ static constexpr int64_t kSome64BitInputs[] = {
WASM_EXEC_TEST(I32AddOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Add,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Add,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs + rhs; });
}
WASM_EXEC_TEST(I32SubOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Sub,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Sub,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs - rhs; });
}
WASM_EXEC_TEST(I32MulOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Mul,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Mul,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs * rhs; });
}
WASM_EXEC_TEST(I32ShlOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs << (rhs & 31); });
}
WASM_EXEC_TEST(I32ShrSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrS,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrS,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs >> (rhs & 31); });
}
WASM_EXEC_TEST(I32ShrUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrU,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrU,
[](int32_t lhs, int32_t rhs, bool* trap) {
return static_cast<uint32_t>(lhs) >> (rhs & 31);
});
......@@ -3299,7 +3297,7 @@ WASM_EXEC_TEST(I32ShrUOnDifferentRegisters) {
WASM_EXEC_TEST(I32DivSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivS,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivS,
[](int32_t lhs, int32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs / rhs;
......@@ -3308,7 +3306,7 @@ WASM_EXEC_TEST(I32DivSOnDifferentRegisters) {
WASM_EXEC_TEST(I32DivUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivU,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivU,
[](uint32_t lhs, uint32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs / rhs;
......@@ -3317,7 +3315,7 @@ WASM_EXEC_TEST(I32DivUOnDifferentRegisters) {
WASM_EXEC_TEST(I32RemSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemS,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemS,
[](int32_t lhs, int32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap || rhs == -1 ? 0 : lhs % rhs;
......@@ -3326,7 +3324,7 @@ WASM_EXEC_TEST(I32RemSOnDifferentRegisters) {
WASM_EXEC_TEST(I32RemUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemU,
execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemU,
[](uint32_t lhs, uint32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs % rhs;
......@@ -3335,37 +3333,37 @@ WASM_EXEC_TEST(I32RemUOnDifferentRegisters) {
WASM_EXEC_TEST(I64AddOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Add,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Add,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs + rhs; });
}
WASM_EXEC_TEST(I64SubOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Sub,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Sub,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs - rhs; });
}
WASM_EXEC_TEST(I64MulOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Mul,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Mul,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs * rhs; });
}
WASM_EXEC_TEST(I64ShlOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs << (rhs & 63); });
}
WASM_EXEC_TEST(I64ShrSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrS,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrS,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs >> (rhs & 63); });
}
WASM_EXEC_TEST(I64ShrUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrU,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrU,
[](int64_t lhs, int64_t rhs, bool* trap) {
return static_cast<uint64_t>(lhs) >> (rhs & 63);
});
......@@ -3373,7 +3371,7 @@ WASM_EXEC_TEST(I64ShrUOnDifferentRegisters) {
WASM_EXEC_TEST(I64DivSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivS,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivS,
[](int64_t lhs, int64_t rhs, bool* trap) {
*trap = rhs == 0 ||
(rhs == -1 && lhs == std::numeric_limits<int64_t>::min());
......@@ -3383,7 +3381,7 @@ WASM_EXEC_TEST(I64DivSOnDifferentRegisters) {
WASM_EXEC_TEST(I64DivUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivU,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivU,
[](uint64_t lhs, uint64_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs / rhs;
......@@ -3392,7 +3390,7 @@ WASM_EXEC_TEST(I64DivUOnDifferentRegisters) {
WASM_EXEC_TEST(I64RemSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemS,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemS,
[](int64_t lhs, int64_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap || rhs == -1 ? 0 : lhs % rhs;
......@@ -3401,7 +3399,7 @@ WASM_EXEC_TEST(I64RemSOnDifferentRegisters) {
WASM_EXEC_TEST(I64RemUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemU,
execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemU,
[](uint64_t lhs, uint64_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs % rhs;
......@@ -3409,7 +3407,7 @@ WASM_EXEC_TEST(I64RemUOnDifferentRegisters) {
}
TEST(Liftoff_tier_up) {
WasmRunner<int32_t, int32_t, int32_t> r(WasmExecutionMode::kExecuteLiftoff);
WasmRunner<int32_t, int32_t, int32_t> r(ExecutionTier::kBaseline);
WasmFunctionCompiler& add = r.NewFunction<int32_t, int32_t, int32_t>("add");
BUILD(add, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......
......@@ -242,7 +242,7 @@ std::vector<WasmValue> wasmVec(Args... args) {
} // namespace
WASM_COMPILED_EXEC_TEST(WasmCollectPossibleBreakpoints) {
WasmRunner<int> runner(execution_mode);
WasmRunner<int> runner(execution_tier);
BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_ZERO, WASM_ONE));
......@@ -269,7 +269,7 @@ WASM_COMPILED_EXEC_TEST(WasmCollectPossibleBreakpoints) {
}
WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) {
WasmRunner<int> runner(execution_mode);
WasmRunner<int> runner(execution_tier);
Isolate* isolate = runner.main_isolate();
BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(3)));
......@@ -290,7 +290,7 @@ WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) {
}
WASM_COMPILED_EXEC_TEST(WasmSimpleStepping) {
WasmRunner<int> runner(execution_mode);
WasmRunner<int> runner(execution_tier);
BUILD(runner, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(3)));
Isolate* isolate = runner.main_isolate();
......@@ -317,7 +317,7 @@ WASM_COMPILED_EXEC_TEST(WasmSimpleStepping) {
}
WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) {
WasmRunner<int, int> runner(execution_mode);
WasmRunner<int, int> runner(execution_tier);
WasmFunctionCompiler& f2 = runner.NewFunction<void>();
f2.AllocateLocal(kWasmI32);
......@@ -357,7 +357,7 @@ WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) {
}
WASM_COMPILED_EXEC_TEST(WasmGetLocalsAndStack) {
WasmRunner<void, int> runner(execution_mode);
WasmRunner<void, int> runner(execution_tier);
runner.AllocateLocal(kWasmI64);
runner.AllocateLocal(kWasmF32);
runner.AllocateLocal(kWasmF64);
......
......@@ -91,7 +91,7 @@ static ArgPassingHelper<T> GetHelper(
// Pass int32_t, return int32_t.
TEST(TestArgumentPassing_int32) {
WasmRunner<int32_t, int32_t> runner(kExecuteTurbofan);
WasmRunner<int32_t, int32_t> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<int32_t, int32_t>();
auto helper = GetHelper(
......@@ -107,7 +107,7 @@ TEST(TestArgumentPassing_int32) {
// Pass int64_t, return double.
TEST(TestArgumentPassing_double_int64) {
WasmRunner<double, int32_t, int32_t> runner(kExecuteTurbofan);
WasmRunner<double, int32_t, int32_t> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<double, int64_t>();
auto helper = GetHelper(
......@@ -140,7 +140,7 @@ TEST(TestArgumentPassing_double_int64) {
// Pass double, return int64_t.
TEST(TestArgumentPassing_int64_double) {
// Outer function still returns double.
WasmRunner<double, double> runner(kExecuteTurbofan);
WasmRunner<double, double> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<int64_t, double>();
auto helper = GetHelper(
......@@ -159,7 +159,7 @@ TEST(TestArgumentPassing_int64_double) {
// Pass float, return double.
TEST(TestArgumentPassing_float_double) {
WasmRunner<double, float> runner(kExecuteTurbofan);
WasmRunner<double, float> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<double, float>();
auto helper = GetHelper(
......@@ -177,7 +177,7 @@ TEST(TestArgumentPassing_float_double) {
// Pass two doubles, return double.
TEST(TestArgumentPassing_double_double) {
WasmRunner<double, double, double> runner(kExecuteTurbofan);
WasmRunner<double, double, double> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<double, double, double>();
auto helper = GetHelper(runner, f2,
......@@ -197,7 +197,7 @@ TEST(TestArgumentPassing_double_double) {
TEST(TestArgumentPassing_AllTypes) {
// The second and third argument will be combined to an i64.
WasmRunner<double, int32_t, int32_t, int32_t, float, double> runner(
kExecuteTurbofan);
ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 =
runner.NewFunction<double, int32_t, int64_t, float, double>();
......
......@@ -355,8 +355,7 @@ TEST(SharedEngineRunThreadedTierUp) {
WasmCompilationUnit::CompileWasmFunction(
module.get(), &thrower, isolate.isolate(),
GetModuleEnv(module->compilation_state()),
&module->module()->functions[0],
WasmCompilationUnit::CompilationMode::kTurbofan);
&module->module()->functions[0], ExecutionTier::kOptimized);
CHECK_EQ(23, isolate.Run(instance));
});
for (auto& thread : threads) thread.Start();
......
......@@ -111,7 +111,7 @@ WASM_EXEC_TEST(CollectDetailedWasmStack_ExplicitThrowFromJs) {
*v8::Local<v8::Function>::Cast(CompileRun(source))));
ManuallyImportedJSFunction import = {sigs.v_v(), js_function};
uint32_t js_throwing_index = 0;
WasmRunner<void> r(execution_mode, &import);
WasmRunner<void> r(execution_tier, &import);
// Add a nop such that we don't always get position 1.
BUILD(r, WASM_NOP, WASM_CALL_FUNCTION0(js_throwing_index));
......@@ -157,7 +157,7 @@ WASM_EXEC_TEST(CollectDetailedWasmStack_WasmError) {
int unreachable_pos = 1 << (8 * pos_shift);
TestSignatures sigs;
// Create a WasmRunner with stack checks and traps enabled.
WasmRunner<int> r(execution_mode, 0, "main", kRuntimeExceptionSupport);
WasmRunner<int> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
std::vector<byte> code(unreachable_pos + 1, kExprNop);
code[unreachable_pos] = kExprUnreachable;
......
......@@ -69,7 +69,7 @@ void CheckExceptionInfos(v8::internal::Isolate* i_isolate, Handle<Object> exc,
// Trigger a trap for executing unreachable.
WASM_EXEC_TEST(Unreachable) {
// Create a WasmRunner with stack checks and traps enabled.
WasmRunner<void> r(execution_mode, 0, "main", kRuntimeExceptionSupport);
WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
TestSignatures sigs;
BUILD(r, WASM_UNREACHABLE);
......@@ -103,7 +103,7 @@ WASM_EXEC_TEST(Unreachable) {
// Trigger a trap for loading from out-of-bounds.
WASM_EXEC_TEST(IllegalLoad) {
WasmRunner<void> r(execution_mode, 0, "main", kRuntimeExceptionSupport);
WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
TestSignatures sigs;
r.builder().AddMemory(0L);
......
......@@ -14,14 +14,13 @@ namespace internal {
namespace wasm {
TestingModuleBuilder::TestingModuleBuilder(
Zone* zone, ManuallyImportedJSFunction* maybe_import,
WasmExecutionMode mode, RuntimeExceptionSupport exception_support,
LowerSimd lower_simd)
Zone* zone, ManuallyImportedJSFunction* maybe_import, ExecutionTier tier,
RuntimeExceptionSupport exception_support, LowerSimd lower_simd)
: test_module_(std::make_shared<WasmModule>()),
test_module_ptr_(test_module_.get()),
isolate_(CcTest::InitIsolateOnce()),
enabled_features_(WasmFeaturesFromIsolate(isolate_)),
execution_mode_(mode),
execution_tier_(tier),
runtime_exception_support_(exception_support),
lower_simd_(lower_simd) {
WasmJs::Install(isolate_, true);
......@@ -54,7 +53,7 @@ TestingModuleBuilder::TestingModuleBuilder(
.set_wasm_to_js(*maybe_import->js_function, wasm_to_js_wrapper);
}
if (mode == kExecuteInterpreter) {
if (tier == ExecutionTier::kInterpreter) {
interpreter_ = WasmDebugInfo::SetupForTesting(instance_object_);
}
}
......@@ -403,6 +402,13 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
interpreter_->SetFunctionCodeForTesting(function_, start, end);
}
// TODO(wasm): tests that go through JS depend on having a compiled version
// of each function, even if the execution tier is the interpreter. Fix.
auto tier = builder_->execution_tier();
if (tier == ExecutionTier::kInterpreter) {
tier = ExecutionTier::kOptimized;
}
Vector<const uint8_t> wire_bytes = builder_->instance_object()
->module_object()
->native_module()
......@@ -421,15 +427,11 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
FunctionBody func_body{function_->sig, function_->code.offset(),
func_wire_bytes.start(), func_wire_bytes.end()};
WasmCompilationUnit::CompilationMode comp_mode =
builder_->execution_mode() == WasmExecutionMode::kExecuteLiftoff
? WasmCompilationUnit::CompilationMode::kLiftoff
: WasmCompilationUnit::CompilationMode::kTurbofan;
NativeModule* native_module =
builder_->instance_object()->module_object()->native_module();
WasmCompilationUnit unit(isolate()->wasm_engine(), &module_env, native_module,
func_body, func_name, function_->func_index,
isolate()->counters(), comp_mode);
isolate()->counters(), tier);
unit.ExecuteCompilation();
WasmCode* wasm_code = unit.FinishCompilation(&thrower);
if (WasmCode::ShouldBeLogged(isolate())) {
......
......@@ -33,6 +33,7 @@
#include "src/wasm/wasm-objects-inl.h"
#include "src/wasm/wasm-objects.h"
#include "src/wasm/wasm-opcodes.h"
#include "src/wasm/wasm-tier.h"
#include "src/zone/accounting-allocator.h"
#include "src/zone/zone.h"
......@@ -48,12 +49,6 @@ namespace wasm {
constexpr uint32_t kMaxFunctions = 10;
constexpr uint32_t kMaxGlobalsSize = 128;
enum WasmExecutionMode {
kExecuteInterpreter,
kExecuteTurbofan,
kExecuteLiftoff
};
using compiler::CallDescriptor;
using compiler::MachineTypeForC;
using compiler::Node;
......@@ -88,7 +83,7 @@ struct ManuallyImportedJSFunction {
// the interpreter.
class TestingModuleBuilder {
public:
TestingModuleBuilder(Zone*, ManuallyImportedJSFunction*, WasmExecutionMode,
TestingModuleBuilder(Zone*, ManuallyImportedJSFunction*, ExecutionTier,
RuntimeExceptionSupport, LowerSimd);
void ChangeOriginToAsmjs() { test_module_->origin = kAsmJsOrigin; }
......@@ -215,7 +210,7 @@ class TestingModuleBuilder {
ModuleEnv CreateModuleEnv();
WasmExecutionMode execution_mode() const { return execution_mode_; }
ExecutionTier execution_tier() const { return execution_tier_; }
RuntimeExceptionSupport runtime_exception_support() const {
return runtime_exception_support_;
......@@ -231,7 +226,7 @@ class TestingModuleBuilder {
uint32_t mem_size_ = 0;
V8_ALIGNED(16) byte globals_data_[kMaxGlobalsSize];
WasmInterpreter* interpreter_ = nullptr;
WasmExecutionMode execution_mode_;
ExecutionTier execution_tier_;
Handle<WasmInstanceObject> instance_object_;
NativeModule* native_module_ = nullptr;
bool linked_ = false;
......@@ -346,11 +341,11 @@ class WasmFunctionCompiler : public compiler::GraphAndBuilders {
class WasmRunnerBase : public HandleAndZoneScope {
public:
WasmRunnerBase(ManuallyImportedJSFunction* maybe_import,
WasmExecutionMode execution_mode, int num_params,
ExecutionTier execution_tier, int num_params,
RuntimeExceptionSupport runtime_exception_support,
LowerSimd lower_simd)
: zone_(&allocator_, ZONE_NAME),
builder_(&zone_, maybe_import, execution_mode,
builder_(&zone_, maybe_import, execution_tier,
runtime_exception_support, lower_simd),
wrapper_(&zone_, num_params) {}
......@@ -427,13 +422,13 @@ class WasmRunnerBase : public HandleAndZoneScope {
template <typename ReturnType, typename... ParamTypes>
class WasmRunner : public WasmRunnerBase {
public:
WasmRunner(WasmExecutionMode execution_mode,
WasmRunner(ExecutionTier execution_tier,
ManuallyImportedJSFunction* maybe_import = nullptr,
const char* main_fn_name = "main",
RuntimeExceptionSupport runtime_exception_support =
kNoRuntimeExceptionSupport,
LowerSimd lower_simd = kNoLowerSimd)
: WasmRunnerBase(maybe_import, execution_mode, sizeof...(ParamTypes),
: WasmRunnerBase(maybe_import, execution_tier, sizeof...(ParamTypes),
runtime_exception_support, lower_simd) {
NewFunction<ReturnType, ParamTypes...>(main_fn_name);
if (!interpret()) {
......@@ -441,8 +436,8 @@ class WasmRunner : public WasmRunnerBase {
}
}
WasmRunner(WasmExecutionMode execution_mode, LowerSimd lower_simd)
: WasmRunner(execution_mode, nullptr, "main", kNoRuntimeExceptionSupport,
WasmRunner(ExecutionTier execution_tier, LowerSimd lower_simd)
: WasmRunner(execution_tier, nullptr, "main", kNoRuntimeExceptionSupport,
lower_simd) {}
ReturnType Call(ParamTypes... p) {
......@@ -500,18 +495,20 @@ class WasmRunner : public WasmRunnerBase {
};
// A macro to define tests that run in different engine configurations.
#define WASM_EXEC_TEST(name) \
void RunWasm_##name(WasmExecutionMode execution_mode); \
TEST(RunWasmTurbofan_##name) { RunWasm_##name(kExecuteTurbofan); } \
TEST(RunWasmLiftoff_##name) { RunWasm_##name(kExecuteLiftoff); } \
TEST(RunWasmInterpreter_##name) { RunWasm_##name(kExecuteInterpreter); } \
void RunWasm_##name(WasmExecutionMode execution_mode)
#define WASM_COMPILED_EXEC_TEST(name) \
void RunWasm_##name(WasmExecutionMode execution_mode); \
TEST(RunWasmTurbofan_##name) { RunWasm_##name(kExecuteTurbofan); } \
TEST(RunWasmLiftoff_##name) { RunWasm_##name(kExecuteLiftoff); } \
void RunWasm_##name(WasmExecutionMode execution_mode)
#define WASM_EXEC_TEST(name) \
void RunWasm_##name(ExecutionTier execution_tier); \
TEST(RunWasmTurbofan_##name) { RunWasm_##name(ExecutionTier::kOptimized); } \
TEST(RunWasmLiftoff_##name) { RunWasm_##name(ExecutionTier::kBaseline); } \
TEST(RunWasmInterpreter_##name) { \
RunWasm_##name(ExecutionTier::kInterpreter); \
} \
void RunWasm_##name(ExecutionTier execution_tier)
#define WASM_COMPILED_EXEC_TEST(name) \
void RunWasm_##name(ExecutionTier execution_tier); \
TEST(RunWasmTurbofan_##name) { RunWasm_##name(ExecutionTier::kOptimized); } \
TEST(RunWasmLiftoff_##name) { RunWasm_##name(ExecutionTier::kBaseline); } \
void RunWasm_##name(ExecutionTier execution_tier)
} // namespace wasm
} // namespace internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment