Commit bf90d9a3 authored by titzer's avatar titzer Committed by Commit bot

[formatting] Remove all double blank lines in WASM code.

R=ahaas@chromium.org,mstarzinger@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/1970543003
Cr-Commit-Position: refs/heads/master@{#36174}
parent c4af1ba7
...@@ -54,7 +54,6 @@ const Operator* UnsupportedOpcode(wasm::WasmOpcode opcode) { ...@@ -54,7 +54,6 @@ const Operator* UnsupportedOpcode(wasm::WasmOpcode opcode) {
return nullptr; return nullptr;
} }
void MergeControlToEnd(JSGraph* jsgraph, Node* node) { void MergeControlToEnd(JSGraph* jsgraph, Node* node) {
Graph* g = jsgraph->graph(); Graph* g = jsgraph->graph();
if (g->end()) { if (g->end()) {
...@@ -285,28 +284,23 @@ WasmGraphBuilder::WasmGraphBuilder( ...@@ -285,28 +284,23 @@ WasmGraphBuilder::WasmGraphBuilder(
DCHECK_NOT_NULL(jsgraph_); DCHECK_NOT_NULL(jsgraph_);
} }
Node* WasmGraphBuilder::Error() { return jsgraph()->Dead(); } Node* WasmGraphBuilder::Error() { return jsgraph()->Dead(); }
Node* WasmGraphBuilder::Start(unsigned params) { Node* WasmGraphBuilder::Start(unsigned params) {
Node* start = graph()->NewNode(jsgraph()->common()->Start(params)); Node* start = graph()->NewNode(jsgraph()->common()->Start(params));
graph()->SetStart(start); graph()->SetStart(start);
return start; return start;
} }
Node* WasmGraphBuilder::Param(unsigned index, wasm::LocalType type) { Node* WasmGraphBuilder::Param(unsigned index, wasm::LocalType type) {
return graph()->NewNode(jsgraph()->common()->Parameter(index), return graph()->NewNode(jsgraph()->common()->Parameter(index),
graph()->start()); graph()->start());
} }
Node* WasmGraphBuilder::Loop(Node* entry) { Node* WasmGraphBuilder::Loop(Node* entry) {
return graph()->NewNode(jsgraph()->common()->Loop(1), entry); return graph()->NewNode(jsgraph()->common()->Loop(1), entry);
} }
Node* WasmGraphBuilder::Terminate(Node* effect, Node* control) { Node* WasmGraphBuilder::Terminate(Node* effect, Node* control) {
Node* terminate = Node* terminate =
graph()->NewNode(jsgraph()->common()->Terminate(), effect, control); graph()->NewNode(jsgraph()->common()->Terminate(), effect, control);
...@@ -314,18 +308,15 @@ Node* WasmGraphBuilder::Terminate(Node* effect, Node* control) { ...@@ -314,18 +308,15 @@ Node* WasmGraphBuilder::Terminate(Node* effect, Node* control) {
return terminate; return terminate;
} }
unsigned WasmGraphBuilder::InputCount(Node* node) { unsigned WasmGraphBuilder::InputCount(Node* node) {
return static_cast<unsigned>(node->InputCount()); return static_cast<unsigned>(node->InputCount());
} }
bool WasmGraphBuilder::IsPhiWithMerge(Node* phi, Node* merge) { bool WasmGraphBuilder::IsPhiWithMerge(Node* phi, Node* merge) {
return phi && IrOpcode::IsPhiOpcode(phi->opcode()) && return phi && IrOpcode::IsPhiOpcode(phi->opcode()) &&
NodeProperties::GetControlInput(phi) == merge; NodeProperties::GetControlInput(phi) == merge;
} }
void WasmGraphBuilder::AppendToMerge(Node* merge, Node* from) { void WasmGraphBuilder::AppendToMerge(Node* merge, Node* from) {
DCHECK(IrOpcode::IsMergeOpcode(merge->opcode())); DCHECK(IrOpcode::IsMergeOpcode(merge->opcode()));
merge->AppendInput(jsgraph()->zone(), from); merge->AppendInput(jsgraph()->zone(), from);
...@@ -342,12 +333,10 @@ void WasmGraphBuilder::AppendToPhi(Node* phi, Node* from) { ...@@ -342,12 +333,10 @@ void WasmGraphBuilder::AppendToPhi(Node* phi, Node* from) {
phi, jsgraph()->common()->ResizeMergeOrPhi(phi->op(), new_size)); phi, jsgraph()->common()->ResizeMergeOrPhi(phi->op(), new_size));
} }
Node* WasmGraphBuilder::Merge(unsigned count, Node** controls) { Node* WasmGraphBuilder::Merge(unsigned count, Node** controls) {
return graph()->NewNode(jsgraph()->common()->Merge(count), count, controls); return graph()->NewNode(jsgraph()->common()->Merge(count), count, controls);
} }
Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals, Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals,
Node* control) { Node* control) {
DCHECK(IrOpcode::IsMergeOpcode(control->opcode())); DCHECK(IrOpcode::IsMergeOpcode(control->opcode()));
...@@ -357,7 +346,6 @@ Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals, ...@@ -357,7 +346,6 @@ Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals,
buf); buf);
} }
Node* WasmGraphBuilder::EffectPhi(unsigned count, Node** effects, Node* WasmGraphBuilder::EffectPhi(unsigned count, Node** effects,
Node* control) { Node* control) {
DCHECK(IrOpcode::IsMergeOpcode(control->opcode())); DCHECK(IrOpcode::IsMergeOpcode(control->opcode()));
...@@ -375,7 +363,6 @@ Node* WasmGraphBuilder::Int32Constant(int32_t value) { ...@@ -375,7 +363,6 @@ Node* WasmGraphBuilder::Int32Constant(int32_t value) {
return jsgraph()->Int32Constant(value); return jsgraph()->Int32Constant(value);
} }
Node* WasmGraphBuilder::Int64Constant(int64_t value) { Node* WasmGraphBuilder::Int64Constant(int64_t value) {
return jsgraph()->Int64Constant(value); return jsgraph()->Int64Constant(value);
} }
...@@ -895,22 +882,18 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input, ...@@ -895,22 +882,18 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input,
return graph()->NewNode(op, input); return graph()->NewNode(op, input);
} }
Node* WasmGraphBuilder::Float32Constant(float value) { Node* WasmGraphBuilder::Float32Constant(float value) {
return jsgraph()->Float32Constant(value); return jsgraph()->Float32Constant(value);
} }
Node* WasmGraphBuilder::Float64Constant(double value) { Node* WasmGraphBuilder::Float64Constant(double value) {
return jsgraph()->Float64Constant(value); return jsgraph()->Float64Constant(value);
} }
Node* WasmGraphBuilder::Constant(Handle<Object> value) { Node* WasmGraphBuilder::Constant(Handle<Object> value) {
return jsgraph()->Constant(value); return jsgraph()->Constant(value);
} }
Node* WasmGraphBuilder::Branch(Node* cond, Node** true_node, Node* WasmGraphBuilder::Branch(Node* cond, Node** true_node,
Node** false_node) { Node** false_node) {
DCHECK_NOT_NULL(cond); DCHECK_NOT_NULL(cond);
...@@ -922,24 +905,20 @@ Node* WasmGraphBuilder::Branch(Node* cond, Node** true_node, ...@@ -922,24 +905,20 @@ Node* WasmGraphBuilder::Branch(Node* cond, Node** true_node,
return branch; return branch;
} }
Node* WasmGraphBuilder::Switch(unsigned count, Node* key) { Node* WasmGraphBuilder::Switch(unsigned count, Node* key) {
return graph()->NewNode(jsgraph()->common()->Switch(count), key, *control_); return graph()->NewNode(jsgraph()->common()->Switch(count), key, *control_);
} }
Node* WasmGraphBuilder::IfValue(int32_t value, Node* sw) { Node* WasmGraphBuilder::IfValue(int32_t value, Node* sw) {
DCHECK_EQ(IrOpcode::kSwitch, sw->opcode()); DCHECK_EQ(IrOpcode::kSwitch, sw->opcode());
return graph()->NewNode(jsgraph()->common()->IfValue(value), sw); return graph()->NewNode(jsgraph()->common()->IfValue(value), sw);
} }
Node* WasmGraphBuilder::IfDefault(Node* sw) { Node* WasmGraphBuilder::IfDefault(Node* sw) {
DCHECK_EQ(IrOpcode::kSwitch, sw->opcode()); DCHECK_EQ(IrOpcode::kSwitch, sw->opcode());
return graph()->NewNode(jsgraph()->common()->IfDefault(), sw); return graph()->NewNode(jsgraph()->common()->IfDefault(), sw);
} }
Node* WasmGraphBuilder::Return(unsigned count, Node** vals) { Node* WasmGraphBuilder::Return(unsigned count, Node** vals) {
DCHECK_NOT_NULL(*control_); DCHECK_NOT_NULL(*control_);
DCHECK_NOT_NULL(*effect_); DCHECK_NOT_NULL(*effect_);
...@@ -959,7 +938,6 @@ Node* WasmGraphBuilder::Return(unsigned count, Node** vals) { ...@@ -959,7 +938,6 @@ Node* WasmGraphBuilder::Return(unsigned count, Node** vals) {
return ret; return ret;
} }
Node* WasmGraphBuilder::ReturnVoid() { return Return(0, Buffer(0)); } Node* WasmGraphBuilder::ReturnVoid() { return Return(0, Buffer(0)); }
Node* WasmGraphBuilder::Unreachable(wasm::WasmCodePosition position) { Node* WasmGraphBuilder::Unreachable(wasm::WasmCodePosition position) {
...@@ -1008,7 +986,6 @@ Node* WasmGraphBuilder::BuildF32Neg(Node* input) { ...@@ -1008,7 +986,6 @@ Node* WasmGraphBuilder::BuildF32Neg(Node* input) {
return result; return result;
} }
Node* WasmGraphBuilder::BuildF64Neg(Node* input) { Node* WasmGraphBuilder::BuildF64Neg(Node* input) {
#if WASM_64 #if WASM_64
Node* result = Node* result =
...@@ -1028,7 +1005,6 @@ Node* WasmGraphBuilder::BuildF64Neg(Node* input) { ...@@ -1028,7 +1005,6 @@ Node* WasmGraphBuilder::BuildF64Neg(Node* input) {
#endif #endif
} }
Node* WasmGraphBuilder::BuildF32CopySign(Node* left, Node* right) { Node* WasmGraphBuilder::BuildF32CopySign(Node* left, Node* right) {
Node* result = Unop( Node* result = Unop(
wasm::kExprF32ReinterpretI32, wasm::kExprF32ReinterpretI32,
...@@ -1041,7 +1017,6 @@ Node* WasmGraphBuilder::BuildF32CopySign(Node* left, Node* right) { ...@@ -1041,7 +1017,6 @@ Node* WasmGraphBuilder::BuildF32CopySign(Node* left, Node* right) {
return result; return result;
} }
Node* WasmGraphBuilder::BuildF64CopySign(Node* left, Node* right) { Node* WasmGraphBuilder::BuildF64CopySign(Node* left, Node* right) {
#if WASM_64 #if WASM_64
Node* result = Unop( Node* result = Unop(
...@@ -1070,7 +1045,6 @@ Node* WasmGraphBuilder::BuildF64CopySign(Node* left, Node* right) { ...@@ -1070,7 +1045,6 @@ Node* WasmGraphBuilder::BuildF64CopySign(Node* left, Node* right) {
#endif #endif
} }
Node* WasmGraphBuilder::BuildF32Min(Node* left, Node* right) { Node* WasmGraphBuilder::BuildF32Min(Node* left, Node* right) {
Diamond left_le_right(graph(), jsgraph()->common(), Diamond left_le_right(graph(), jsgraph()->common(),
Binop(wasm::kExprF32Le, left, right)); Binop(wasm::kExprF32Le, left, right));
...@@ -1091,7 +1065,6 @@ Node* WasmGraphBuilder::BuildF32Min(Node* left, Node* right) { ...@@ -1091,7 +1065,6 @@ Node* WasmGraphBuilder::BuildF32Min(Node* left, Node* right) {
Binop(wasm::kExprF32Mul, left, Float32Constant(1.0))))); Binop(wasm::kExprF32Mul, left, Float32Constant(1.0)))));
} }
Node* WasmGraphBuilder::BuildF32Max(Node* left, Node* right) { Node* WasmGraphBuilder::BuildF32Max(Node* left, Node* right) {
Diamond left_ge_right(graph(), jsgraph()->common(), Diamond left_ge_right(graph(), jsgraph()->common(),
Binop(wasm::kExprF32Ge, left, right)); Binop(wasm::kExprF32Ge, left, right));
...@@ -1112,7 +1085,6 @@ Node* WasmGraphBuilder::BuildF32Max(Node* left, Node* right) { ...@@ -1112,7 +1085,6 @@ Node* WasmGraphBuilder::BuildF32Max(Node* left, Node* right) {
Binop(wasm::kExprF32Mul, left, Float32Constant(1.0))))); Binop(wasm::kExprF32Mul, left, Float32Constant(1.0)))));
} }
Node* WasmGraphBuilder::BuildF64Min(Node* left, Node* right) { Node* WasmGraphBuilder::BuildF64Min(Node* left, Node* right) {
Diamond left_le_right(graph(), jsgraph()->common(), Diamond left_le_right(graph(), jsgraph()->common(),
Binop(wasm::kExprF64Le, left, right)); Binop(wasm::kExprF64Le, left, right));
...@@ -1133,7 +1105,6 @@ Node* WasmGraphBuilder::BuildF64Min(Node* left, Node* right) { ...@@ -1133,7 +1105,6 @@ Node* WasmGraphBuilder::BuildF64Min(Node* left, Node* right) {
Binop(wasm::kExprF64Mul, left, Float64Constant(1.0))))); Binop(wasm::kExprF64Mul, left, Float64Constant(1.0)))));
} }
Node* WasmGraphBuilder::BuildF64Max(Node* left, Node* right) { Node* WasmGraphBuilder::BuildF64Max(Node* left, Node* right) {
Diamond left_ge_right(graph(), jsgraph()->common(), Diamond left_ge_right(graph(), jsgraph()->common(),
Binop(wasm::kExprF64Ge, left, right)); Binop(wasm::kExprF64Ge, left, right));
...@@ -1284,7 +1255,6 @@ Node* WasmGraphBuilder::BuildI32Popcnt(Node* input) { ...@@ -1284,7 +1255,6 @@ Node* WasmGraphBuilder::BuildI32Popcnt(Node* input) {
MachineRepresentation::kWord32); MachineRepresentation::kWord32);
} }
Node* WasmGraphBuilder::BuildI64Popcnt(Node* input) { Node* WasmGraphBuilder::BuildI64Popcnt(Node* input) {
return Unop(wasm::kExprI64UConvertI32, return Unop(wasm::kExprI64UConvertI32,
BuildBitCountingCall(input, ExternalReference::wasm_word64_popcnt( BuildBitCountingCall(input, ExternalReference::wasm_word64_popcnt(
...@@ -2452,7 +2422,6 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, ...@@ -2452,7 +2422,6 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
MergeControlToEnd(jsgraph(), ret); MergeControlToEnd(jsgraph(), ret);
} }
void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSFunction> function, void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSFunction> function,
wasm::FunctionSig* sig) { wasm::FunctionSig* sig) {
int js_count = function->shared()->internal_formal_parameter_count(); int js_count = function->shared()->internal_formal_parameter_count();
...@@ -2545,7 +2514,6 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSFunction> function, ...@@ -2545,7 +2514,6 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSFunction> function,
MergeControlToEnd(jsgraph(), ret); MergeControlToEnd(jsgraph(), ret);
} }
Node* WasmGraphBuilder::MemBuffer(uint32_t offset) { Node* WasmGraphBuilder::MemBuffer(uint32_t offset) {
DCHECK(module_ && module_->instance); DCHECK(module_ && module_->instance);
if (offset == 0) { if (offset == 0) {
...@@ -2562,7 +2530,6 @@ Node* WasmGraphBuilder::MemBuffer(uint32_t offset) { ...@@ -2562,7 +2530,6 @@ Node* WasmGraphBuilder::MemBuffer(uint32_t offset) {
} }
} }
Node* WasmGraphBuilder::MemSize(uint32_t offset) { Node* WasmGraphBuilder::MemSize(uint32_t offset) {
DCHECK(module_ && module_->instance); DCHECK(module_ && module_->instance);
uint32_t size = static_cast<uint32_t>(module_->instance->mem_size); uint32_t size = static_cast<uint32_t>(module_->instance->mem_size);
...@@ -2574,7 +2541,6 @@ Node* WasmGraphBuilder::MemSize(uint32_t offset) { ...@@ -2574,7 +2541,6 @@ Node* WasmGraphBuilder::MemSize(uint32_t offset) {
} }
} }
Node* WasmGraphBuilder::FunctionTable() { Node* WasmGraphBuilder::FunctionTable() {
DCHECK(module_ && module_->instance && DCHECK(module_ && module_->instance &&
!module_->instance->function_table.is_null()); !module_->instance->function_table.is_null());
...@@ -2584,7 +2550,6 @@ Node* WasmGraphBuilder::FunctionTable() { ...@@ -2584,7 +2550,6 @@ Node* WasmGraphBuilder::FunctionTable() {
return function_table_; return function_table_;
} }
Node* WasmGraphBuilder::LoadGlobal(uint32_t index) { Node* WasmGraphBuilder::LoadGlobal(uint32_t index) {
DCHECK(module_ && module_->instance && module_->instance->globals_start); DCHECK(module_ && module_->instance && module_->instance->globals_start);
MachineType mem_type = module_->GetGlobalType(index); MachineType mem_type = module_->GetGlobalType(index);
...@@ -2598,7 +2563,6 @@ Node* WasmGraphBuilder::LoadGlobal(uint32_t index) { ...@@ -2598,7 +2563,6 @@ Node* WasmGraphBuilder::LoadGlobal(uint32_t index) {
return node; return node;
} }
Node* WasmGraphBuilder::StoreGlobal(uint32_t index, Node* val) { Node* WasmGraphBuilder::StoreGlobal(uint32_t index, Node* val) {
DCHECK(module_ && module_->instance && module_->instance->globals_start); DCHECK(module_ && module_->instance && module_->instance->globals_start);
MachineType mem_type = module_->GetGlobalType(index); MachineType mem_type = module_->GetGlobalType(index);
...@@ -2713,13 +2677,11 @@ void WasmGraphBuilder::PrintDebugName(Node* node) { ...@@ -2713,13 +2677,11 @@ void WasmGraphBuilder::PrintDebugName(Node* node) {
PrintF("#%d:%s", node->id(), node->op()->mnemonic()); PrintF("#%d:%s", node->id(), node->op()->mnemonic());
} }
Node* WasmGraphBuilder::String(const char* string) { Node* WasmGraphBuilder::String(const char* string) {
return jsgraph()->Constant( return jsgraph()->Constant(
jsgraph()->isolate()->factory()->NewStringFromAsciiChecked(string)); jsgraph()->isolate()->factory()->NewStringFromAsciiChecked(string));
} }
Graph* WasmGraphBuilder::graph() { return jsgraph()->graph(); } Graph* WasmGraphBuilder::graph() { return jsgraph()->graph(); }
void WasmGraphBuilder::Int64LoweringForTesting() { void WasmGraphBuilder::Int64LoweringForTesting() {
......
...@@ -386,7 +386,6 @@ class WasmDecoder : public Decoder { ...@@ -386,7 +386,6 @@ class WasmDecoder : public Decoder {
} }
}; };
// A shift-reduce-parser strategy for decoding Wasm code that uses an explicit // A shift-reduce-parser strategy for decoding Wasm code that uses an explicit
// shift-reduce strategy with multiple internal stacks. // shift-reduce strategy with multiple internal stacks.
class SR_WasmDecoder : public WasmDecoder { class SR_WasmDecoder : public WasmDecoder {
...@@ -1499,7 +1498,6 @@ TreeResult BuildTFGraph(base::AccountingAllocator* allocator, ...@@ -1499,7 +1498,6 @@ TreeResult BuildTFGraph(base::AccountingAllocator* allocator,
return decoder.toResult<Tree*>(nullptr); return decoder.toResult<Tree*>(nullptr);
} }
std::ostream& operator<<(std::ostream& os, const Tree& tree) { std::ostream& operator<<(std::ostream& os, const Tree& tree) {
if (tree.pc == nullptr) { if (tree.pc == nullptr) {
os << "null"; os << "null";
......
...@@ -39,13 +39,11 @@ void EmitUint8(byte** b, uint8_t x) { ...@@ -39,13 +39,11 @@ void EmitUint8(byte** b, uint8_t x) {
*b += 1; *b += 1;
} }
void EmitUint16(byte** b, uint16_t x) { void EmitUint16(byte** b, uint16_t x) {
WriteUnalignedUInt16(*b, x); WriteUnalignedUInt16(*b, x);
*b += 2; *b += 2;
} }
void EmitUint32(byte** b, uint32_t x) { void EmitUint32(byte** b, uint32_t x) {
WriteUnalignedUInt32(*b, x); WriteUnalignedUInt32(*b, x);
*b += 4; *b += 4;
...@@ -102,7 +100,6 @@ struct WasmFunctionBuilder::Type { ...@@ -102,7 +100,6 @@ struct WasmFunctionBuilder::Type {
LocalType type_; LocalType type_;
}; };
WasmFunctionBuilder::WasmFunctionBuilder(Zone* zone) WasmFunctionBuilder::WasmFunctionBuilder(Zone* zone)
: return_type_(kAstI32), : return_type_(kAstI32),
locals_(zone), locals_(zone),
...@@ -125,21 +122,17 @@ uint16_t WasmFunctionBuilder::AddParam(LocalType type) { ...@@ -125,21 +122,17 @@ uint16_t WasmFunctionBuilder::AddParam(LocalType type) {
return AddVar(type, true); return AddVar(type, true);
} }
uint16_t WasmFunctionBuilder::AddLocal(LocalType type) { uint16_t WasmFunctionBuilder::AddLocal(LocalType type) {
return AddVar(type, false); return AddVar(type, false);
} }
uint16_t WasmFunctionBuilder::AddVar(LocalType type, bool param) { uint16_t WasmFunctionBuilder::AddVar(LocalType type, bool param) {
locals_.push_back({param, type}); locals_.push_back({param, type});
return static_cast<uint16_t>(locals_.size() - 1); return static_cast<uint16_t>(locals_.size() - 1);
} }
void WasmFunctionBuilder::ReturnType(LocalType type) { return_type_ = type; } void WasmFunctionBuilder::ReturnType(LocalType type) { return_type_ = type; }
void WasmFunctionBuilder::EmitCode(const byte* code, uint32_t code_size) { void WasmFunctionBuilder::EmitCode(const byte* code, uint32_t code_size) {
EmitCode(code, code_size, nullptr, 0); EmitCode(code, code_size, nullptr, 0);
} }
...@@ -166,12 +159,10 @@ void WasmFunctionBuilder::EmitCode(const byte* code, uint32_t code_size, ...@@ -166,12 +159,10 @@ void WasmFunctionBuilder::EmitCode(const byte* code, uint32_t code_size,
} }
} }
void WasmFunctionBuilder::Emit(WasmOpcode opcode) { void WasmFunctionBuilder::Emit(WasmOpcode opcode) {
body_.push_back(static_cast<byte>(opcode)); body_.push_back(static_cast<byte>(opcode));
} }
void WasmFunctionBuilder::EmitWithU8(WasmOpcode opcode, const byte immediate) { void WasmFunctionBuilder::EmitWithU8(WasmOpcode opcode, const byte immediate) {
body_.push_back(static_cast<byte>(opcode)); body_.push_back(static_cast<byte>(opcode));
body_.push_back(immediate); body_.push_back(immediate);
...@@ -229,10 +220,8 @@ void WasmFunctionBuilder::EditVarIntImmediate(uint32_t offset, ...@@ -229,10 +220,8 @@ void WasmFunctionBuilder::EditVarIntImmediate(uint32_t offset,
v8::internal::wasm::EmitVarInt(&p, immediate); v8::internal::wasm::EmitVarInt(&p, immediate);
} }
void WasmFunctionBuilder::Exported(uint8_t flag) { exported_ = flag; } void WasmFunctionBuilder::Exported(uint8_t flag) { exported_ = flag; }
void WasmFunctionBuilder::External(uint8_t flag) { external_ = flag; } void WasmFunctionBuilder::External(uint8_t flag) { external_ = flag; }
void WasmFunctionBuilder::SetName(const unsigned char* name, int name_length) { void WasmFunctionBuilder::SetName(const unsigned char* name, int name_length) {
...@@ -244,7 +233,6 @@ void WasmFunctionBuilder::SetName(const unsigned char* name, int name_length) { ...@@ -244,7 +233,6 @@ void WasmFunctionBuilder::SetName(const unsigned char* name, int name_length) {
} }
} }
WasmFunctionEncoder* WasmFunctionBuilder::Build(Zone* zone, WasmFunctionEncoder* WasmFunctionBuilder::Build(Zone* zone,
WasmModuleBuilder* mb) const { WasmModuleBuilder* mb) const {
WasmFunctionEncoder* e = WasmFunctionEncoder* e =
...@@ -296,7 +284,6 @@ WasmFunctionEncoder* WasmFunctionBuilder::Build(Zone* zone, ...@@ -296,7 +284,6 @@ WasmFunctionEncoder* WasmFunctionBuilder::Build(Zone* zone,
return e; return e;
} }
void WasmFunctionBuilder::IndexVars(WasmFunctionEncoder* e, void WasmFunctionBuilder::IndexVars(WasmFunctionEncoder* e,
uint16_t* var_index) const { uint16_t* var_index) const {
uint16_t param = 0; uint16_t param = 0;
...@@ -342,7 +329,6 @@ void WasmFunctionBuilder::IndexVars(WasmFunctionEncoder* e, ...@@ -342,7 +329,6 @@ void WasmFunctionBuilder::IndexVars(WasmFunctionEncoder* e,
} }
} }
WasmFunctionEncoder::WasmFunctionEncoder(Zone* zone, LocalType return_type, WasmFunctionEncoder::WasmFunctionEncoder(Zone* zone, LocalType return_type,
bool exported, bool external) bool exported, bool external)
: params_(zone), : params_(zone),
...@@ -351,7 +337,6 @@ WasmFunctionEncoder::WasmFunctionEncoder(Zone* zone, LocalType return_type, ...@@ -351,7 +337,6 @@ WasmFunctionEncoder::WasmFunctionEncoder(Zone* zone, LocalType return_type,
body_(zone), body_(zone),
name_(zone) {} name_(zone) {}
uint32_t WasmFunctionEncoder::HeaderSize() const { uint32_t WasmFunctionEncoder::HeaderSize() const {
uint32_t size = 3; uint32_t size = 3;
if (!external_) size += 2; if (!external_) size += 2;
...@@ -363,7 +348,6 @@ uint32_t WasmFunctionEncoder::HeaderSize() const { ...@@ -363,7 +348,6 @@ uint32_t WasmFunctionEncoder::HeaderSize() const {
return size; return size;
} }
uint32_t WasmFunctionEncoder::BodySize(void) const { uint32_t WasmFunctionEncoder::BodySize(void) const {
// TODO(titzer): embed a LocalDeclEncoder in the WasmFunctionEncoder // TODO(titzer): embed a LocalDeclEncoder in the WasmFunctionEncoder
LocalDeclEncoder local_decl; LocalDeclEncoder local_decl;
...@@ -376,12 +360,10 @@ uint32_t WasmFunctionEncoder::BodySize(void) const { ...@@ -376,12 +360,10 @@ uint32_t WasmFunctionEncoder::BodySize(void) const {
: static_cast<uint32_t>(body_.size() + local_decl.Size()); : static_cast<uint32_t>(body_.size() + local_decl.Size());
} }
uint32_t WasmFunctionEncoder::NameSize() const { uint32_t WasmFunctionEncoder::NameSize() const {
return HasName() ? static_cast<uint32_t>(name_.size()) : 0; return HasName() ? static_cast<uint32_t>(name_.size()) : 0;
} }
void WasmFunctionEncoder::Serialize(byte* buffer, byte** header, void WasmFunctionEncoder::Serialize(byte* buffer, byte** header,
byte** body) const { byte** body) const {
uint8_t decl_bits = (exported_ ? kDeclFunctionExport : 0) | uint8_t decl_bits = (exported_ ? kDeclFunctionExport : 0) |
...@@ -398,7 +380,6 @@ void WasmFunctionEncoder::Serialize(byte* buffer, byte** header, ...@@ -398,7 +380,6 @@ void WasmFunctionEncoder::Serialize(byte* buffer, byte** header,
} }
} }
if (!external_) { if (!external_) {
// TODO(titzer): embed a LocalDeclEncoder in the WasmFunctionEncoder // TODO(titzer): embed a LocalDeclEncoder in the WasmFunctionEncoder
LocalDeclEncoder local_decl; LocalDeclEncoder local_decl;
...@@ -416,7 +397,6 @@ void WasmFunctionEncoder::Serialize(byte* buffer, byte** header, ...@@ -416,7 +397,6 @@ void WasmFunctionEncoder::Serialize(byte* buffer, byte** header,
} }
} }
WasmDataSegmentEncoder::WasmDataSegmentEncoder(Zone* zone, const byte* data, WasmDataSegmentEncoder::WasmDataSegmentEncoder(Zone* zone, const byte* data,
uint32_t size, uint32_t dest) uint32_t size, uint32_t dest)
: data_(zone), dest_(dest) { : data_(zone), dest_(dest) {
...@@ -425,18 +405,15 @@ WasmDataSegmentEncoder::WasmDataSegmentEncoder(Zone* zone, const byte* data, ...@@ -425,18 +405,15 @@ WasmDataSegmentEncoder::WasmDataSegmentEncoder(Zone* zone, const byte* data,
} }
} }
uint32_t WasmDataSegmentEncoder::HeaderSize() const { uint32_t WasmDataSegmentEncoder::HeaderSize() const {
static const int kDataSegmentSize = 13; static const int kDataSegmentSize = 13;
return kDataSegmentSize; return kDataSegmentSize;
} }
uint32_t WasmDataSegmentEncoder::BodySize() const { uint32_t WasmDataSegmentEncoder::BodySize() const {
return static_cast<uint32_t>(data_.size()); return static_cast<uint32_t>(data_.size());
} }
void WasmDataSegmentEncoder::Serialize(byte* buffer, byte** header, void WasmDataSegmentEncoder::Serialize(byte* buffer, byte** header,
byte** body) const { byte** body) const {
EmitVarInt(header, dest_); EmitVarInt(header, dest_);
...@@ -461,7 +438,6 @@ uint16_t WasmModuleBuilder::AddFunction() { ...@@ -461,7 +438,6 @@ uint16_t WasmModuleBuilder::AddFunction() {
return static_cast<uint16_t>(functions_.size() - 1); return static_cast<uint16_t>(functions_.size() - 1);
} }
WasmFunctionBuilder* WasmModuleBuilder::FunctionAt(size_t index) { WasmFunctionBuilder* WasmModuleBuilder::FunctionAt(size_t index) {
if (functions_.size() > index) { if (functions_.size() > index) {
return functions_.at(index); return functions_.at(index);
...@@ -470,12 +446,10 @@ WasmFunctionBuilder* WasmModuleBuilder::FunctionAt(size_t index) { ...@@ -470,12 +446,10 @@ WasmFunctionBuilder* WasmModuleBuilder::FunctionAt(size_t index) {
} }
} }
void WasmModuleBuilder::AddDataSegment(WasmDataSegmentEncoder* data) { void WasmModuleBuilder::AddDataSegment(WasmDataSegmentEncoder* data) {
data_segments_.push_back(data); data_segments_.push_back(data);
} }
bool WasmModuleBuilder::CompareFunctionSigs::operator()(FunctionSig* a, bool WasmModuleBuilder::CompareFunctionSigs::operator()(FunctionSig* a,
FunctionSig* b) const { FunctionSig* b) const {
if (a->return_count() < b->return_count()) return true; if (a->return_count() < b->return_count()) return true;
...@@ -493,7 +467,6 @@ bool WasmModuleBuilder::CompareFunctionSigs::operator()(FunctionSig* a, ...@@ -493,7 +467,6 @@ bool WasmModuleBuilder::CompareFunctionSigs::operator()(FunctionSig* a,
return false; return false;
} }
uint16_t WasmModuleBuilder::AddSignature(FunctionSig* sig) { uint16_t WasmModuleBuilder::AddSignature(FunctionSig* sig) {
SignatureMap::iterator pos = signature_map_.find(sig); SignatureMap::iterator pos = signature_map_.find(sig);
if (pos != signature_map_.end()) { if (pos != signature_map_.end()) {
...@@ -506,7 +479,6 @@ uint16_t WasmModuleBuilder::AddSignature(FunctionSig* sig) { ...@@ -506,7 +479,6 @@ uint16_t WasmModuleBuilder::AddSignature(FunctionSig* sig) {
} }
} }
void WasmModuleBuilder::AddIndirectFunction(uint16_t index) { void WasmModuleBuilder::AddIndirectFunction(uint16_t index) {
indirect_functions_.push_back(index); indirect_functions_.push_back(index);
} }
...@@ -536,13 +508,11 @@ WasmModuleWriter* WasmModuleBuilder::Build(Zone* zone) { ...@@ -536,13 +508,11 @@ WasmModuleWriter* WasmModuleBuilder::Build(Zone* zone) {
return writer; return writer;
} }
uint32_t WasmModuleBuilder::AddGlobal(MachineType type, bool exported) { uint32_t WasmModuleBuilder::AddGlobal(MachineType type, bool exported) {
globals_.push_back(std::make_pair(type, exported)); globals_.push_back(std::make_pair(type, exported));
return static_cast<uint32_t>(globals_.size() - 1); return static_cast<uint32_t>(globals_.size() - 1);
} }
WasmModuleWriter::WasmModuleWriter(Zone* zone) WasmModuleWriter::WasmModuleWriter(Zone* zone)
: functions_(zone), : functions_(zone),
data_segments_(zone), data_segments_(zone),
......
...@@ -773,7 +773,6 @@ class ModuleDecoder : public Decoder { ...@@ -773,7 +773,6 @@ class ModuleDecoder : public Decoder {
} }
}; };
// Helpers for nice error messages. // Helpers for nice error messages.
class ModuleError : public ModuleResult { class ModuleError : public ModuleResult {
public: public:
...@@ -787,7 +786,6 @@ class ModuleError : public ModuleResult { ...@@ -787,7 +786,6 @@ class ModuleError : public ModuleResult {
} }
}; };
// Helpers for nice error messages. // Helpers for nice error messages.
class FunctionError : public FunctionResult { class FunctionError : public FunctionResult {
public: public:
...@@ -828,7 +826,6 @@ FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, ...@@ -828,7 +826,6 @@ FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start,
return decoder.DecodeFunctionSignature(start); return decoder.DecodeFunctionSignature(start);
} }
FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone, FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
ModuleEnv* module_env, ModuleEnv* module_env,
const byte* function_start, const byte* function_start,
......
...@@ -34,7 +34,6 @@ struct RawBuffer { ...@@ -34,7 +34,6 @@ struct RawBuffer {
size_t size() { return static_cast<size_t>(end - start); } size_t size() { return static_cast<size_t>(end - start); }
}; };
RawBuffer GetRawBufferArgument( RawBuffer GetRawBufferArgument(
ErrorThrower& thrower, const v8::FunctionCallbackInfo<v8::Value>& args) { ErrorThrower& thrower, const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() < 1) { if (args.Length() < 1) {
...@@ -77,7 +76,6 @@ RawBuffer GetRawBufferArgument( ...@@ -77,7 +76,6 @@ RawBuffer GetRawBufferArgument(
return {start, end}; return {start, end};
} }
void VerifyModule(const v8::FunctionCallbackInfo<v8::Value>& args) { void VerifyModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
HandleScope scope(args.GetIsolate()); HandleScope scope(args.GetIsolate());
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
...@@ -98,7 +96,6 @@ void VerifyModule(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -98,7 +96,6 @@ void VerifyModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (result.val) delete result.val; if (result.val) delete result.val;
} }
void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) { void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
HandleScope scope(args.GetIsolate()); HandleScope scope(args.GetIsolate());
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
...@@ -202,7 +199,6 @@ void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args, ...@@ -202,7 +199,6 @@ void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args,
if (result.val) delete result.val; if (result.val) delete result.val;
} }
void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) { void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) {
HandleScope scope(args.GetIsolate()); HandleScope scope(args.GetIsolate());
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
...@@ -234,7 +230,6 @@ void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -234,7 +230,6 @@ void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) {
internal::wasm::kAsmJsOrigin); internal::wasm::kAsmJsOrigin);
} }
void InstantiateModule(const v8::FunctionCallbackInfo<v8::Value>& args) { void InstantiateModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
HandleScope scope(args.GetIsolate()); HandleScope scope(args.GetIsolate());
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
...@@ -248,7 +243,6 @@ void InstantiateModule(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -248,7 +243,6 @@ void InstantiateModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
} }
} // namespace } // namespace
// TODO(titzer): we use the API to create the function template because the // TODO(titzer): we use the API to create the function template because the
// internal guts are too ugly to replicate here. // internal guts are too ugly to replicate here.
static i::Handle<i::FunctionTemplateInfo> NewTemplate(i::Isolate* i_isolate, static i::Handle<i::FunctionTemplateInfo> NewTemplate(i::Isolate* i_isolate,
...@@ -258,13 +252,11 @@ static i::Handle<i::FunctionTemplateInfo> NewTemplate(i::Isolate* i_isolate, ...@@ -258,13 +252,11 @@ static i::Handle<i::FunctionTemplateInfo> NewTemplate(i::Isolate* i_isolate,
return v8::Utils::OpenHandle(*local); return v8::Utils::OpenHandle(*local);
} }
namespace internal { namespace internal {
static Handle<String> v8_str(Isolate* isolate, const char* str) { static Handle<String> v8_str(Isolate* isolate, const char* str) {
return isolate->factory()->NewStringFromAsciiChecked(str); return isolate->factory()->NewStringFromAsciiChecked(str);
} }
static void InstallFunc(Isolate* isolate, Handle<JSObject> object, static void InstallFunc(Isolate* isolate, Handle<JSObject> object,
const char* str, FunctionCallback func) { const char* str, FunctionCallback func) {
Handle<String> name = v8_str(isolate, str); Handle<String> name = v8_str(isolate, str);
...@@ -276,7 +268,6 @@ static void InstallFunc(Isolate* isolate, Handle<JSObject> object, ...@@ -276,7 +268,6 @@ static void InstallFunc(Isolate* isolate, Handle<JSObject> object,
JSObject::AddProperty(object, name, function, attributes); JSObject::AddProperty(object, name, function, attributes);
} }
void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) { void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) {
// Setup wasm function map. // Setup wasm function map.
Handle<Context> context(global->native_context(), isolate); Handle<Context> context(global->native_context(), isolate);
...@@ -310,7 +301,6 @@ void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) { ...@@ -310,7 +301,6 @@ void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) {
} }
} }
void WasmJs::InstallWasmFunctionMap(Isolate* isolate, Handle<Context> context) { void WasmJs::InstallWasmFunctionMap(Isolate* isolate, Handle<Context> context) {
if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) {
// TODO(titzer): Move this to bootstrapper.cc?? // TODO(titzer): Move this to bootstrapper.cc??
......
...@@ -84,7 +84,6 @@ std::ostream& operator<<(std::ostream& os, const WasmModule& module) { ...@@ -84,7 +84,6 @@ std::ostream& operator<<(std::ostream& os, const WasmModule& module) {
return os; return os;
} }
std::ostream& operator<<(std::ostream& os, const WasmFunction& function) { std::ostream& operator<<(std::ostream& os, const WasmFunction& function) {
os << "WASM function with signature " << *function.sig; os << "WASM function with signature " << *function.sig;
...@@ -221,7 +220,6 @@ size_t AllocateGlobalsOffsets(std::vector<WasmGlobal>& globals) { ...@@ -221,7 +220,6 @@ size_t AllocateGlobalsOffsets(std::vector<WasmGlobal>& globals) {
return offset; return offset;
} }
void LoadDataSegments(WasmModule* module, byte* mem_addr, size_t mem_size) { void LoadDataSegments(WasmModule* module, byte* mem_addr, size_t mem_size) {
for (const WasmDataSegment& segment : module->data_segments) { for (const WasmDataSegment& segment : module->data_segments) {
if (!segment.init) continue; if (!segment.init) continue;
...@@ -235,7 +233,6 @@ void LoadDataSegments(WasmModule* module, byte* mem_addr, size_t mem_size) { ...@@ -235,7 +233,6 @@ void LoadDataSegments(WasmModule* module, byte* mem_addr, size_t mem_size) {
} }
} }
Handle<FixedArray> BuildFunctionTable(Isolate* isolate, WasmModule* module) { Handle<FixedArray> BuildFunctionTable(Isolate* isolate, WasmModule* module) {
if (module->function_table.size() == 0) { if (module->function_table.size() == 0) {
return Handle<FixedArray>::null(); return Handle<FixedArray>::null();
...@@ -680,7 +677,6 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate, ...@@ -680,7 +677,6 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
return instance.js_object; return instance.js_object;
} }
Handle<Code> ModuleEnv::GetFunctionCode(uint32_t index) { Handle<Code> ModuleEnv::GetFunctionCode(uint32_t index) {
DCHECK(IsValidFunction(index)); DCHECK(IsValidFunction(index));
if (linker) return linker->GetFunctionCode(index); if (linker) return linker->GetFunctionCode(index);
...@@ -701,7 +697,6 @@ compiler::CallDescriptor* ModuleEnv::GetCallDescriptor(Zone* zone, ...@@ -701,7 +697,6 @@ compiler::CallDescriptor* ModuleEnv::GetCallDescriptor(Zone* zone,
return GetWasmCallDescriptor(zone, function->sig); return GetWasmCallDescriptor(zone, function->sig);
} }
int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
const byte* module_end, bool asm_js) { const byte* module_end, bool asm_js) {
HandleScope scope(isolate); HandleScope scope(isolate);
...@@ -727,7 +722,6 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, ...@@ -727,7 +722,6 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
return retval; return retval;
} }
int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module) { int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module) {
ErrorThrower thrower(isolate, "CompileAndRunWasmModule"); ErrorThrower thrower(isolate, "CompileAndRunWasmModule");
WasmModuleInstance instance(module); WasmModuleInstance instance(module);
......
...@@ -51,13 +51,10 @@ std::ostream& operator<<(std::ostream& os, const FunctionSig& sig) { ...@@ -51,13 +51,10 @@ std::ostream& operator<<(std::ostream& os, const FunctionSig& sig) {
return os; return os;
} }
#define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name, #define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name,
enum WasmOpcodeSig { FOREACH_SIGNATURE(DECLARE_SIG_ENUM) }; enum WasmOpcodeSig { FOREACH_SIGNATURE(DECLARE_SIG_ENUM) };
// TODO(titzer): not static-initializer safe. Wrap in LazyInstance. // TODO(titzer): not static-initializer safe. Wrap in LazyInstance.
#define DECLARE_SIG(name, ...) \ #define DECLARE_SIG(name, ...) \
static LocalType kTypes_##name[] = {__VA_ARGS__}; \ static LocalType kTypes_##name[] = {__VA_ARGS__}; \
...@@ -73,7 +70,6 @@ static const FunctionSig* kSimpleExprSigs[] = { ...@@ -73,7 +70,6 @@ static const FunctionSig* kSimpleExprSigs[] = {
static byte kSimpleExprSigTable[256]; static byte kSimpleExprSigTable[256];
// Initialize the signature table. // Initialize the signature table.
static void InitSigTable() { static void InitSigTable() {
#define SET_SIG_TABLE(name, opcode, sig) \ #define SET_SIG_TABLE(name, opcode, sig) \
...@@ -83,7 +79,6 @@ static void InitSigTable() { ...@@ -83,7 +79,6 @@ static void InitSigTable() {
#undef SET_SIG_TABLE #undef SET_SIG_TABLE
} }
FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) { FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) {
// TODO(titzer): use LazyInstance to make this thread safe. // TODO(titzer): use LazyInstance to make this thread safe.
if (kSimpleExprSigTable[kExprI32Add] == 0) InitSigTable(); if (kSimpleExprSigTable[kExprI32Add] == 0) InitSigTable();
...@@ -91,7 +86,6 @@ FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) { ...@@ -91,7 +86,6 @@ FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) {
kSimpleExprSigs[kSimpleExprSigTable[static_cast<byte>(opcode)]]); kSimpleExprSigs[kSimpleExprSigTable[static_cast<byte>(opcode)]]);
} }
// TODO(titzer): pull WASM_64 up to a common header. // TODO(titzer): pull WASM_64 up to a common header.
#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 #if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64
#define WASM_64 1 #define WASM_64 1
......
...@@ -28,7 +28,6 @@ std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code) { ...@@ -28,7 +28,6 @@ std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code) {
return os; return os;
} }
void ErrorThrower::Error(const char* format, ...) { void ErrorThrower::Error(const char* format, ...) {
if (error_) return; // only report the first error. if (error_) return; // only report the first error.
error_ = true; error_ = true;
......
...@@ -25,14 +25,12 @@ using namespace v8::internal::wasm; ...@@ -25,14 +25,12 @@ using namespace v8::internal::wasm;
r.Build(code, code + arraysize(code)); \ r.Build(code, code + arraysize(code)); \
} while (false) } while (false)
#define ADD_CODE(vec, ...) \ #define ADD_CODE(vec, ...) \
do { \ do { \
byte __buf[] = {__VA_ARGS__}; \ byte __buf[] = {__VA_ARGS__}; \
for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \
} while (false) } while (false)
namespace { namespace {
// A helper for generating predictable but unique argument values that // A helper for generating predictable but unique argument values that
// are easy to debug (e.g. with misaligned stacks). // are easy to debug (e.g. with misaligned stacks).
...@@ -48,7 +46,6 @@ class PredictableInputValues { ...@@ -48,7 +46,6 @@ class PredictableInputValues {
} }
}; };
uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) { uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) {
const int kMaxParams = 11; const int kMaxParams = 11;
static const char* formals[kMaxParams] = {"", static const char* formals[kMaxParams] = {"",
...@@ -73,7 +70,6 @@ uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) { ...@@ -73,7 +70,6 @@ uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) {
return module->AddJsFunction(sig, source.start()); return module->AddJsFunction(sig, source.start());
} }
void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc,
Handle<Object>* buffer, int count) { Handle<Object>* buffer, int count) {
Isolate* isolate = jsfunc->GetIsolate(); Isolate* isolate = jsfunc->GetIsolate();
...@@ -91,7 +87,6 @@ void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, ...@@ -91,7 +87,6 @@ void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc,
} }
} }
void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a, void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a,
double b) { double b) {
Isolate* isolate = jsfunc->GetIsolate(); Isolate* isolate = jsfunc->GetIsolate();
...@@ -112,7 +107,6 @@ TEST(Run_Int32Sub_jswrapped) { ...@@ -112,7 +107,6 @@ TEST(Run_Int32Sub_jswrapped) {
EXPECT_CALL(-8723487, jsfunc, -8000000, 723487); EXPECT_CALL(-8723487, jsfunc, -8000000, 723487);
} }
TEST(Run_Float32Div_jswrapped) { TEST(Run_Float32Div_jswrapped) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -124,7 +118,6 @@ TEST(Run_Float32Div_jswrapped) { ...@@ -124,7 +118,6 @@ TEST(Run_Float32Div_jswrapped) {
EXPECT_CALL(64, jsfunc, -16, -0.25); EXPECT_CALL(64, jsfunc, -16, -0.25);
} }
TEST(Run_Float64Add_jswrapped) { TEST(Run_Float64Add_jswrapped) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -136,7 +129,6 @@ TEST(Run_Float64Add_jswrapped) { ...@@ -136,7 +129,6 @@ TEST(Run_Float64Add_jswrapped) {
EXPECT_CALL(-5.5, jsfunc, -5.25, -0.25); EXPECT_CALL(-5.5, jsfunc, -5.25, -0.25);
} }
TEST(Run_I32Popcount_jswrapped) { TEST(Run_I32Popcount_jswrapped) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -149,7 +141,6 @@ TEST(Run_I32Popcount_jswrapped) { ...@@ -149,7 +141,6 @@ TEST(Run_I32Popcount_jswrapped) {
EXPECT_CALL(6, jsfunc, 0x3F, 0); EXPECT_CALL(6, jsfunc, 0x3F, 0);
} }
TEST(Run_CallJS_Add_jswrapped) { TEST(Run_CallJS_Add_jswrapped) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -165,7 +156,6 @@ TEST(Run_CallJS_Add_jswrapped) { ...@@ -165,7 +156,6 @@ TEST(Run_CallJS_Add_jswrapped) {
EXPECT_CALL(-666666801, jsfunc, -666666900, -1); EXPECT_CALL(-666666801, jsfunc, -666666900, -1);
} }
void RunJSSelectTest(int which) { void RunJSSelectTest(int which) {
const int kMaxParams = 8; const int kMaxParams = 8;
PredictableInputValues inputs(0x100); PredictableInputValues inputs(0x100);
...@@ -201,7 +191,6 @@ void RunJSSelectTest(int which) { ...@@ -201,7 +191,6 @@ void RunJSSelectTest(int which) {
} }
} }
TEST(Run_JSSelect_0) { RunJSSelectTest(0); } TEST(Run_JSSelect_0) { RunJSSelectTest(0); }
TEST(Run_JSSelect_1) { RunJSSelectTest(1); } TEST(Run_JSSelect_1) { RunJSSelectTest(1); }
...@@ -218,7 +207,6 @@ TEST(Run_JSSelect_6) { RunJSSelectTest(6); } ...@@ -218,7 +207,6 @@ TEST(Run_JSSelect_6) { RunJSSelectTest(6); }
TEST(Run_JSSelect_7) { RunJSSelectTest(7); } TEST(Run_JSSelect_7) { RunJSSelectTest(7); }
void RunWASMSelectTest(int which) { void RunWASMSelectTest(int which) {
PredictableInputValues inputs(0x200); PredictableInputValues inputs(0x200);
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
...@@ -250,7 +238,6 @@ void RunWASMSelectTest(int which) { ...@@ -250,7 +238,6 @@ void RunWASMSelectTest(int which) {
} }
} }
TEST(Run_WASMSelect_0) { RunWASMSelectTest(0); } TEST(Run_WASMSelect_0) { RunWASMSelectTest(0); }
TEST(Run_WASMSelect_1) { RunWASMSelectTest(1); } TEST(Run_WASMSelect_1) { RunWASMSelectTest(1); }
...@@ -267,7 +254,6 @@ TEST(Run_WASMSelect_6) { RunWASMSelectTest(6); } ...@@ -267,7 +254,6 @@ TEST(Run_WASMSelect_6) { RunWASMSelectTest(6); }
TEST(Run_WASMSelect_7) { RunWASMSelectTest(7); } TEST(Run_WASMSelect_7) { RunWASMSelectTest(7); }
void RunWASMSelectAlignTest(int num_args, int num_params) { void RunWASMSelectAlignTest(int num_args, int num_params) {
PredictableInputValues inputs(0x300); PredictableInputValues inputs(0x300);
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
...@@ -301,31 +287,26 @@ void RunWASMSelectAlignTest(int num_args, int num_params) { ...@@ -301,31 +287,26 @@ void RunWASMSelectAlignTest(int num_args, int num_params) {
} }
} }
TEST(Run_WASMSelectAlign_0) { TEST(Run_WASMSelectAlign_0) {
RunWASMSelectAlignTest(0, 1); RunWASMSelectAlignTest(0, 1);
RunWASMSelectAlignTest(0, 2); RunWASMSelectAlignTest(0, 2);
} }
TEST(Run_WASMSelectAlign_1) { TEST(Run_WASMSelectAlign_1) {
RunWASMSelectAlignTest(1, 2); RunWASMSelectAlignTest(1, 2);
RunWASMSelectAlignTest(1, 3); RunWASMSelectAlignTest(1, 3);
} }
TEST(Run_WASMSelectAlign_2) { TEST(Run_WASMSelectAlign_2) {
RunWASMSelectAlignTest(2, 3); RunWASMSelectAlignTest(2, 3);
RunWASMSelectAlignTest(2, 4); RunWASMSelectAlignTest(2, 4);
} }
TEST(Run_WASMSelectAlign_3) { TEST(Run_WASMSelectAlign_3) {
RunWASMSelectAlignTest(3, 3); RunWASMSelectAlignTest(3, 3);
RunWASMSelectAlignTest(3, 4); RunWASMSelectAlignTest(3, 4);
} }
TEST(Run_WASMSelectAlign_4) { TEST(Run_WASMSelectAlign_4) {
RunWASMSelectAlignTest(4, 3); RunWASMSelectAlignTest(4, 3);
RunWASMSelectAlignTest(4, 4); RunWASMSelectAlignTest(4, 4);
...@@ -412,7 +393,6 @@ void RunJSSelectAlignTest(int num_args, int num_params) { ...@@ -412,7 +393,6 @@ void RunJSSelectAlignTest(int num_args, int num_params) {
} }
} }
TEST(Run_JSSelectAlign_0) { TEST(Run_JSSelectAlign_0) {
RunJSSelectAlignTest(0, 1); RunJSSelectAlignTest(0, 1);
RunJSSelectAlignTest(0, 2); RunJSSelectAlignTest(0, 2);
......
...@@ -44,7 +44,6 @@ TEST(Run_WasmModule_Return114) { ...@@ -44,7 +44,6 @@ TEST(Run_WasmModule_Return114) {
TestModule(writer->WriteTo(&zone), kReturnValue); TestModule(writer->WriteTo(&zone), kReturnValue);
} }
TEST(Run_WasmModule_CallAdd) { TEST(Run_WasmModule_CallAdd) {
v8::base::AccountingAllocator allocator; v8::base::AccountingAllocator allocator;
Zone zone(&allocator); Zone zone(&allocator);
...@@ -66,7 +65,6 @@ TEST(Run_WasmModule_CallAdd) { ...@@ -66,7 +65,6 @@ TEST(Run_WasmModule_CallAdd) {
TestModule(writer->WriteTo(&zone), 99); TestModule(writer->WriteTo(&zone), 99);
} }
TEST(Run_WasmModule_ReadLoadedDataSegment) { TEST(Run_WasmModule_ReadLoadedDataSegment) {
static const byte kDataSegmentDest0 = 12; static const byte kDataSegmentDest0 = 12;
v8::base::AccountingAllocator allocator; v8::base::AccountingAllocator allocator;
......
...@@ -34,7 +34,6 @@ TEST(Run_WasmInt8Const) { ...@@ -34,7 +34,6 @@ TEST(Run_WasmInt8Const) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt8Const_fallthru1) { TEST(Run_WasmInt8Const_fallthru1) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const byte kExpectedValue = 122; const byte kExpectedValue = 122;
...@@ -43,7 +42,6 @@ TEST(Run_WasmInt8Const_fallthru1) { ...@@ -43,7 +42,6 @@ TEST(Run_WasmInt8Const_fallthru1) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt8Const_fallthru2) { TEST(Run_WasmInt8Const_fallthru2) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const byte kExpectedValue = 123; const byte kExpectedValue = 123;
...@@ -52,7 +50,6 @@ TEST(Run_WasmInt8Const_fallthru2) { ...@@ -52,7 +50,6 @@ TEST(Run_WasmInt8Const_fallthru2) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt8Const_all) { TEST(Run_WasmInt8Const_all) {
for (int value = -128; value <= 127; value++) { for (int value = -128; value <= 127; value++) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -63,7 +60,6 @@ TEST(Run_WasmInt8Const_all) { ...@@ -63,7 +60,6 @@ TEST(Run_WasmInt8Const_all) {
} }
} }
TEST(Run_WasmInt32Const) { TEST(Run_WasmInt32Const) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const int32_t kExpectedValue = 0x11223344; const int32_t kExpectedValue = 0x11223344;
...@@ -72,7 +68,6 @@ TEST(Run_WasmInt32Const) { ...@@ -72,7 +68,6 @@ TEST(Run_WasmInt32Const) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt32Const_many) { TEST(Run_WasmInt32Const_many) {
FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(i) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -83,7 +78,6 @@ TEST(Run_WasmInt32Const_many) { ...@@ -83,7 +78,6 @@ TEST(Run_WasmInt32Const_many) {
} }
} }
TEST(Run_WasmMemorySize) { TEST(Run_WasmMemorySize) {
TestingModule module; TestingModule module;
WasmRunner<int32_t> r(&module); WasmRunner<int32_t> r(&module);
...@@ -92,7 +86,6 @@ TEST(Run_WasmMemorySize) { ...@@ -92,7 +86,6 @@ TEST(Run_WasmMemorySize) {
CHECK_EQ(1024, r.Call()); CHECK_EQ(1024, r.Call());
} }
TEST(Run_WasmInt32Param0) { TEST(Run_WasmInt32Param0) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// return(local[0]) // return(local[0])
...@@ -100,7 +93,6 @@ TEST(Run_WasmInt32Param0) { ...@@ -100,7 +93,6 @@ TEST(Run_WasmInt32Param0) {
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_WasmInt32Param0_fallthru) { TEST(Run_WasmInt32Param0_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// local[0] // local[0]
...@@ -108,7 +100,6 @@ TEST(Run_WasmInt32Param0_fallthru) { ...@@ -108,7 +100,6 @@ TEST(Run_WasmInt32Param0_fallthru) {
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_WasmInt32Param1) { TEST(Run_WasmInt32Param1) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
// local[1] // local[1]
...@@ -116,7 +107,6 @@ TEST(Run_WasmInt32Param1) { ...@@ -116,7 +107,6 @@ TEST(Run_WasmInt32Param1) {
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); }
} }
TEST(Run_WasmInt32Add) { TEST(Run_WasmInt32Add) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// 11 + 44 // 11 + 44
...@@ -124,7 +114,6 @@ TEST(Run_WasmInt32Add) { ...@@ -124,7 +114,6 @@ TEST(Run_WasmInt32Add) {
CHECK_EQ(55, r.Call()); CHECK_EQ(55, r.Call());
} }
TEST(Run_WasmInt32Add_P) { TEST(Run_WasmInt32Add_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 + 13 // p0 + 13
...@@ -132,7 +121,6 @@ TEST(Run_WasmInt32Add_P) { ...@@ -132,7 +121,6 @@ TEST(Run_WasmInt32Add_P) {
FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); }
} }
TEST(Run_WasmInt32Add_P_fallthru) { TEST(Run_WasmInt32Add_P_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 + 13 // p0 + 13
...@@ -140,7 +128,6 @@ TEST(Run_WasmInt32Add_P_fallthru) { ...@@ -140,7 +128,6 @@ TEST(Run_WasmInt32Add_P_fallthru) {
FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); }
} }
TEST(Run_WasmInt32Add_P2) { TEST(Run_WasmInt32Add_P2) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
// p0 + p1 // p0 + p1
...@@ -154,7 +141,6 @@ TEST(Run_WasmInt32Add_P2) { ...@@ -154,7 +141,6 @@ TEST(Run_WasmInt32Add_P2) {
} }
} }
TEST(Run_WasmFloat32Add) { TEST(Run_WasmFloat32Add) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// int(11.5f + 44.5f) // int(11.5f + 44.5f)
...@@ -163,7 +149,6 @@ TEST(Run_WasmFloat32Add) { ...@@ -163,7 +149,6 @@ TEST(Run_WasmFloat32Add) {
CHECK_EQ(56, r.Call()); CHECK_EQ(56, r.Call());
} }
TEST(Run_WasmFloat64Add) { TEST(Run_WasmFloat64Add) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// return int(13.5d + 43.5d) // return int(13.5d + 43.5d)
...@@ -171,7 +156,6 @@ TEST(Run_WasmFloat64Add) { ...@@ -171,7 +156,6 @@ TEST(Run_WasmFloat64Add) {
CHECK_EQ(57, r.Call()); CHECK_EQ(57, r.Call());
} }
void TestInt32Binop(WasmOpcode opcode, int32_t expected, int32_t a, int32_t b) { void TestInt32Binop(WasmOpcode opcode, int32_t expected, int32_t a, int32_t b) {
{ {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -219,7 +203,6 @@ TEST(Run_WasmInt32Binops) { ...@@ -219,7 +203,6 @@ TEST(Run_WasmInt32Binops) {
TestInt32Binop(kExprI32GeU, 1, 0xF0000000, 98978); TestInt32Binop(kExprI32GeU, 1, 0xF0000000, 98978);
} }
void TestInt32Unop(WasmOpcode opcode, int32_t expected, int32_t a) { void TestInt32Unop(WasmOpcode opcode, int32_t expected, int32_t a) {
{ {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -235,7 +218,6 @@ void TestInt32Unop(WasmOpcode opcode, int32_t expected, int32_t a) { ...@@ -235,7 +218,6 @@ void TestInt32Unop(WasmOpcode opcode, int32_t expected, int32_t a) {
} }
} }
TEST(Run_WasmInt32Clz) { TEST(Run_WasmInt32Clz) {
TestInt32Unop(kExprI32Clz, 0, 0x80001000); TestInt32Unop(kExprI32Clz, 0, 0x80001000);
TestInt32Unop(kExprI32Clz, 1, 0x40000500); TestInt32Unop(kExprI32Clz, 1, 0x40000500);
...@@ -272,7 +254,6 @@ TEST(Run_WasmInt32Clz) { ...@@ -272,7 +254,6 @@ TEST(Run_WasmInt32Clz) {
TestInt32Unop(kExprI32Clz, 32, 0x00000000); TestInt32Unop(kExprI32Clz, 32, 0x00000000);
} }
TEST(Run_WasmInt32Ctz) { TEST(Run_WasmInt32Ctz) {
TestInt32Unop(kExprI32Ctz, 32, 0x00000000); TestInt32Unop(kExprI32Ctz, 32, 0x00000000);
TestInt32Unop(kExprI32Ctz, 31, 0x80000000); TestInt32Unop(kExprI32Ctz, 31, 0x80000000);
...@@ -309,7 +290,6 @@ TEST(Run_WasmInt32Ctz) { ...@@ -309,7 +290,6 @@ TEST(Run_WasmInt32Ctz) {
TestInt32Unop(kExprI32Ctz, 0, 0x9afdbc81); TestInt32Unop(kExprI32Ctz, 0, 0x9afdbc81);
} }
TEST(Run_WasmInt32Popcnt) { TEST(Run_WasmInt32Popcnt) {
TestInt32Unop(kExprI32Popcnt, 32, 0xffffffff); TestInt32Unop(kExprI32Popcnt, 32, 0xffffffff);
TestInt32Unop(kExprI32Popcnt, 0, 0x00000000); TestInt32Unop(kExprI32Popcnt, 0, 0x00000000);
...@@ -373,7 +353,6 @@ TEST(Run_WASM_Int32DivS_trap) { ...@@ -373,7 +353,6 @@ TEST(Run_WASM_Int32DivS_trap) {
CHECK_TRAP(r.Call(kMin, 0)); CHECK_TRAP(r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32RemS_trap) { TEST(Run_WASM_Int32RemS_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -385,7 +364,6 @@ TEST(Run_WASM_Int32RemS_trap) { ...@@ -385,7 +364,6 @@ TEST(Run_WASM_Int32RemS_trap) {
CHECK_TRAP(r.Call(kMin, 0)); CHECK_TRAP(r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32DivU_trap) { TEST(Run_WASM_Int32DivU_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -397,7 +375,6 @@ TEST(Run_WASM_Int32DivU_trap) { ...@@ -397,7 +375,6 @@ TEST(Run_WASM_Int32DivU_trap) {
CHECK_TRAP(r.Call(kMin, 0)); CHECK_TRAP(r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32RemU_trap) { TEST(Run_WASM_Int32RemU_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -423,7 +400,6 @@ TEST(Run_WASM_Int32DivS_byzero_const) { ...@@ -423,7 +400,6 @@ TEST(Run_WASM_Int32DivS_byzero_const) {
} }
} }
TEST(Run_WASM_Int32DivU_byzero_const) { TEST(Run_WASM_Int32DivU_byzero_const) {
for (uint32_t denom = 0xfffffffe; denom < 8; denom++) { for (uint32_t denom = 0xfffffffe; denom < 8; denom++) {
WasmRunner<uint32_t> r(MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32());
...@@ -439,7 +415,6 @@ TEST(Run_WASM_Int32DivU_byzero_const) { ...@@ -439,7 +415,6 @@ TEST(Run_WASM_Int32DivU_byzero_const) {
} }
} }
TEST(Run_WASM_Int32DivS_trap_effect) { TEST(Run_WASM_Int32DivS_trap_effect) {
TestingModule module; TestingModule module;
module.AddMemoryElems<int32_t>(8); module.AddMemoryElems<int32_t>(8);
...@@ -474,7 +449,6 @@ void TestFloat32Binop(WasmOpcode opcode, int32_t expected, float a, float b) { ...@@ -474,7 +449,6 @@ void TestFloat32Binop(WasmOpcode opcode, int32_t expected, float a, float b) {
} }
} }
void TestFloat32BinopWithConvert(WasmOpcode opcode, int32_t expected, float a, void TestFloat32BinopWithConvert(WasmOpcode opcode, int32_t expected, float a,
float b) { float b) {
{ {
...@@ -493,7 +467,6 @@ void TestFloat32BinopWithConvert(WasmOpcode opcode, int32_t expected, float a, ...@@ -493,7 +467,6 @@ void TestFloat32BinopWithConvert(WasmOpcode opcode, int32_t expected, float a,
} }
} }
void TestFloat32UnopWithConvert(WasmOpcode opcode, int32_t expected, float a) { void TestFloat32UnopWithConvert(WasmOpcode opcode, int32_t expected, float a) {
{ {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -509,7 +482,6 @@ void TestFloat32UnopWithConvert(WasmOpcode opcode, int32_t expected, float a) { ...@@ -509,7 +482,6 @@ void TestFloat32UnopWithConvert(WasmOpcode opcode, int32_t expected, float a) {
} }
} }
void TestFloat64Binop(WasmOpcode opcode, int32_t expected, double a, double b) { void TestFloat64Binop(WasmOpcode opcode, int32_t expected, double a, double b) {
{ {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -525,7 +497,6 @@ void TestFloat64Binop(WasmOpcode opcode, int32_t expected, double a, double b) { ...@@ -525,7 +497,6 @@ void TestFloat64Binop(WasmOpcode opcode, int32_t expected, double a, double b) {
} }
} }
void TestFloat64BinopWithConvert(WasmOpcode opcode, int32_t expected, double a, void TestFloat64BinopWithConvert(WasmOpcode opcode, int32_t expected, double a,
double b) { double b) {
{ {
...@@ -543,7 +514,6 @@ void TestFloat64BinopWithConvert(WasmOpcode opcode, int32_t expected, double a, ...@@ -543,7 +514,6 @@ void TestFloat64BinopWithConvert(WasmOpcode opcode, int32_t expected, double a,
} }
} }
void TestFloat64UnopWithConvert(WasmOpcode opcode, int32_t expected, double a) { void TestFloat64UnopWithConvert(WasmOpcode opcode, int32_t expected, double a) {
{ {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -611,7 +581,6 @@ TEST(Run_WasmFloat32Neg) { ...@@ -611,7 +581,6 @@ TEST(Run_WasmFloat32Neg) {
} }
} }
TEST(Run_WasmFloat64Neg) { TEST(Run_WasmFloat64Neg) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0)));
...@@ -622,7 +591,6 @@ TEST(Run_WasmFloat64Neg) { ...@@ -622,7 +591,6 @@ TEST(Run_WasmFloat64Neg) {
} }
} }
TEST(Run_Wasm_IfElse_P) { TEST(Run_Wasm_IfElse_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// if (p0) return 11; else return 22; // if (p0) return 11; else return 22;
...@@ -690,7 +658,6 @@ TEST(Run_Wasm_IfElse_Unreachable1) { ...@@ -690,7 +658,6 @@ TEST(Run_Wasm_IfElse_Unreachable1) {
CHECK_EQ(27, r.Call()); CHECK_EQ(27, r.Call());
} }
TEST(Run_Wasm_Return12) { TEST(Run_Wasm_Return12) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -698,7 +665,6 @@ TEST(Run_Wasm_Return12) { ...@@ -698,7 +665,6 @@ TEST(Run_Wasm_Return12) {
CHECK_EQ(12, r.Call()); CHECK_EQ(12, r.Call());
} }
TEST(Run_Wasm_Return17) { TEST(Run_Wasm_Return17) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -706,7 +672,6 @@ TEST(Run_Wasm_Return17) { ...@@ -706,7 +672,6 @@ TEST(Run_Wasm_Return17) {
CHECK_EQ(17, r.Call()); CHECK_EQ(17, r.Call());
} }
TEST(Run_Wasm_Return_I32) { TEST(Run_Wasm_Return_I32) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
...@@ -715,7 +680,6 @@ TEST(Run_Wasm_Return_I32) { ...@@ -715,7 +680,6 @@ TEST(Run_Wasm_Return_I32) {
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Return_F32) { TEST(Run_Wasm_Return_F32) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
...@@ -732,7 +696,6 @@ TEST(Run_Wasm_Return_F32) { ...@@ -732,7 +696,6 @@ TEST(Run_Wasm_Return_F32) {
} }
} }
TEST(Run_Wasm_Return_F64) { TEST(Run_Wasm_Return_F64) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
...@@ -749,7 +712,6 @@ TEST(Run_Wasm_Return_F64) { ...@@ -749,7 +712,6 @@ TEST(Run_Wasm_Return_F64) {
} }
} }
TEST(Run_Wasm_Select) { TEST(Run_Wasm_Select) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// return select(11, 22, a); // return select(11, 22, a);
...@@ -760,7 +722,6 @@ TEST(Run_Wasm_Select) { ...@@ -760,7 +722,6 @@ TEST(Run_Wasm_Select) {
} }
} }
TEST(Run_Wasm_Select_strict1) { TEST(Run_Wasm_Select_strict1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// select(a=0, a=1, a=2); return a // select(a=0, a=1, a=2); return a
...@@ -771,7 +732,6 @@ TEST(Run_Wasm_Select_strict1) { ...@@ -771,7 +732,6 @@ TEST(Run_Wasm_Select_strict1) {
FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); }
} }
TEST(Run_Wasm_Select_strict2) { TEST(Run_Wasm_Select_strict2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32);
...@@ -799,7 +759,6 @@ TEST(Run_Wasm_Select_strict3) { ...@@ -799,7 +759,6 @@ TEST(Run_Wasm_Select_strict3) {
} }
} }
TEST(Run_Wasm_BrIf_strict) { TEST(Run_Wasm_BrIf_strict) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD( BUILD(
...@@ -988,7 +947,6 @@ TEST(Run_Wasm_F32ReinterpretI32) { ...@@ -988,7 +947,6 @@ TEST(Run_Wasm_F32ReinterpretI32) {
} }
} }
TEST(Run_Wasm_I32ReinterpretF32) { TEST(Run_Wasm_I32ReinterpretF32) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
...@@ -1006,7 +964,6 @@ TEST(Run_Wasm_I32ReinterpretF32) { ...@@ -1006,7 +964,6 @@ TEST(Run_Wasm_I32ReinterpretF32) {
} }
} }
TEST(Run_Wasm_ReturnStore) { TEST(Run_Wasm_ReturnStore) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
...@@ -1022,7 +979,6 @@ TEST(Run_Wasm_ReturnStore) { ...@@ -1022,7 +979,6 @@ TEST(Run_Wasm_ReturnStore) {
} }
} }
TEST(Run_Wasm_VoidReturn1) { TEST(Run_Wasm_VoidReturn1) {
// We use a wrapper function because WasmRunner<void> does not exist. // We use a wrapper function because WasmRunner<void> does not exist.
...@@ -1042,7 +998,6 @@ TEST(Run_Wasm_VoidReturn1) { ...@@ -1042,7 +998,6 @@ TEST(Run_Wasm_VoidReturn1) {
CHECK_EQ(kExpected, result); CHECK_EQ(kExpected, result);
} }
TEST(Run_Wasm_VoidReturn2) { TEST(Run_Wasm_VoidReturn2) {
// We use a wrapper function because WasmRunner<void> does not exist. // We use a wrapper function because WasmRunner<void> does not exist.
// Build the test function. // Build the test function.
...@@ -1137,7 +1092,6 @@ TEST(Run_Wasm_Block_BrIf_P) { ...@@ -1137,7 +1092,6 @@ TEST(Run_Wasm_Block_BrIf_P) {
} }
} }
TEST(Run_Wasm_Block_IfElse_P_assign) { TEST(Run_Wasm_Block_IfElse_P_assign) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// { if (p0) p0 = 71; else p0 = 72; return p0; } // { if (p0) p0 = 71; else p0 = 72; return p0; }
...@@ -1152,7 +1106,6 @@ TEST(Run_Wasm_Block_IfElse_P_assign) { ...@@ -1152,7 +1106,6 @@ TEST(Run_Wasm_Block_IfElse_P_assign) {
} }
} }
TEST(Run_Wasm_Block_IfElse_P_return) { TEST(Run_Wasm_Block_IfElse_P_return) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// if (p0) return 81; else return 82; // if (p0) return 81; else return 82;
...@@ -1166,7 +1119,6 @@ TEST(Run_Wasm_Block_IfElse_P_return) { ...@@ -1166,7 +1119,6 @@ TEST(Run_Wasm_Block_IfElse_P_return) {
} }
} }
TEST(Run_Wasm_Block_If_P_assign) { TEST(Run_Wasm_Block_If_P_assign) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// { if (p0) p0 = 61; p0; } // { if (p0) p0 = 61; p0; }
...@@ -1179,7 +1131,6 @@ TEST(Run_Wasm_Block_If_P_assign) { ...@@ -1179,7 +1131,6 @@ TEST(Run_Wasm_Block_If_P_assign) {
} }
} }
TEST(Run_Wasm_DanglingAssign) { TEST(Run_Wasm_DanglingAssign) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// { return 0; p0 = 0; } // { return 0; p0 = 0; }
...@@ -1187,7 +1138,6 @@ TEST(Run_Wasm_DanglingAssign) { ...@@ -1187,7 +1138,6 @@ TEST(Run_Wasm_DanglingAssign) {
CHECK_EQ(99, r.Call(1)); CHECK_EQ(99, r.Call(1));
} }
TEST(Run_Wasm_ExprIf_P) { TEST(Run_Wasm_ExprIf_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 ? 11 : 22; // p0 ? 11 : 22;
...@@ -1200,7 +1150,6 @@ TEST(Run_Wasm_ExprIf_P) { ...@@ -1200,7 +1150,6 @@ TEST(Run_Wasm_ExprIf_P) {
} }
} }
TEST(Run_Wasm_ExprIf_P_fallthru) { TEST(Run_Wasm_ExprIf_P_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 ? 11 : 22; // p0 ? 11 : 22;
...@@ -1213,7 +1162,6 @@ TEST(Run_Wasm_ExprIf_P_fallthru) { ...@@ -1213,7 +1162,6 @@ TEST(Run_Wasm_ExprIf_P_fallthru) {
} }
} }
TEST(Run_Wasm_CountDown) { TEST(Run_Wasm_CountDown) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
...@@ -1229,7 +1177,6 @@ TEST(Run_Wasm_CountDown) { ...@@ -1229,7 +1177,6 @@ TEST(Run_Wasm_CountDown) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_CountDown_fallthru) { TEST(Run_Wasm_CountDown_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
...@@ -1244,7 +1191,6 @@ TEST(Run_Wasm_CountDown_fallthru) { ...@@ -1244,7 +1191,6 @@ TEST(Run_Wasm_CountDown_fallthru) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_WhileCountDown) { TEST(Run_Wasm_WhileCountDown) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_BLOCK( BUILD(r, WASM_BLOCK(
...@@ -1257,7 +1203,6 @@ TEST(Run_Wasm_WhileCountDown) { ...@@ -1257,7 +1203,6 @@ TEST(Run_Wasm_WhileCountDown) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_Loop_if_break1) { TEST(Run_Wasm_Loop_if_break1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), BUILD(r, B2(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
...@@ -1269,7 +1214,6 @@ TEST(Run_Wasm_Loop_if_break1) { ...@@ -1269,7 +1214,6 @@ TEST(Run_Wasm_Loop_if_break1) {
CHECK_EQ(-29, r.Call(-29)); CHECK_EQ(-29, r.Call(-29));
} }
TEST(Run_Wasm_Loop_if_break2) { TEST(Run_Wasm_Loop_if_break2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_LOOP(2, WASM_BR_IF(1, WASM_GET_LOCAL(0)), BUILD(r, B2(WASM_LOOP(2, WASM_BR_IF(1, WASM_GET_LOCAL(0)),
...@@ -1281,7 +1225,6 @@ TEST(Run_Wasm_Loop_if_break2) { ...@@ -1281,7 +1225,6 @@ TEST(Run_Wasm_Loop_if_break2) {
CHECK_EQ(-29, r.Call(-29)); CHECK_EQ(-29, r.Call(-29));
} }
TEST(Run_Wasm_Loop_if_break_fallthru) { TEST(Run_Wasm_Loop_if_break_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), BUILD(r, B1(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
...@@ -1329,7 +1272,6 @@ TEST(Run_Wasm_LoadMemI32) { ...@@ -1329,7 +1272,6 @@ TEST(Run_Wasm_LoadMemI32) {
CHECK_EQ(77777777, r.Call(0)); CHECK_EQ(77777777, r.Call(0));
} }
TEST(Run_Wasm_LoadMemI32_oob) { TEST(Run_Wasm_LoadMemI32_oob) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
...@@ -1349,7 +1291,6 @@ TEST(Run_Wasm_LoadMemI32_oob) { ...@@ -1349,7 +1291,6 @@ TEST(Run_Wasm_LoadMemI32_oob) {
} }
} }
TEST(Run_Wasm_LoadMem_offset_oob) { TEST(Run_Wasm_LoadMem_offset_oob) {
TestingModule module; TestingModule module;
module.AddMemoryElems<int32_t>(8); module.AddMemoryElems<int32_t>(8);
...@@ -1376,7 +1317,6 @@ TEST(Run_Wasm_LoadMem_offset_oob) { ...@@ -1376,7 +1317,6 @@ TEST(Run_Wasm_LoadMem_offset_oob) {
} }
} }
TEST(Run_Wasm_LoadMemI32_offset) { TEST(Run_Wasm_LoadMemI32_offset) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(4); int32_t* memory = module.AddMemoryElems<int32_t>(4);
...@@ -1402,7 +1342,6 @@ TEST(Run_Wasm_LoadMemI32_offset) { ...@@ -1402,7 +1342,6 @@ TEST(Run_Wasm_LoadMemI32_offset) {
CHECK_EQ(44444444, r.Call(8)); CHECK_EQ(44444444, r.Call(8));
} }
#if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64 #if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64
TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) { TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) {
...@@ -1430,7 +1369,6 @@ TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) { ...@@ -1430,7 +1369,6 @@ TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) {
#endif #endif
TEST(Run_Wasm_LoadMemI32_const_oob) { TEST(Run_Wasm_LoadMemI32_const_oob) {
const int kMemSize = 24; const int kMemSize = 24;
for (int offset = 0; offset < kMemSize + 5; offset += 4) { for (int offset = 0; offset < kMemSize + 5; offset += 4) {
...@@ -1453,7 +1391,6 @@ TEST(Run_Wasm_LoadMemI32_const_oob) { ...@@ -1453,7 +1391,6 @@ TEST(Run_Wasm_LoadMemI32_const_oob) {
} }
} }
TEST(Run_Wasm_StoreMemI32_offset) { TEST(Run_Wasm_StoreMemI32_offset) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(4); int32_t* memory = module.AddMemoryElems<int32_t>(4);
...@@ -1477,7 +1414,6 @@ TEST(Run_Wasm_StoreMemI32_offset) { ...@@ -1477,7 +1414,6 @@ TEST(Run_Wasm_StoreMemI32_offset) {
} }
} }
TEST(Run_Wasm_StoreMem_offset_oob) { TEST(Run_Wasm_StoreMem_offset_oob) {
TestingModule module; TestingModule module;
byte* memory = module.AddMemoryElems<byte>(32); byte* memory = module.AddMemoryElems<byte>(32);
...@@ -1514,7 +1450,6 @@ TEST(Run_Wasm_StoreMem_offset_oob) { ...@@ -1514,7 +1450,6 @@ TEST(Run_Wasm_StoreMem_offset_oob) {
} }
} }
TEST(Run_Wasm_LoadMemI32_P) { TEST(Run_Wasm_LoadMemI32_P) {
const int kNumElems = 8; const int kNumElems = 8;
TestingModule module; TestingModule module;
...@@ -1529,7 +1464,6 @@ TEST(Run_Wasm_LoadMemI32_P) { ...@@ -1529,7 +1464,6 @@ TEST(Run_Wasm_LoadMemI32_P) {
} }
} }
TEST(Run_Wasm_MemI32_Sum) { TEST(Run_Wasm_MemI32_Sum) {
const int kNumElems = 20; const int kNumElems = 20;
TestingModule module; TestingModule module;
...@@ -1562,7 +1496,6 @@ TEST(Run_Wasm_MemI32_Sum) { ...@@ -1562,7 +1496,6 @@ TEST(Run_Wasm_MemI32_Sum) {
} }
} }
TEST(Run_Wasm_CheckMachIntsZero) { TEST(Run_Wasm_CheckMachIntsZero) {
const int kNumElems = 55; const int kNumElems = 55;
TestingModule module; TestingModule module;
...@@ -1578,7 +1511,6 @@ TEST(Run_Wasm_CheckMachIntsZero) { ...@@ -1578,7 +1511,6 @@ TEST(Run_Wasm_CheckMachIntsZero) {
CHECK_EQ(0, r.Call((kNumElems - 1) * 4)); CHECK_EQ(0, r.Call((kNumElems - 1) * 4));
} }
TEST(Run_Wasm_MemF32_Sum) { TEST(Run_Wasm_MemF32_Sum) {
const int kSize = 5; const int kSize = 5;
TestingModule module; TestingModule module;
...@@ -1612,7 +1544,6 @@ TEST(Run_Wasm_MemF32_Sum) { ...@@ -1612,7 +1544,6 @@ TEST(Run_Wasm_MemF32_Sum) {
CHECK_EQ(71256.0f, buffer[0]); CHECK_EQ(71256.0f, buffer[0]);
} }
template <typename T> template <typename T>
T GenerateAndRunFold(WasmOpcode binop, T* buffer, size_t size, T GenerateAndRunFold(WasmOpcode binop, T* buffer, size_t size,
LocalType astType, MachineType memType) { LocalType astType, MachineType memType) {
...@@ -1643,7 +1574,6 @@ T GenerateAndRunFold(WasmOpcode binop, T* buffer, size_t size, ...@@ -1643,7 +1574,6 @@ T GenerateAndRunFold(WasmOpcode binop, T* buffer, size_t size,
return module.raw_mem_at<double>(0); return module.raw_mem_at<double>(0);
} }
TEST(Run_Wasm_MemF64_Mul) { TEST(Run_Wasm_MemF64_Mul) {
const size_t kSize = 6; const size_t kSize = 6;
double buffer[kSize] = {1, 2, 2, 2, 2, 2}; double buffer[kSize] = {1, 2, 2, 2, 2, 2};
...@@ -1652,14 +1582,12 @@ TEST(Run_Wasm_MemF64_Mul) { ...@@ -1652,14 +1582,12 @@ TEST(Run_Wasm_MemF64_Mul) {
CHECK_EQ(32, result); CHECK_EQ(32, result);
} }
TEST(Build_Wasm_Infinite_Loop) { TEST(Build_Wasm_Infinite_Loop) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// Only build the graph and compile, don't run. // Only build the graph and compile, don't run.
BUILD(r, WASM_INFINITE_LOOP); BUILD(r, WASM_INFINITE_LOOP);
} }
TEST(Build_Wasm_Infinite_Loop_effect) { TEST(Build_Wasm_Infinite_Loop_effect) {
TestingModule module; TestingModule module;
module.AddMemoryElems<int8_t>(16); module.AddMemoryElems<int8_t>(16);
...@@ -1669,7 +1597,6 @@ TEST(Build_Wasm_Infinite_Loop_effect) { ...@@ -1669,7 +1597,6 @@ TEST(Build_Wasm_Infinite_Loop_effect) {
BUILD(r, WASM_LOOP(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))); BUILD(r, WASM_LOOP(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)));
} }
TEST(Run_Wasm_Unreachable0a) { TEST(Run_Wasm_Unreachable0a) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV(0, WASM_I8(9)), RET(WASM_GET_LOCAL(0)))); BUILD(r, B2(WASM_BRV(0, WASM_I8(9)), RET(WASM_GET_LOCAL(0))));
...@@ -1677,7 +1604,6 @@ TEST(Run_Wasm_Unreachable0a) { ...@@ -1677,7 +1604,6 @@ TEST(Run_Wasm_Unreachable0a) {
CHECK_EQ(9, r.Call(1)); CHECK_EQ(9, r.Call(1));
} }
TEST(Run_Wasm_Unreachable0b) { TEST(Run_Wasm_Unreachable0b) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV(0, WASM_I8(7)), WASM_UNREACHABLE)); BUILD(r, B2(WASM_BRV(0, WASM_I8(7)), WASM_UNREACHABLE));
...@@ -1685,38 +1611,32 @@ TEST(Run_Wasm_Unreachable0b) { ...@@ -1685,38 +1611,32 @@ TEST(Run_Wasm_Unreachable0b) {
CHECK_EQ(7, r.Call(1)); CHECK_EQ(7, r.Call(1));
} }
TEST(Build_Wasm_Unreachable1) { TEST(Build_Wasm_Unreachable1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_UNREACHABLE); BUILD(r, WASM_UNREACHABLE);
} }
TEST(Build_Wasm_Unreachable2) { TEST(Build_Wasm_Unreachable2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE); BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE);
} }
TEST(Build_Wasm_Unreachable3) { TEST(Build_Wasm_Unreachable3) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE); BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE);
} }
TEST(Build_Wasm_UnreachableIf1) { TEST(Build_Wasm_UnreachableIf1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_UNREACHABLE, WASM_IF(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); BUILD(r, WASM_UNREACHABLE, WASM_IF(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
} }
TEST(Build_Wasm_UnreachableIf2) { TEST(Build_Wasm_UnreachableIf2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_UNREACHABLE, BUILD(r, WASM_UNREACHABLE,
WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE));
} }
TEST(Run_Wasm_Unreachable_Load) { TEST(Run_Wasm_Unreachable_Load) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV(0, WASM_GET_LOCAL(0)), BUILD(r, B2(WASM_BRV(0, WASM_GET_LOCAL(0)),
...@@ -1725,7 +1645,6 @@ TEST(Run_Wasm_Unreachable_Load) { ...@@ -1725,7 +1645,6 @@ TEST(Run_Wasm_Unreachable_Load) {
CHECK_EQ(21, r.Call(21)); CHECK_EQ(21, r.Call(21));
} }
TEST(Run_Wasm_Infinite_Loop_not_taken1) { TEST(Run_Wasm_Infinite_Loop_not_taken1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I8(45))); BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I8(45)));
...@@ -1733,7 +1652,6 @@ TEST(Run_Wasm_Infinite_Loop_not_taken1) { ...@@ -1733,7 +1652,6 @@ TEST(Run_Wasm_Infinite_Loop_not_taken1) {
CHECK_EQ(45, r.Call(0)); CHECK_EQ(45, r.Call(0));
} }
TEST(Run_Wasm_Infinite_Loop_not_taken2) { TEST(Run_Wasm_Infinite_Loop_not_taken2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(45)), BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(45)),
...@@ -1742,7 +1660,6 @@ TEST(Run_Wasm_Infinite_Loop_not_taken2) { ...@@ -1742,7 +1660,6 @@ TEST(Run_Wasm_Infinite_Loop_not_taken2) {
CHECK_EQ(45, r.Call(1)); CHECK_EQ(45, r.Call(1));
} }
TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) { TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
...@@ -1751,7 +1668,6 @@ TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) { ...@@ -1751,7 +1668,6 @@ TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) {
CHECK_EQ(45, r.Call(1)); CHECK_EQ(45, r.Call(1));
} }
static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone(isolate->allocator()); Zone zone(isolate->allocator());
...@@ -1777,7 +1693,6 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { ...@@ -1777,7 +1693,6 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) {
} }
} }
TEST(Build_Wasm_SimpleExprs) { TEST(Build_Wasm_SimpleExprs) {
// Test that the decoder can build a graph for all supported simple expressions. // Test that the decoder can build a graph for all supported simple expressions.
#define GRAPH_BUILD_TEST(name, opcode, sig) \ #define GRAPH_BUILD_TEST(name, opcode, sig) \
...@@ -1788,7 +1703,6 @@ TEST(Build_Wasm_SimpleExprs) { ...@@ -1788,7 +1703,6 @@ TEST(Build_Wasm_SimpleExprs) {
#undef GRAPH_BUILD_TEST #undef GRAPH_BUILD_TEST
} }
TEST(Run_Wasm_Int32LoadInt8_signext) { TEST(Run_Wasm_Int32LoadInt8_signext) {
TestingModule module; TestingModule module;
const int kNumElems = 16; const int kNumElems = 16;
...@@ -1803,7 +1717,6 @@ TEST(Run_Wasm_Int32LoadInt8_signext) { ...@@ -1803,7 +1717,6 @@ TEST(Run_Wasm_Int32LoadInt8_signext) {
} }
} }
TEST(Run_Wasm_Int32LoadInt8_zeroext) { TEST(Run_Wasm_Int32LoadInt8_zeroext) {
TestingModule module; TestingModule module;
const int kNumElems = 16; const int kNumElems = 16;
...@@ -1818,7 +1731,6 @@ TEST(Run_Wasm_Int32LoadInt8_zeroext) { ...@@ -1818,7 +1731,6 @@ TEST(Run_Wasm_Int32LoadInt8_zeroext) {
} }
} }
TEST(Run_Wasm_Int32LoadInt16_signext) { TEST(Run_Wasm_Int32LoadInt16_signext) {
TestingModule module; TestingModule module;
const int kNumBytes = 16; const int kNumBytes = 16;
...@@ -1834,7 +1746,6 @@ TEST(Run_Wasm_Int32LoadInt16_signext) { ...@@ -1834,7 +1746,6 @@ TEST(Run_Wasm_Int32LoadInt16_signext) {
} }
} }
TEST(Run_Wasm_Int32LoadInt16_zeroext) { TEST(Run_Wasm_Int32LoadInt16_zeroext) {
TestingModule module; TestingModule module;
const int kNumBytes = 16; const int kNumBytes = 16;
...@@ -1850,7 +1761,6 @@ TEST(Run_Wasm_Int32LoadInt16_zeroext) { ...@@ -1850,7 +1761,6 @@ TEST(Run_Wasm_Int32LoadInt16_zeroext) {
} }
} }
TEST(Run_WasmInt32Global) { TEST(Run_WasmInt32Global) {
TestingModule module; TestingModule module;
int32_t* global = module.AddGlobal<int32_t>(MachineType::Int32()); int32_t* global = module.AddGlobal<int32_t>(MachineType::Int32());
...@@ -1867,7 +1777,6 @@ TEST(Run_WasmInt32Global) { ...@@ -1867,7 +1777,6 @@ TEST(Run_WasmInt32Global) {
} }
} }
TEST(Run_WasmInt32Globals_DontAlias) { TEST(Run_WasmInt32Globals_DontAlias) {
const int kNumGlobals = 3; const int kNumGlobals = 3;
TestingModule module; TestingModule module;
...@@ -1896,7 +1805,6 @@ TEST(Run_WasmInt32Globals_DontAlias) { ...@@ -1896,7 +1805,6 @@ TEST(Run_WasmInt32Globals_DontAlias) {
} }
} }
TEST(Run_WasmFloat32Global) { TEST(Run_WasmFloat32Global) {
TestingModule module; TestingModule module;
float* global = module.AddGlobal<float>(MachineType::Float32()); float* global = module.AddGlobal<float>(MachineType::Float32());
...@@ -1915,7 +1823,6 @@ TEST(Run_WasmFloat32Global) { ...@@ -1915,7 +1823,6 @@ TEST(Run_WasmFloat32Global) {
} }
} }
TEST(Run_WasmFloat64Global) { TEST(Run_WasmFloat64Global) {
TestingModule module; TestingModule module;
double* global = module.AddGlobal<double>(MachineType::Float64()); double* global = module.AddGlobal<double>(MachineType::Float64());
...@@ -1934,7 +1841,6 @@ TEST(Run_WasmFloat64Global) { ...@@ -1934,7 +1841,6 @@ TEST(Run_WasmFloat64Global) {
} }
} }
TEST(Run_WasmMixedGlobals) { TEST(Run_WasmMixedGlobals) {
TestingModule module; TestingModule module;
int32_t* unused = module.AddGlobal<int32_t>(MachineType::Int32()); int32_t* unused = module.AddGlobal<int32_t>(MachineType::Int32());
...@@ -1989,7 +1895,6 @@ TEST(Run_WasmMixedGlobals) { ...@@ -1989,7 +1895,6 @@ TEST(Run_WasmMixedGlobals) {
USE(unused); USE(unused);
} }
TEST(Run_WasmCallEmpty) { TEST(Run_WasmCallEmpty) {
const int32_t kExpected = -414444; const int32_t kExpected = -414444;
// Build the target function. // Build the target function.
...@@ -2007,7 +1912,6 @@ TEST(Run_WasmCallEmpty) { ...@@ -2007,7 +1912,6 @@ TEST(Run_WasmCallEmpty) {
CHECK_EQ(kExpected, result); CHECK_EQ(kExpected, result);
} }
TEST(Run_WasmCallF32StackParameter) { TEST(Run_WasmCallF32StackParameter) {
// Build the target function. // Build the target function.
LocalType param_types[20]; LocalType param_types[20];
...@@ -2032,7 +1936,6 @@ TEST(Run_WasmCallF32StackParameter) { ...@@ -2032,7 +1936,6 @@ TEST(Run_WasmCallF32StackParameter) {
CHECK_EQ(256.5f, result); CHECK_EQ(256.5f, result);
} }
TEST(Run_WasmCallF64StackParameter) { TEST(Run_WasmCallF64StackParameter) {
// Build the target function. // Build the target function.
LocalType param_types[20]; LocalType param_types[20];
...@@ -2081,7 +1984,6 @@ TEST(Run_WasmCallVoid) { ...@@ -2081,7 +1984,6 @@ TEST(Run_WasmCallVoid) {
CHECK_EQ(kExpected, module.raw_mem_start<int32_t>()[kElemNum]); CHECK_EQ(kExpected, module.raw_mem_start<int32_t>()[kElemNum]);
} }
TEST(Run_WasmCall_Int32Add) { TEST(Run_WasmCall_Int32Add) {
// Build the target function. // Build the target function.
TestSignatures sigs; TestSignatures sigs;
...@@ -2121,7 +2023,6 @@ TEST(Run_WasmCall_Float32Sub) { ...@@ -2121,7 +2023,6 @@ TEST(Run_WasmCall_Float32Sub) {
} }
} }
TEST(Run_WasmCall_Float64Sub) { TEST(Run_WasmCall_Float64Sub) {
TestingModule module; TestingModule module;
double* memory = module.AddMemoryElems<double>(16); double* memory = module.AddMemoryElems<double>(16);
...@@ -2156,7 +2057,6 @@ TEST(Run_WasmCall_Float64Sub) { ...@@ -2156,7 +2057,6 @@ TEST(Run_WasmCall_Float64Sub) {
for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \
} while (false) } while (false)
static void Run_WasmMixedCall_N(int start) { static void Run_WasmMixedCall_N(int start) {
const int kExpected = 6333; const int kExpected = 6333;
const int kElemSize = 8; const int kElemSize = 8;
...@@ -2244,7 +2144,6 @@ static void Run_WasmMixedCall_N(int start) { ...@@ -2244,7 +2144,6 @@ static void Run_WasmMixedCall_N(int start) {
} }
} }
TEST(Run_WasmMixedCall_0) { Run_WasmMixedCall_N(0); } TEST(Run_WasmMixedCall_0) { Run_WasmMixedCall_N(0); }
TEST(Run_WasmMixedCall_1) { Run_WasmMixedCall_N(1); } TEST(Run_WasmMixedCall_1) { Run_WasmMixedCall_N(1); }
TEST(Run_WasmMixedCall_2) { Run_WasmMixedCall_N(2); } TEST(Run_WasmMixedCall_2) { Run_WasmMixedCall_N(2); }
...@@ -2283,7 +2182,6 @@ TEST(Run_Wasm_CountDown_expr) { ...@@ -2283,7 +2182,6 @@ TEST(Run_Wasm_CountDown_expr) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_ExprBlock2a) { TEST(Run_Wasm_ExprBlock2a) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(1))); BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(1)));
...@@ -2291,7 +2189,6 @@ TEST(Run_Wasm_ExprBlock2a) { ...@@ -2291,7 +2189,6 @@ TEST(Run_Wasm_ExprBlock2a) {
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock2b) { TEST(Run_Wasm_ExprBlock2b) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(2))); BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(2)));
...@@ -2299,7 +2196,6 @@ TEST(Run_Wasm_ExprBlock2b) { ...@@ -2299,7 +2196,6 @@ TEST(Run_Wasm_ExprBlock2b) {
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock2c) { TEST(Run_Wasm_ExprBlock2c) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(1))); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(1)));
...@@ -2307,7 +2203,6 @@ TEST(Run_Wasm_ExprBlock2c) { ...@@ -2307,7 +2203,6 @@ TEST(Run_Wasm_ExprBlock2c) {
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock2d) { TEST(Run_Wasm_ExprBlock2d) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(2))); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(2)));
...@@ -2315,7 +2210,6 @@ TEST(Run_Wasm_ExprBlock2d) { ...@@ -2315,7 +2210,6 @@ TEST(Run_Wasm_ExprBlock2d) {
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock_ManualSwitch) { TEST(Run_Wasm_ExprBlock_ManualSwitch) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_BLOCK(6, WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)), BUILD(r, WASM_BLOCK(6, WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)),
...@@ -2338,7 +2232,6 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch) { ...@@ -2338,7 +2232,6 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch) {
CHECK_EQ(99, r.Call(6)); CHECK_EQ(99, r.Call(6));
} }
TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) { TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
...@@ -2362,7 +2255,6 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) { ...@@ -2362,7 +2255,6 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) {
CHECK_EQ(99, r.Call(6)); CHECK_EQ(99, r.Call(6));
} }
TEST(Run_Wasm_nested_ifs) { TEST(Run_Wasm_nested_ifs) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
...@@ -2371,14 +2263,12 @@ TEST(Run_Wasm_nested_ifs) { ...@@ -2371,14 +2263,12 @@ TEST(Run_Wasm_nested_ifs) {
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)), WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14)))); WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14))));
CHECK_EQ(11, r.Call(1, 1)); CHECK_EQ(11, r.Call(1, 1));
CHECK_EQ(12, r.Call(1, 0)); CHECK_EQ(12, r.Call(1, 0));
CHECK_EQ(13, r.Call(0, 1)); CHECK_EQ(13, r.Call(0, 1));
CHECK_EQ(14, r.Call(0, 0)); CHECK_EQ(14, r.Call(0, 0));
} }
TEST(Run_Wasm_ExprBlock_if) { TEST(Run_Wasm_ExprBlock_if) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
...@@ -2389,7 +2279,6 @@ TEST(Run_Wasm_ExprBlock_if) { ...@@ -2389,7 +2279,6 @@ TEST(Run_Wasm_ExprBlock_if) {
CHECK_EQ(14, r.Call(0)); CHECK_EQ(14, r.Call(0));
} }
TEST(Run_Wasm_ExprBlock_nested_ifs) { TEST(Run_Wasm_ExprBlock_nested_ifs) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
...@@ -2407,7 +2296,6 @@ TEST(Run_Wasm_ExprBlock_nested_ifs) { ...@@ -2407,7 +2296,6 @@ TEST(Run_Wasm_ExprBlock_nested_ifs) {
CHECK_EQ(14, r.Call(0, 0)); CHECK_EQ(14, r.Call(0, 0));
} }
TEST(Run_Wasm_ExprLoop_nested_ifs) { TEST(Run_Wasm_ExprLoop_nested_ifs) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
...@@ -2456,7 +2344,6 @@ TEST(Run_Wasm_SimpleCallIndirect) { ...@@ -2456,7 +2344,6 @@ TEST(Run_Wasm_SimpleCallIndirect) {
CHECK_TRAP(r.Call(2)); CHECK_TRAP(r.Call(2));
} }
TEST(Run_Wasm_MultipleCallIndirect) { TEST(Run_Wasm_MultipleCallIndirect) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -2600,7 +2487,6 @@ TEST(Run_Wasm_F32Min) { ...@@ -2600,7 +2487,6 @@ TEST(Run_Wasm_F32Min) {
} }
} }
TEST(Run_Wasm_F64Min) { TEST(Run_Wasm_F64Min) {
WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); WasmRunner<double> r(MachineType::Float64(), MachineType::Float64());
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2624,7 +2510,6 @@ TEST(Run_Wasm_F64Min) { ...@@ -2624,7 +2510,6 @@ TEST(Run_Wasm_F64Min) {
} }
} }
TEST(Run_Wasm_F32Max) { TEST(Run_Wasm_F32Max) {
WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); WasmRunner<float> r(MachineType::Float32(), MachineType::Float32());
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2648,7 +2533,6 @@ TEST(Run_Wasm_F32Max) { ...@@ -2648,7 +2533,6 @@ TEST(Run_Wasm_F32Max) {
} }
} }
TEST(Run_Wasm_F64Max) { TEST(Run_Wasm_F64Max) {
WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); WasmRunner<double> r(MachineType::Float64(), MachineType::Float64());
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2755,7 +2639,6 @@ TEST(Run_Wasm_I32SConvertF32) { ...@@ -2755,7 +2639,6 @@ TEST(Run_Wasm_I32SConvertF32) {
} }
} }
TEST(Run_Wasm_I32SConvertF64) { TEST(Run_Wasm_I32SConvertF64) {
WasmRunner<int32_t> r(MachineType::Float64()); WasmRunner<int32_t> r(MachineType::Float64());
BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -2770,7 +2653,6 @@ TEST(Run_Wasm_I32SConvertF64) { ...@@ -2770,7 +2653,6 @@ TEST(Run_Wasm_I32SConvertF64) {
} }
} }
TEST(Run_Wasm_I32UConvertF32) { TEST(Run_Wasm_I32UConvertF32) {
WasmRunner<uint32_t> r(MachineType::Float32()); WasmRunner<uint32_t> r(MachineType::Float32());
BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0)));
...@@ -2784,7 +2666,6 @@ TEST(Run_Wasm_I32UConvertF32) { ...@@ -2784,7 +2666,6 @@ TEST(Run_Wasm_I32UConvertF32) {
} }
} }
TEST(Run_Wasm_I32UConvertF64) { TEST(Run_Wasm_I32UConvertF64) {
WasmRunner<uint32_t> r(MachineType::Float64()); WasmRunner<uint32_t> r(MachineType::Float64());
BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -2807,7 +2688,6 @@ TEST(Run_Wasm_F64CopySign) { ...@@ -2807,7 +2688,6 @@ TEST(Run_Wasm_F64CopySign) {
} }
} }
TEST(Run_Wasm_F32CopySign) { TEST(Run_Wasm_F32CopySign) {
WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); WasmRunner<float> r(MachineType::Float32(), MachineType::Float32());
BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2846,18 +2726,14 @@ void CompileCallIndirectMany(LocalType param) { ...@@ -2846,18 +2726,14 @@ void CompileCallIndirectMany(LocalType param) {
} }
} }
TEST(Compile_Wasm_CallIndirect_Many_i32) { CompileCallIndirectMany(kAstI32); } TEST(Compile_Wasm_CallIndirect_Many_i32) { CompileCallIndirectMany(kAstI32); }
#if WASM_64 #if WASM_64
TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); }
#endif #endif
TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); }
TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); }
TEST(Run_WASM_Int32RemS_dead) { TEST(Run_WASM_Int32RemS_dead) {
......
...@@ -52,7 +52,6 @@ static const WasmOpcode kInt32BinopOpcodes[] = { ...@@ -52,7 +52,6 @@ static const WasmOpcode kInt32BinopOpcodes[] = {
Verify(kSuccess, env, code, code + arraysize(code)); \ Verify(kSuccess, env, code, code + arraysize(code)); \
} while (false) } while (false)
#define EXPECT_FAILURE_INLINE(env, ...) \ #define EXPECT_FAILURE_INLINE(env, ...) \
do { \ do { \
static byte code[] = {__VA_ARGS__}; \ static byte code[] = {__VA_ARGS__}; \
...@@ -1150,7 +1149,6 @@ TEST_F(AstDecoderTest, AllStoreMemCombinations) { ...@@ -1150,7 +1149,6 @@ TEST_F(AstDecoderTest, AllStoreMemCombinations) {
} }
} }
namespace { namespace {
// A helper for tests that require a module environment for functions and // A helper for tests that require a module environment for functions and
// globals. // globals.
...@@ -1862,7 +1860,6 @@ TEST_F(AstDecoderTest, Select_TypeCheck) { ...@@ -1862,7 +1860,6 @@ TEST_F(AstDecoderTest, Select_TypeCheck) {
WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_I64V_1(0))); WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_I64V_1(0)));
} }
class WasmOpcodeLengthTest : public TestWithZone { class WasmOpcodeLengthTest : public TestWithZone {
public: public:
WasmOpcodeLengthTest() : TestWithZone() {} WasmOpcodeLengthTest() : TestWithZone() {}
...@@ -1892,7 +1889,6 @@ TEST_F(WasmOpcodeLengthTest, Statements) { ...@@ -1892,7 +1889,6 @@ TEST_F(WasmOpcodeLengthTest, Statements) {
EXPECT_LENGTH(3, kExprBrIf); EXPECT_LENGTH(3, kExprBrIf);
} }
TEST_F(WasmOpcodeLengthTest, MiscExpressions) { TEST_F(WasmOpcodeLengthTest, MiscExpressions) {
EXPECT_LENGTH(2, kExprI8Const); EXPECT_LENGTH(2, kExprI8Const);
EXPECT_LENGTH(5, kExprF32Const); EXPECT_LENGTH(5, kExprF32Const);
...@@ -1966,13 +1962,11 @@ TEST_F(WasmOpcodeLengthTest, LoadsAndStores) { ...@@ -1966,13 +1962,11 @@ TEST_F(WasmOpcodeLengthTest, LoadsAndStores) {
EXPECT_LENGTH(3, kExprF64StoreMem); EXPECT_LENGTH(3, kExprF64StoreMem);
} }
TEST_F(WasmOpcodeLengthTest, MiscMemExpressions) { TEST_F(WasmOpcodeLengthTest, MiscMemExpressions) {
EXPECT_LENGTH(1, kExprMemorySize); EXPECT_LENGTH(1, kExprMemorySize);
EXPECT_LENGTH(1, kExprGrowMemory); EXPECT_LENGTH(1, kExprGrowMemory);
} }
TEST_F(WasmOpcodeLengthTest, SimpleExpressions) { TEST_F(WasmOpcodeLengthTest, SimpleExpressions) {
EXPECT_LENGTH(1, kExprI32Add); EXPECT_LENGTH(1, kExprI32Add);
EXPECT_LENGTH(1, kExprI32Sub); EXPECT_LENGTH(1, kExprI32Sub);
...@@ -2094,7 +2088,6 @@ TEST_F(WasmOpcodeLengthTest, SimpleExpressions) { ...@@ -2094,7 +2088,6 @@ TEST_F(WasmOpcodeLengthTest, SimpleExpressions) {
EXPECT_LENGTH(1, kExprI64ReinterpretF64); EXPECT_LENGTH(1, kExprI64ReinterpretF64);
} }
class WasmOpcodeArityTest : public TestWithZone { class WasmOpcodeArityTest : public TestWithZone {
public: public:
WasmOpcodeArityTest() : TestWithZone() {} WasmOpcodeArityTest() : TestWithZone() {}
...@@ -2137,7 +2130,6 @@ TEST_F(WasmOpcodeArityTest, Control) { ...@@ -2137,7 +2130,6 @@ TEST_F(WasmOpcodeArityTest, Control) {
} }
} }
TEST_F(WasmOpcodeArityTest, Misc) { TEST_F(WasmOpcodeArityTest, Misc) {
EXPECT_ARITY(0, kExprI8Const); EXPECT_ARITY(0, kExprI8Const);
EXPECT_ARITY(0, kExprI32Const); EXPECT_ARITY(0, kExprI32Const);
...@@ -2150,7 +2142,6 @@ TEST_F(WasmOpcodeArityTest, Misc) { ...@@ -2150,7 +2142,6 @@ TEST_F(WasmOpcodeArityTest, Misc) {
EXPECT_ARITY(1, kExprStoreGlobal); EXPECT_ARITY(1, kExprStoreGlobal);
} }
TEST_F(WasmOpcodeArityTest, Calls) { TEST_F(WasmOpcodeArityTest, Calls) {
{ {
EXPECT_ARITY(2, kExprCallFunction, 2, 0); EXPECT_ARITY(2, kExprCallFunction, 2, 0);
...@@ -2181,7 +2172,6 @@ TEST_F(WasmOpcodeArityTest, Calls) { ...@@ -2181,7 +2172,6 @@ TEST_F(WasmOpcodeArityTest, Calls) {
} }
} }
TEST_F(WasmOpcodeArityTest, LoadsAndStores) { TEST_F(WasmOpcodeArityTest, LoadsAndStores) {
EXPECT_ARITY(1, kExprI32LoadMem8S); EXPECT_ARITY(1, kExprI32LoadMem8S);
EXPECT_ARITY(1, kExprI32LoadMem8U); EXPECT_ARITY(1, kExprI32LoadMem8U);
...@@ -2210,13 +2200,11 @@ TEST_F(WasmOpcodeArityTest, LoadsAndStores) { ...@@ -2210,13 +2200,11 @@ TEST_F(WasmOpcodeArityTest, LoadsAndStores) {
EXPECT_ARITY(2, kExprF64StoreMem); EXPECT_ARITY(2, kExprF64StoreMem);
} }
TEST_F(WasmOpcodeArityTest, MiscMemExpressions) { TEST_F(WasmOpcodeArityTest, MiscMemExpressions) {
EXPECT_ARITY(0, kExprMemorySize); EXPECT_ARITY(0, kExprMemorySize);
EXPECT_ARITY(1, kExprGrowMemory); EXPECT_ARITY(1, kExprGrowMemory);
} }
TEST_F(WasmOpcodeArityTest, SimpleExpressions) { TEST_F(WasmOpcodeArityTest, SimpleExpressions) {
EXPECT_ARITY(2, kExprI32Add); EXPECT_ARITY(2, kExprI32Add);
EXPECT_ARITY(2, kExprI32Sub); EXPECT_ARITY(2, kExprI32Sub);
......
...@@ -21,7 +21,6 @@ class EncoderTest : public TestWithZone { ...@@ -21,7 +21,6 @@ class EncoderTest : public TestWithZone {
} }
}; };
TEST_F(EncoderTest, Function_Builder_Variable_Indexing) { TEST_F(EncoderTest, Function_Builder_Variable_Indexing) {
base::AccountingAllocator allocator; base::AccountingAllocator allocator;
Zone zone(&allocator); Zone zone(&allocator);
...@@ -60,7 +59,6 @@ TEST_F(EncoderTest, Function_Builder_Variable_Indexing) { ...@@ -60,7 +59,6 @@ TEST_F(EncoderTest, Function_Builder_Variable_Indexing) {
f->Serialize(buffer, &header, &body); f->Serialize(buffer, &header, &body);
} }
TEST_F(EncoderTest, Function_Builder_Indexing_Variable_Width) { TEST_F(EncoderTest, Function_Builder_Indexing_Variable_Width) {
base::AccountingAllocator allocator; base::AccountingAllocator allocator;
Zone zone(&allocator); Zone zone(&allocator);
......
...@@ -32,14 +32,12 @@ class WasmLoopAssignmentAnalyzerTest : public TestWithZone { ...@@ -32,14 +32,12 @@ class WasmLoopAssignmentAnalyzerTest : public TestWithZone {
} }
}; };
TEST_F(WasmLoopAssignmentAnalyzerTest, Empty0) { TEST_F(WasmLoopAssignmentAnalyzerTest, Empty0) {
byte code[] = { 0 }; byte code[] = { 0 };
BitVector* assigned = Analyze(code, code); BitVector* assigned = Analyze(code, code);
CHECK_NULL(assigned); CHECK_NULL(assigned);
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) { TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) {
byte code[] = {kExprLoop, 0}; byte code[] = {kExprLoop, 0};
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
...@@ -51,7 +49,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) { ...@@ -51,7 +49,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) {
} }
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, One) { TEST_F(WasmLoopAssignmentAnalyzerTest, One) {
num_locals = 5; num_locals = 5;
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
...@@ -63,7 +60,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) { ...@@ -63,7 +60,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) {
} }
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) { TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) {
num_locals = 5; num_locals = 5;
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
...@@ -75,7 +71,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) { ...@@ -75,7 +71,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) {
} }
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, Two) { TEST_F(WasmLoopAssignmentAnalyzerTest, Two) {
num_locals = 5; num_locals = 5;
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
...@@ -90,7 +85,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Two) { ...@@ -90,7 +85,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Two) {
} }
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) { TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) {
num_locals = 5; num_locals = 5;
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
...@@ -104,14 +98,12 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) { ...@@ -104,14 +98,12 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) {
} }
} }
static byte LEBByte(uint32_t val, byte which) { static byte LEBByte(uint32_t val, byte which) {
byte b = (val >> (which * 7)) & 0x7F; byte b = (val >> (which * 7)) & 0x7F;
if (val >> ((which + 1) * 7)) b |= 0x80; if (val >> ((which + 1) * 7)) b |= 0x80;
return b; return b;
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) { TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) {
num_locals = 65000; num_locals = 65000;
for (int i = 13; i < 65000; i = static_cast<int>(i * 1.5)) { for (int i = 13; i < 65000; i = static_cast<int>(i * 1.5)) {
...@@ -133,7 +125,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) { ...@@ -133,7 +125,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) {
} }
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, Break) { TEST_F(WasmLoopAssignmentAnalyzerTest, Break) {
num_locals = 3; num_locals = 3;
byte code[] = { byte code[] = {
...@@ -147,7 +138,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Break) { ...@@ -147,7 +138,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Break) {
} }
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) { TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) {
num_locals = 5; num_locals = 5;
byte code[] = { byte code[] = {
...@@ -164,7 +154,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) { ...@@ -164,7 +154,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) {
} }
} }
TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) { TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) {
num_locals = 6; num_locals = 6;
const byte kIter = 0; const byte kIter = 0;
...@@ -191,7 +180,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) { ...@@ -191,7 +180,6 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) {
} }
} }
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -169,7 +169,6 @@ TEST_F(WasmModuleVerifyTest, OneGlobal) { ...@@ -169,7 +169,6 @@ TEST_F(WasmModuleVerifyTest, OneGlobal) {
EXPECT_OFF_END_FAILURE(data, 1, sizeof(data)); EXPECT_OFF_END_FAILURE(data, 1, sizeof(data));
} }
TEST_F(WasmModuleVerifyTest, ZeroGlobals) { TEST_F(WasmModuleVerifyTest, ZeroGlobals) {
static const byte data[] = { static const byte data[] = {
SECTION(GLOBALS, 1), // -- SECTION(GLOBALS, 1), // --
...@@ -180,7 +179,6 @@ TEST_F(WasmModuleVerifyTest, ZeroGlobals) { ...@@ -180,7 +179,6 @@ TEST_F(WasmModuleVerifyTest, ZeroGlobals) {
if (result.val) delete result.val; if (result.val) delete result.val;
} }
static void AppendUint32v(std::vector<byte>& buffer, uint32_t val) { static void AppendUint32v(std::vector<byte>& buffer, uint32_t val) {
while (true) { while (true) {
uint32_t next = val >> 7; uint32_t next = val >> 7;
...@@ -195,7 +193,6 @@ static void AppendUint32v(std::vector<byte>& buffer, uint32_t val) { ...@@ -195,7 +193,6 @@ static void AppendUint32v(std::vector<byte>& buffer, uint32_t val) {
} }
} }
TEST_F(WasmModuleVerifyTest, NGlobals) { TEST_F(WasmModuleVerifyTest, NGlobals) {
static const byte data[] = { static const byte data[] = {
NO_NAME, // name length NO_NAME, // name length
...@@ -245,7 +242,6 @@ TEST_F(WasmModuleVerifyTest, GlobalWithInvalidMemoryType) { ...@@ -245,7 +242,6 @@ TEST_F(WasmModuleVerifyTest, GlobalWithInvalidMemoryType) {
EXPECT_FAILURE(data); EXPECT_FAILURE(data);
} }
TEST_F(WasmModuleVerifyTest, TwoGlobals) { TEST_F(WasmModuleVerifyTest, TwoGlobals) {
static const byte data[] = { static const byte data[] = {
SECTION(GLOBALS, 7), SECTION(GLOBALS, 7),
...@@ -285,7 +281,6 @@ TEST_F(WasmModuleVerifyTest, TwoGlobals) { ...@@ -285,7 +281,6 @@ TEST_F(WasmModuleVerifyTest, TwoGlobals) {
EXPECT_OFF_END_FAILURE(data, 1, sizeof(data)); EXPECT_OFF_END_FAILURE(data, 1, sizeof(data));
} }
TEST_F(WasmModuleVerifyTest, OneSignature) { TEST_F(WasmModuleVerifyTest, OneSignature) {
{ {
static const byte data[] = {SIGNATURES_SECTION_VOID_VOID}; static const byte data[] = {SIGNATURES_SECTION_VOID_VOID};
...@@ -299,7 +294,6 @@ TEST_F(WasmModuleVerifyTest, OneSignature) { ...@@ -299,7 +294,6 @@ TEST_F(WasmModuleVerifyTest, OneSignature) {
} }
} }
TEST_F(WasmModuleVerifyTest, MultipleSignatures) { TEST_F(WasmModuleVerifyTest, MultipleSignatures) {
static const byte data[] = { static const byte data[] = {
SECTION(SIGNATURES, 1 + SIZEOF_SIG_ENTRY_v_v + SIZEOF_SIG_ENTRY_x_x + SECTION(SIGNATURES, 1 + SIZEOF_SIG_ENTRY_v_v + SIZEOF_SIG_ENTRY_x_x +
...@@ -327,7 +321,6 @@ TEST_F(WasmModuleVerifyTest, MultipleSignatures) { ...@@ -327,7 +321,6 @@ TEST_F(WasmModuleVerifyTest, MultipleSignatures) {
EXPECT_OFF_END_FAILURE(data, 1, sizeof(data)); EXPECT_OFF_END_FAILURE(data, 1, sizeof(data));
} }
TEST_F(WasmModuleVerifyTest, FunctionWithoutSig) { TEST_F(WasmModuleVerifyTest, FunctionWithoutSig) {
static const byte data[] = { static const byte data[] = {
SECTION(OLD_FUNCTIONS, 25), 1, SECTION(OLD_FUNCTIONS, 25), 1,
...@@ -349,7 +342,6 @@ TEST_F(WasmModuleVerifyTest, FunctionWithoutSig) { ...@@ -349,7 +342,6 @@ TEST_F(WasmModuleVerifyTest, FunctionWithoutSig) {
if (result.val) delete result.val; if (result.val) delete result.val;
} }
TEST_F(WasmModuleVerifyTest, OneEmptyVoidVoidFunction) { TEST_F(WasmModuleVerifyTest, OneEmptyVoidVoidFunction) {
const int kCodeStartOffset = 49; const int kCodeStartOffset = 49;
const int kCodeEndOffset = kCodeStartOffset + 1; const int kCodeEndOffset = kCodeStartOffset + 1;
...@@ -401,7 +393,6 @@ TEST_F(WasmModuleVerifyTest, OneEmptyVoidVoidFunction) { ...@@ -401,7 +393,6 @@ TEST_F(WasmModuleVerifyTest, OneEmptyVoidVoidFunction) {
EXPECT_OFF_END_FAILURE(data, 16, sizeof(data)); EXPECT_OFF_END_FAILURE(data, 16, sizeof(data));
} }
TEST_F(WasmModuleVerifyTest, OneFunctionImported) { TEST_F(WasmModuleVerifyTest, OneFunctionImported) {
static const byte data[] = { static const byte data[] = {
// signatures // signatures
...@@ -467,7 +458,6 @@ TEST_F(WasmModuleVerifyTest, OneFunctionWithNopBody) { ...@@ -467,7 +458,6 @@ TEST_F(WasmModuleVerifyTest, OneFunctionWithNopBody) {
if (result.val) delete result.val; if (result.val) delete result.val;
} }
TEST_F(WasmModuleVerifyTest, OneFunctionWithNopBody_WithLocals) { TEST_F(WasmModuleVerifyTest, OneFunctionWithNopBody_WithLocals) {
static const byte kCodeStartOffset = 46; static const byte kCodeStartOffset = 46;
static const byte kCodeEndOffset = kCodeStartOffset + 1; static const byte kCodeEndOffset = kCodeStartOffset + 1;
...@@ -505,7 +495,6 @@ TEST_F(WasmModuleVerifyTest, OneFunctionWithNopBody_WithLocals) { ...@@ -505,7 +495,6 @@ TEST_F(WasmModuleVerifyTest, OneFunctionWithNopBody_WithLocals) {
if (result.val) delete result.val; if (result.val) delete result.val;
} }
TEST_F(WasmModuleVerifyTest, OneGlobalOneFunctionWithNopBodyOneDataSegment) { TEST_F(WasmModuleVerifyTest, OneGlobalOneFunctionWithNopBodyOneDataSegment) {
static const byte kNameOffset = 49; static const byte kNameOffset = 49;
static const byte kCodeStartOffset = 61; static const byte kCodeStartOffset = 61;
...@@ -579,7 +568,6 @@ TEST_F(WasmModuleVerifyTest, OneGlobalOneFunctionWithNopBodyOneDataSegment) { ...@@ -579,7 +568,6 @@ TEST_F(WasmModuleVerifyTest, OneGlobalOneFunctionWithNopBodyOneDataSegment) {
} }
} }
TEST_F(WasmModuleVerifyTest, OneDataSegment) { TEST_F(WasmModuleVerifyTest, OneDataSegment) {
const byte kDataSegmentSourceOffset = 30; const byte kDataSegmentSourceOffset = 30;
const byte data[] = { const byte data[] = {
...@@ -617,7 +605,6 @@ TEST_F(WasmModuleVerifyTest, OneDataSegment) { ...@@ -617,7 +605,6 @@ TEST_F(WasmModuleVerifyTest, OneDataSegment) {
EXPECT_OFF_END_FAILURE(data, 13, sizeof(data)); EXPECT_OFF_END_FAILURE(data, 13, sizeof(data));
} }
TEST_F(WasmModuleVerifyTest, TwoDataSegments) { TEST_F(WasmModuleVerifyTest, TwoDataSegments) {
const byte kDataSegment0SourceOffset = 30; const byte kDataSegment0SourceOffset = 30;
const byte kDataSegment1SourceOffset = 30 + 8; const byte kDataSegment1SourceOffset = 30 + 8;
...@@ -704,7 +691,6 @@ TEST_F(WasmModuleVerifyTest, DataSegmentWithInvalidDest) { ...@@ -704,7 +691,6 @@ TEST_F(WasmModuleVerifyTest, DataSegmentWithInvalidDest) {
} }
} }
// To make below tests for indirect calls much shorter. // To make below tests for indirect calls much shorter.
#define FUNCTION(sig_index, external) kDeclFunctionImport, SIG_INDEX(sig_index) #define FUNCTION(sig_index, external) kDeclFunctionImport, SIG_INDEX(sig_index)
...@@ -728,7 +714,6 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction) { ...@@ -728,7 +714,6 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction) {
if (result.val) delete result.val; if (result.val) delete result.val;
} }
TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) { TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) {
static const byte data[] = { static const byte data[] = {
// sig#0 ------------------------------------------------------- // sig#0 -------------------------------------------------------
...@@ -766,7 +751,6 @@ TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) { ...@@ -766,7 +751,6 @@ TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) {
if (result.val) delete result.val; if (result.val) delete result.val;
} }
TEST_F(WasmModuleVerifyTest, IndirectFunctionNoFunctions) { TEST_F(WasmModuleVerifyTest, IndirectFunctionNoFunctions) {
static const byte data[] = { static const byte data[] = {
// sig#0 ------------------------------------------------------- // sig#0 -------------------------------------------------------
...@@ -778,7 +762,6 @@ TEST_F(WasmModuleVerifyTest, IndirectFunctionNoFunctions) { ...@@ -778,7 +762,6 @@ TEST_F(WasmModuleVerifyTest, IndirectFunctionNoFunctions) {
EXPECT_FAILURE(data); EXPECT_FAILURE(data);
} }
TEST_F(WasmModuleVerifyTest, IndirectFunctionInvalidIndex) { TEST_F(WasmModuleVerifyTest, IndirectFunctionInvalidIndex) {
static const byte data[] = { static const byte data[] = {
// sig#0 ------------------------------------------------------- // sig#0 -------------------------------------------------------
...@@ -792,10 +775,8 @@ TEST_F(WasmModuleVerifyTest, IndirectFunctionInvalidIndex) { ...@@ -792,10 +775,8 @@ TEST_F(WasmModuleVerifyTest, IndirectFunctionInvalidIndex) {
EXPECT_FAILURE(data); EXPECT_FAILURE(data);
} }
class WasmSignatureDecodeTest : public TestWithZone {}; class WasmSignatureDecodeTest : public TestWithZone {};
TEST_F(WasmSignatureDecodeTest, Ok_v_v) { TEST_F(WasmSignatureDecodeTest, Ok_v_v) {
static const byte data[] = {SIG_ENTRY_v_v}; static const byte data[] = {SIG_ENTRY_v_v};
base::AccountingAllocator allocator; base::AccountingAllocator allocator;
...@@ -808,7 +789,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_v) { ...@@ -808,7 +789,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_v) {
EXPECT_EQ(0, sig->return_count()); EXPECT_EQ(0, sig->return_count());
} }
TEST_F(WasmSignatureDecodeTest, Ok_t_v) { TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
for (size_t i = 0; i < arraysize(kLocalTypes); i++) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) {
LocalTypePair ret_type = kLocalTypes[i]; LocalTypePair ret_type = kLocalTypes[i];
...@@ -823,7 +803,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_v) { ...@@ -823,7 +803,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
} }
} }
TEST_F(WasmSignatureDecodeTest, Ok_v_t) { TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
for (size_t i = 0; i < arraysize(kLocalTypes); i++) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) {
LocalTypePair param_type = kLocalTypes[i]; LocalTypePair param_type = kLocalTypes[i];
...@@ -838,7 +817,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_t) { ...@@ -838,7 +817,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
} }
} }
TEST_F(WasmSignatureDecodeTest, Ok_t_t) { TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
for (size_t i = 0; i < arraysize(kLocalTypes); i++) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) {
LocalTypePair ret_type = kLocalTypes[i]; LocalTypePair ret_type = kLocalTypes[i];
...@@ -857,7 +835,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_t) { ...@@ -857,7 +835,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
} }
} }
TEST_F(WasmSignatureDecodeTest, Ok_i_tt) { TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
for (size_t i = 0; i < arraysize(kLocalTypes); i++) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) {
LocalTypePair p0_type = kLocalTypes[i]; LocalTypePair p0_type = kLocalTypes[i];
...@@ -877,7 +854,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_i_tt) { ...@@ -877,7 +854,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
} }
} }
TEST_F(WasmSignatureDecodeTest, Fail_off_end) { TEST_F(WasmSignatureDecodeTest, Fail_off_end) {
byte data[256]; byte data[256];
for (int p = 0; p <= 255; p = p + 1 + p * 3) { for (int p = 0; p <= 255; p = p + 1 + p * 3) {
...@@ -892,7 +868,6 @@ TEST_F(WasmSignatureDecodeTest, Fail_off_end) { ...@@ -892,7 +868,6 @@ TEST_F(WasmSignatureDecodeTest, Fail_off_end) {
} }
} }
TEST_F(WasmSignatureDecodeTest, Fail_invalid_type) { TEST_F(WasmSignatureDecodeTest, Fail_invalid_type) {
byte kInvalidType = 76; byte kInvalidType = 76;
for (size_t i = 0; i < SIZEOF_SIG_ENTRY_x_xx; i++) { for (size_t i = 0; i < SIZEOF_SIG_ENTRY_x_xx; i++) {
......
...@@ -18,7 +18,6 @@ class WasmMacroGenTest : public TestWithZone {}; ...@@ -18,7 +18,6 @@ class WasmMacroGenTest : public TestWithZone {};
EXPECT_EQ(size, sizeof(code)); \ EXPECT_EQ(size, sizeof(code)); \
} while (false) } while (false)
TEST_F(WasmMacroGenTest, Constants) { TEST_F(WasmMacroGenTest, Constants) {
EXPECT_SIZE(2, WASM_ONE); EXPECT_SIZE(2, WASM_ONE);
EXPECT_SIZE(2, WASM_ZERO); EXPECT_SIZE(2, WASM_ZERO);
...@@ -48,7 +47,6 @@ TEST_F(WasmMacroGenTest, Constants) { ...@@ -48,7 +47,6 @@ TEST_F(WasmMacroGenTest, Constants) {
EXPECT_SIZE(9, WASM_F64(-9818934.0)); EXPECT_SIZE(9, WASM_F64(-9818934.0));
} }
TEST_F(WasmMacroGenTest, Statements) { TEST_F(WasmMacroGenTest, Statements) {
EXPECT_SIZE(1, WASM_NOP); EXPECT_SIZE(1, WASM_NOP);
...@@ -85,7 +83,6 @@ TEST_F(WasmMacroGenTest, Statements) { ...@@ -85,7 +83,6 @@ TEST_F(WasmMacroGenTest, Statements) {
EXPECT_SIZE(1, WASM_UNREACHABLE); EXPECT_SIZE(1, WASM_UNREACHABLE);
} }
TEST_F(WasmMacroGenTest, MacroStatements) { TEST_F(WasmMacroGenTest, MacroStatements) {
EXPECT_SIZE(10, WASM_WHILE(WASM_I8(0), WASM_NOP)); EXPECT_SIZE(10, WASM_WHILE(WASM_I8(0), WASM_NOP));
EXPECT_SIZE(7, WASM_INC_LOCAL(0)); EXPECT_SIZE(7, WASM_INC_LOCAL(0));
...@@ -100,7 +97,6 @@ TEST_F(WasmMacroGenTest, BrTable) { ...@@ -100,7 +97,6 @@ TEST_F(WasmMacroGenTest, BrTable) {
EXPECT_SIZE(11, WASM_BR_TABLEV(WASM_ZERO, WASM_ZERO, 1, BR_TARGET(1))); EXPECT_SIZE(11, WASM_BR_TABLEV(WASM_ZERO, WASM_ZERO, 1, BR_TARGET(1)));
} }
TEST_F(WasmMacroGenTest, Expressions) { TEST_F(WasmMacroGenTest, Expressions) {
EXPECT_SIZE(2, WASM_GET_LOCAL(0)); EXPECT_SIZE(2, WASM_GET_LOCAL(0));
EXPECT_SIZE(2, WASM_GET_LOCAL(1)); EXPECT_SIZE(2, WASM_GET_LOCAL(1));
...@@ -188,7 +184,6 @@ TEST_F(WasmMacroGenTest, Int32Ops) { ...@@ -188,7 +184,6 @@ TEST_F(WasmMacroGenTest, Int32Ops) {
EXPECT_SIZE(3, WASM_I32_EQZ(WASM_ZERO)); EXPECT_SIZE(3, WASM_I32_EQZ(WASM_ZERO));
} }
TEST_F(WasmMacroGenTest, Int64Ops) { TEST_F(WasmMacroGenTest, Int64Ops) {
EXPECT_SIZE(5, WASM_I64_ADD(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_I64_ADD(WASM_ZERO, WASM_ZERO));
EXPECT_SIZE(5, WASM_I64_SUB(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_I64_SUB(WASM_ZERO, WASM_ZERO));
...@@ -224,7 +219,6 @@ TEST_F(WasmMacroGenTest, Int64Ops) { ...@@ -224,7 +219,6 @@ TEST_F(WasmMacroGenTest, Int64Ops) {
EXPECT_SIZE(3, WASM_I64_EQZ(WASM_ZERO)); EXPECT_SIZE(3, WASM_I64_EQZ(WASM_ZERO));
} }
TEST_F(WasmMacroGenTest, Float32Ops) { TEST_F(WasmMacroGenTest, Float32Ops) {
EXPECT_SIZE(5, WASM_F32_ADD(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_F32_ADD(WASM_ZERO, WASM_ZERO));
EXPECT_SIZE(5, WASM_F32_SUB(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_F32_SUB(WASM_ZERO, WASM_ZERO));
...@@ -249,7 +243,6 @@ TEST_F(WasmMacroGenTest, Float32Ops) { ...@@ -249,7 +243,6 @@ TEST_F(WasmMacroGenTest, Float32Ops) {
EXPECT_SIZE(5, WASM_F32_GE(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_F32_GE(WASM_ZERO, WASM_ZERO));
} }
TEST_F(WasmMacroGenTest, Float64Ops) { TEST_F(WasmMacroGenTest, Float64Ops) {
EXPECT_SIZE(5, WASM_F64_ADD(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_F64_ADD(WASM_ZERO, WASM_ZERO));
EXPECT_SIZE(5, WASM_F64_SUB(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_F64_SUB(WASM_ZERO, WASM_ZERO));
...@@ -274,7 +267,6 @@ TEST_F(WasmMacroGenTest, Float64Ops) { ...@@ -274,7 +267,6 @@ TEST_F(WasmMacroGenTest, Float64Ops) {
EXPECT_SIZE(5, WASM_F64_GE(WASM_ZERO, WASM_ZERO)); EXPECT_SIZE(5, WASM_F64_GE(WASM_ZERO, WASM_ZERO));
} }
TEST_F(WasmMacroGenTest, Conversions) { TEST_F(WasmMacroGenTest, Conversions) {
EXPECT_SIZE(3, WASM_I32_SCONVERT_F32(WASM_ZERO)); EXPECT_SIZE(3, WASM_I32_SCONVERT_F32(WASM_ZERO));
EXPECT_SIZE(3, WASM_I32_SCONVERT_F64(WASM_ZERO)); EXPECT_SIZE(3, WASM_I32_SCONVERT_F64(WASM_ZERO));
...@@ -316,7 +308,6 @@ TEST_F(WasmMacroGenTest, LoadsAndStores) { ...@@ -316,7 +308,6 @@ TEST_F(WasmMacroGenTest, LoadsAndStores) {
} }
} }
TEST_F(WasmMacroGenTest, LoadsAndStoresWithOffset) { TEST_F(WasmMacroGenTest, LoadsAndStoresWithOffset) {
for (size_t i = 0; i < arraysize(kMemTypes); i++) { for (size_t i = 0; i < arraysize(kMemTypes); i++) {
EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO));
......
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