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