Commit d41fd6c5 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by Commit Bot

[wasm] Rename ValueType::type_name() -> name()

Drive-by: Improve comment, use << operator where possible
Change-Id: I5d2bff57a3f19a0fbb746136a897bf50e1173775
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2308337Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68966}
parent 7cfd1a88
...@@ -1702,7 +1702,7 @@ void WasmArray::WasmArrayPrint(std::ostream& os) { // NOLINT ...@@ -1702,7 +1702,7 @@ void WasmArray::WasmArrayPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "WasmArray"); PrintHeader(os, "WasmArray");
wasm::ArrayType* array_type = type(); wasm::ArrayType* array_type = type();
uint32_t len = length(); uint32_t len = length();
os << "\n - type: " << array_type->element_type().type_name(); os << "\n - type: " << array_type->element_type().name();
os << "\n - length: " << len; os << "\n - length: " << len;
Address data_ptr = ptr() + WasmArray::kHeaderSize - kHeapObjectTag; Address data_ptr = ptr() + WasmArray::kHeaderSize - kHeapObjectTag;
switch (array_type->element_type().kind()) { switch (array_type->element_type().kind()) {
......
...@@ -1074,7 +1074,7 @@ void LiftoffAssembler::set_num_locals(uint32_t num_locals) { ...@@ -1074,7 +1074,7 @@ void LiftoffAssembler::set_num_locals(uint32_t num_locals) {
} }
std::ostream& operator<<(std::ostream& os, VarState slot) { std::ostream& operator<<(std::ostream& os, VarState slot) {
os << slot.type().type_name() << ":"; os << slot.type().name() << ":";
switch (slot.loc()) { switch (slot.loc()) {
case VarState::kStack: case VarState::kStack:
return os << "s"; return os << "s";
......
...@@ -425,7 +425,7 @@ class LiftoffCompiler { ...@@ -425,7 +425,7 @@ class LiftoffCompiler {
} }
LiftoffBailoutReason bailout_reason = BailoutReasonForType(type); LiftoffBailoutReason bailout_reason = BailoutReasonForType(type);
EmbeddedVector<char, 128> buffer; EmbeddedVector<char, 128> buffer;
SNPrintF(buffer, "%s %s", type.type_name().c_str(), context); SNPrintF(buffer, "%s %s", type.name().c_str(), context);
unsupported(decoder, bailout_reason, buffer.begin()); unsupported(decoder, bailout_reason, buffer.begin());
return false; return false;
} }
......
...@@ -212,7 +212,7 @@ ValueType read_value_type(Decoder* decoder, const byte* pc, ...@@ -212,7 +212,7 @@ ValueType read_value_type(Decoder* decoder, const byte* pc,
if (!VALIDATE(enabled.contains(feature_for_heap_type(heap_type)))) { if (!VALIDATE(enabled.contains(feature_for_heap_type(heap_type)))) {
decoder->errorf( decoder->errorf(
pc, "invalid value type '%s', enable with --experimental-wasm-%s", pc, "invalid value type '%s', enable with --experimental-wasm-%s",
result.type_name().c_str(), result.name().c_str(),
WasmFeatures::name_for_feature(feature_for_heap_type(heap_type))); WasmFeatures::name_for_feature(feature_for_heap_type(heap_type)));
return kWasmBottom; return kWasmBottom;
} }
...@@ -1399,7 +1399,7 @@ class WasmDecoder : public Decoder { ...@@ -1399,7 +1399,7 @@ class WasmDecoder : public Decoder {
if (!VALIDATE(IsSubtypeOf(elem_type, module_->tables[imm.table.index].type, if (!VALIDATE(IsSubtypeOf(elem_type, module_->tables[imm.table.index].type,
module_))) { module_))) {
errorf(pc, "table %u is not a super-type of %s", imm.table.index, errorf(pc, "table %u is not a super-type of %s", imm.table.index,
elem_type.type_name().c_str()); elem_type.name().c_str());
return false; return false;
} }
return true; return true;
...@@ -1420,7 +1420,7 @@ class WasmDecoder : public Decoder { ...@@ -1420,7 +1420,7 @@ class WasmDecoder : public Decoder {
if (!VALIDATE(IsSubtypeOf( if (!VALIDATE(IsSubtypeOf(
src_type, module_->tables[imm.table_dst.index].type, module_))) { src_type, module_->tables[imm.table_dst.index].type, module_))) {
errorf(pc, "table %u is not a super-type of %s", imm.table_dst.index, errorf(pc, "table %u is not a super-type of %s", imm.table_dst.index,
src_type.type_name().c_str()); src_type.name().c_str());
return false; return false;
} }
return true; return true;
...@@ -1938,7 +1938,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1938,7 +1938,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
this->errorf( this->errorf(
this->pc(), this->pc(),
"Cannot define function-level local of non-defaultable type %s", "Cannot define function-level local of non-defaultable type %s",
this->local_type(index).type_name().c_str()); this->local_type(index).name().c_str());
} }
} }
this->consume_bytes(locals_length); this->consume_bytes(locals_length);
...@@ -2612,7 +2612,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -2612,7 +2612,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
this->errorf(this->pc_, this->errorf(this->pc_,
"invalid argument type to ref.is_null. Expected " "invalid argument type to ref.is_null. Expected "
"reference type, got %s", "reference type, got %s",
value.type.type_name().c_str()); value.type.name().c_str());
return 0; return 0;
} }
UNREACHABLE(); UNREACHABLE();
...@@ -2648,7 +2648,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -2648,7 +2648,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
this->errorf(this->pc_, this->errorf(this->pc_,
"invalid agrument type to ref.as_non_null: Expected " "invalid agrument type to ref.as_non_null: Expected "
"reference type, got %s", "reference type, got %s",
value.type.type_name().c_str()); value.type.name().c_str());
} }
return 0; return 0;
} }
...@@ -3177,8 +3177,8 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3177,8 +3177,8 @@ class WasmFullDecoder : public WasmDecoder<validate> {
this->errorf(pos, this->errorf(pos,
"inconsistent type in br_table target %u (previous " "inconsistent type in br_table target %u (previous "
"was %s, this one is %s)", "was %s, this one is %s)",
index, type.type_name().c_str(), index, type.name().c_str(),
(*merge)[i].type.type_name().c_str()); (*merge)[i].type.name().c_str());
return false; return false;
} }
} else { } else {
...@@ -3187,8 +3187,8 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3187,8 +3187,8 @@ class WasmFullDecoder : public WasmDecoder<validate> {
this->errorf(pos, this->errorf(pos,
"inconsistent type in br_table target %u (previous " "inconsistent type in br_table target %u (previous "
"was %s, this one is %s)", "was %s, this one is %s)",
index, (*result_types)[i].type_name().c_str(), index, (*result_types)[i].name().c_str(),
(*merge)[i].type.type_name().c_str()); (*merge)[i].type.name().c_str());
return false; return false;
} }
} }
...@@ -3216,8 +3216,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3216,8 +3216,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
if (!VALIDATE(IsSubtypeOf(val.type, result_types[i], this->module_))) { if (!VALIDATE(IsSubtypeOf(val.type, result_types[i], this->module_))) {
this->errorf(this->pc_, this->errorf(this->pc_,
"type error in merge[%u] (expected %s, got %s)", i, "type error in merge[%u] (expected %s, got %s)", i,
result_types[i].type_name().c_str(), result_types[i].name().c_str(), val.type.name().c_str());
val.type.type_name().c_str());
return false; return false;
} }
} }
...@@ -3377,7 +3376,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3377,7 +3376,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
this->errorf( this->errorf(
this->pc_ + 2, this->pc_ + 2,
"struct.new_with_rtt expected type rtt, found %s of type %s", "struct.new_with_rtt expected type rtt, found %s of type %s",
SafeOpcodeNameAt(rtt.pc), rtt.type.type_name().c_str()); SafeOpcodeNameAt(rtt.pc), rtt.type.name().c_str());
return 0; return 0;
} }
// TODO(7748): Drop this check if {imm} is dropped from the proposal // TODO(7748): Drop this check if {imm} is dropped from the proposal
...@@ -3454,7 +3453,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3454,7 +3453,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
this->errorf( this->errorf(
this->pc_ + 2, this->pc_ + 2,
"array.new_with_rtt expected type rtt, found %s of type %s", "array.new_with_rtt expected type rtt, found %s of type %s",
SafeOpcodeNameAt(rtt.pc), rtt.type.type_name().c_str()); SafeOpcodeNameAt(rtt.pc), rtt.type.name().c_str());
return 0; return 0;
} }
// TODO(7748): Drop this check if {imm} is dropped from the proposal // TODO(7748): Drop this check if {imm} is dropped from the proposal
...@@ -3598,9 +3597,9 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3598,9 +3597,9 @@ class WasmFullDecoder : public WasmDecoder<validate> {
Value rtt = Pop(1); Value rtt = Pop(1);
if (!VALIDATE(rtt.type.kind() == ValueType::kRtt && if (!VALIDATE(rtt.type.kind() == ValueType::kRtt &&
rtt.type.heap_type() == rtt_type.type)) { rtt.type.heap_type() == rtt_type.type)) {
this->errorf( this->errorf(this->pc_,
this->pc_, "ref.test: expected rtt for type %s but got %s", "ref.test: expected rtt for type %s but got %s",
rtt_type.type.name().c_str(), rtt.type.type_name().c_str()); rtt_type.type.name().c_str(), rtt.type.name().c_str());
return 0; return 0;
} }
Value obj = Pop(0, ValueType::Ref(obj_type.type, kNullable)); Value obj = Pop(0, ValueType::Ref(obj_type.type, kNullable));
...@@ -3627,9 +3626,9 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3627,9 +3626,9 @@ class WasmFullDecoder : public WasmDecoder<validate> {
Value rtt = Pop(1); Value rtt = Pop(1);
if (!VALIDATE(rtt.type.kind() == ValueType::kRtt && if (!VALIDATE(rtt.type.kind() == ValueType::kRtt &&
rtt.type.heap_type() == rtt_type.type)) { rtt.type.heap_type() == rtt_type.type)) {
this->errorf( this->errorf(this->pc_,
this->pc_, "ref.cast: expected rtt for type %s but got %s", "ref.cast: expected rtt for type %s but got %s",
rtt_type.type.name().c_str(), rtt.type.type_name().c_str()); rtt_type.type.name().c_str(), rtt.type.name().c_str());
return 0; return 0;
} }
Value obj = Pop(0, ValueType::Ref(obj_type.type, kNullable)); Value obj = Pop(0, ValueType::Ref(obj_type.type, kNullable));
...@@ -3839,9 +3838,8 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3839,9 +3838,8 @@ class WasmFullDecoder : public WasmDecoder<validate> {
if (!VALIDATE(IsSubtypeOf(val.type, expected, this->module_) || if (!VALIDATE(IsSubtypeOf(val.type, expected, this->module_) ||
val.type == kWasmBottom || expected == kWasmBottom)) { val.type == kWasmBottom || expected == kWasmBottom)) {
this->errorf(val.pc, "%s[%d] expected type %s, found %s of type %s", this->errorf(val.pc, "%s[%d] expected type %s, found %s of type %s",
SafeOpcodeNameAt(this->pc_), index, SafeOpcodeNameAt(this->pc_), index, expected.name().c_str(),
expected.type_name().c_str(), SafeOpcodeNameAt(val.pc), SafeOpcodeNameAt(val.pc), val.type.name().c_str());
val.type.type_name().c_str());
} }
return val; return val;
} }
...@@ -3905,8 +3903,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3905,8 +3903,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
Value& old = (*merge)[i]; Value& old = (*merge)[i];
if (!VALIDATE(IsSubtypeOf(val.type, old.type, this->module_))) { if (!VALIDATE(IsSubtypeOf(val.type, old.type, this->module_))) {
this->errorf(this->pc_, "type error in merge[%u] (expected %s, got %s)", this->errorf(this->pc_, "type error in merge[%u] (expected %s, got %s)",
i, old.type.type_name().c_str(), i, old.type.name().c_str(), val.type.name().c_str());
val.type.type_name().c_str());
return false; return false;
} }
} }
...@@ -3923,8 +3920,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3923,8 +3920,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
Value& end = c->end_merge[i]; Value& end = c->end_merge[i];
if (!VALIDATE(IsSubtypeOf(start.type, end.type, this->module_))) { if (!VALIDATE(IsSubtypeOf(start.type, end.type, this->module_))) {
this->errorf(this->pc_, "type error in merge[%u] (expected %s, got %s)", this->errorf(this->pc_, "type error in merge[%u] (expected %s, got %s)",
i, end.type.type_name().c_str(), i, end.type.name().c_str(), start.type.name().c_str());
start.type.type_name().c_str());
return false; return false;
} }
} }
...@@ -4027,9 +4023,9 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -4027,9 +4023,9 @@ class WasmFullDecoder : public WasmDecoder<validate> {
Value& val = stack_values[i]; Value& val = stack_values[i];
ValueType expected_type = this->sig_->GetReturn(i); ValueType expected_type = this->sig_->GetReturn(i);
if (!VALIDATE(IsSubtypeOf(val.type, expected_type, this->module_))) { if (!VALIDATE(IsSubtypeOf(val.type, expected_type, this->module_))) {
this->errorf( this->errorf(this->pc_,
this->pc_, "type error in return[%u] (expected %s, got %s)", i, "type error in return[%u] (expected %s, got %s)", i,
expected_type.type_name().c_str(), val.type.type_name().c_str()); expected_type.name().c_str(), val.type.name().c_str());
return false; return false;
} }
} }
......
...@@ -149,12 +149,12 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body, ...@@ -149,12 +149,12 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
if (decls.type_list[pos] == type) { if (decls.type_list[pos] == type) {
++count; ++count;
} else { } else {
os << " " << count << " " << type.type_name(); os << " " << count << " " << type.name();
type = decls.type_list[pos]; type = decls.type_list[pos];
count = 1; count = 1;
} }
} }
os << " " << count << " " << type.type_name(); os << " " << count << " " << type.name();
} }
os << std::endl; os << std::endl;
if (line_numbers) line_numbers->push_back(kNoByteCode); if (line_numbers) line_numbers->push_back(kNoByteCode);
...@@ -248,7 +248,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body, ...@@ -248,7 +248,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
os << " @" << i.pc_offset(); os << " @" << i.pc_offset();
if (decoder.Complete(imm)) { if (decoder.Complete(imm)) {
for (uint32_t i = 0; i < imm.out_arity(); i++) { for (uint32_t i = 0; i < imm.out_arity(); i++) {
os << " " << imm.out_type(i).type_name(); os << " " << imm.out_type(i).name();
} }
} }
control_depth++; control_depth++;
......
...@@ -941,7 +941,7 @@ class ModuleDecoderImpl : public Decoder { ...@@ -941,7 +941,7 @@ class ModuleDecoderImpl : public Decoder {
this->module_.get())) { this->module_.get())) {
errorf(pos, errorf(pos,
"Invalid element segment. Table %u is not a super-type of %s", "Invalid element segment. Table %u is not a super-type of %s",
table_index, type.type_name().c_str()); table_index, type.name().c_str());
break; break;
} }
} }
...@@ -1419,8 +1419,8 @@ class ModuleDecoderImpl : public Decoder { ...@@ -1419,8 +1419,8 @@ class ModuleDecoderImpl : public Decoder {
errorf(pos, errorf(pos,
"type mismatch in global initialization " "type mismatch in global initialization "
"(from global #%u), expected %s, got %s", "(from global #%u), expected %s, got %s",
other_index, global->type.type_name().c_str(), other_index, global->type.name().c_str(),
module->globals[other_index].type.type_name().c_str()); module->globals[other_index].type.name().c_str());
} }
} }
} }
...@@ -1799,8 +1799,7 @@ class ModuleDecoderImpl : public Decoder { ...@@ -1799,8 +1799,7 @@ class ModuleDecoderImpl : public Decoder {
if (expected != kWasmStmt && if (expected != kWasmStmt &&
!IsSubtypeOf(TypeOf(module, expr), expected, module)) { !IsSubtypeOf(TypeOf(module, expr), expected, module)) {
errorf(pc(), "type error in init expression, expected %s, got %s", errorf(pc(), "type error in init expression, expected %s, got %s",
expected.type_name().c_str(), expected.name().c_str(), TypeOf(module, expr).name().c_str());
TypeOf(module, expr).type_name().c_str());
} }
return expr; return expr;
} }
......
...@@ -820,7 +820,7 @@ void InstanceBuilder::LoadDataSegments(Handle<WasmInstanceObject> instance) { ...@@ -820,7 +820,7 @@ void InstanceBuilder::LoadDataSegments(Handle<WasmInstanceObject> instance) {
void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global, double num) { void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global, double num) {
TRACE("init [globals_start=%p + %u] = %lf, type = %s\n", TRACE("init [globals_start=%p + %u] = %lf, type = %s\n",
raw_buffer_ptr(untagged_globals_, 0), global.offset, num, raw_buffer_ptr(untagged_globals_, 0), global.offset, num,
global.type.type_name().c_str()); global.type.name().c_str());
switch (global.type.kind()) { switch (global.type.kind()) {
case ValueType::kI32: case ValueType::kI32:
WriteLittleEndianValue<int32_t>(GetRawGlobalPtr<int32_t>(global), WriteLittleEndianValue<int32_t>(GetRawGlobalPtr<int32_t>(global),
...@@ -846,7 +846,7 @@ void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global, double num) { ...@@ -846,7 +846,7 @@ void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global, double num) {
void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global, int64_t num) { void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global, int64_t num) {
TRACE("init [globals_start=%p + %u] = %" PRId64 ", type = %s\n", TRACE("init [globals_start=%p + %u] = %" PRId64 ", type = %s\n",
raw_buffer_ptr(untagged_globals_, 0), global.offset, num, raw_buffer_ptr(untagged_globals_, 0), global.offset, num,
global.type.type_name().c_str()); global.type.name().c_str());
DCHECK_EQ(kWasmI64, global.type); DCHECK_EQ(kWasmI64, global.type);
WriteLittleEndianValue<int64_t>(GetRawGlobalPtr<int64_t>(global), num); WriteLittleEndianValue<int64_t>(GetRawGlobalPtr<int64_t>(global), num);
} }
...@@ -893,8 +893,7 @@ void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global, ...@@ -893,8 +893,7 @@ void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global,
case ValueType::kI16: case ValueType::kI16:
UNREACHABLE(); UNREACHABLE();
} }
TRACE(", type = %s (from WebAssembly.Global)\n", TRACE(", type = %s (from WebAssembly.Global)\n", global.type.name().c_str());
global.type.type_name().c_str());
} }
void InstanceBuilder::WriteGlobalExternRef(const WasmGlobal& global, void InstanceBuilder::WriteGlobalExternRef(const WasmGlobal& global,
......
...@@ -148,6 +148,7 @@ class HeapType { ...@@ -148,6 +148,7 @@ class HeapType {
return !is_bottom() && representation_ <= kLastSentinel; return !is_bottom() && representation_ <= kLastSentinel;
} }
}; };
enum Nullability : bool { kNonNullable, kNullable }; enum Nullability : bool { kNonNullable, kNullable };
class ValueType { class ValueType {
...@@ -360,7 +361,7 @@ class ValueType { ...@@ -360,7 +361,7 @@ class ValueType {
return kShortName[kind()]; return kShortName[kind()];
} }
std::string type_name() const { std::string name() const {
std::ostringstream buf; std::ostringstream buf;
switch (kind()) { switch (kind()) {
case kRef: case kRef:
...@@ -373,8 +374,7 @@ class ValueType { ...@@ -373,8 +374,7 @@ class ValueType {
case kOptRef: case kOptRef:
if (heap_type().is_generic() && if (heap_type().is_generic() &&
heap_representation() != HeapType::kI31) { heap_representation() != HeapType::kI31) {
// We prefer the shorthand to be backwards-compatible with previous // We use shorthands to be compatible with the 'reftypes' proposal.
// proposals.
buf << heap_type().name() << "ref"; buf << heap_type().name() << "ref";
} else { } else {
buf << "(ref null " << heap_type().name() << ")"; buf << "(ref null " << heap_type().name() << ")";
...@@ -382,7 +382,7 @@ class ValueType { ...@@ -382,7 +382,7 @@ class ValueType {
break; break;
case kRtt: case kRtt:
buf << "(rtt " << static_cast<uint32_t>(depth()) << " " buf << "(rtt " << static_cast<uint32_t>(depth()) << " "
<< heap_type().name() + ")"; << heap_type().name() << ")";
break; break;
default: default:
buf << kind_name(); buf << kind_name();
...@@ -420,7 +420,7 @@ inline size_t hash_value(ValueType type) { ...@@ -420,7 +420,7 @@ inline size_t hash_value(ValueType type) {
// Output operator, useful for DCHECKS and others. // Output operator, useful for DCHECKS and others.
inline std::ostream& operator<<(std::ostream& oss, ValueType type) { inline std::ostream& operator<<(std::ostream& oss, ValueType type) {
return oss << type.type_name(); return oss << type.name();
} }
constexpr ValueType kWasmI32 = ValueType::Primitive(ValueType::kI32); constexpr ValueType kWasmI32 = ValueType::Primitive(ValueType::kI32);
......
...@@ -34,15 +34,15 @@ static bool CheckSignature(ValueType return_type, ...@@ -34,15 +34,15 @@ static bool CheckSignature(ValueType return_type,
const FunctionSig* sig, ErrorThrower* thrower) { const FunctionSig* sig, ErrorThrower* thrower) {
if (sig->return_count() != 1 && return_type != kWasmBottom) { if (sig->return_count() != 1 && return_type != kWasmBottom) {
thrower->CompileError("Invalid return type. Got none, expected %s", thrower->CompileError("Invalid return type. Got none, expected %s",
return_type.type_name().c_str()); return_type.name().c_str());
return false; return false;
} }
if (sig->return_count() == 1) { if (sig->return_count() == 1) {
if (sig->GetReturn(0) != return_type) { if (sig->GetReturn(0) != return_type) {
thrower->CompileError("Invalid return type. Got %s, expected %s", thrower->CompileError("Invalid return type. Got %s, expected %s",
sig->GetReturn(0).type_name().c_str(), sig->GetReturn(0).name().c_str(),
return_type.type_name().c_str()); return_type.name().c_str());
return false; return false;
} }
} }
...@@ -57,8 +57,7 @@ static bool CheckSignature(ValueType return_type, ...@@ -57,8 +57,7 @@ static bool CheckSignature(ValueType return_type,
if (sig->GetParam(p) != argument_type) { if (sig->GetParam(p) != argument_type) {
thrower->CompileError( thrower->CompileError(
"Invalid argument type for argument %zu. Got %s, expected %s", p, "Invalid argument type for argument %zu. Got %s, expected %s", p,
sig->GetParam(p).type_name().c_str(), sig->GetParam(p).name().c_str(), argument_type.name().c_str());
argument_type.type_name().c_str());
return false; return false;
} }
++p; ++p;
......
...@@ -221,7 +221,7 @@ void DebugSideTable::Print(std::ostream& os) const { ...@@ -221,7 +221,7 @@ void DebugSideTable::Print(std::ostream& os) const {
void DebugSideTable::Entry::Print(std::ostream& os) const { void DebugSideTable::Entry::Print(std::ostream& os) const {
os << std::setw(6) << std::hex << pc_offset_ << std::dec << " ["; os << std::setw(6) << std::hex << pc_offset_ << std::dec << " [";
for (auto& value : values_) { for (auto& value : values_) {
os << " " << value.type.type_name() << ":"; os << " " << value.type.name() << ":";
switch (value.kind) { switch (value.kind) {
case kConstant: case kConstant:
os << "const#" << value.i32_const; os << "const#" << value.i32_const;
......
...@@ -267,8 +267,7 @@ namespace { ...@@ -267,8 +267,7 @@ namespace {
// reflective functions. Should be kept in sync with the {GetValueType} helper. // reflective functions. Should be kept in sync with the {GetValueType} helper.
Handle<String> ToValueTypeString(Isolate* isolate, ValueType type) { Handle<String> ToValueTypeString(Isolate* isolate, ValueType type) {
return isolate->factory()->InternalizeUtf8String( return isolate->factory()->InternalizeUtf8String(
type == kWasmFuncRef ? CStrVector("anyfunc") type == kWasmFuncRef ? CStrVector("anyfunc") : VectorOf(type.name()));
: VectorOf(type.type_name()));
} }
} // namespace } // namespace
......
...@@ -205,7 +205,7 @@ std::ostream& operator<<(std::ostream& out, const DebugSideTableEntry& entry) { ...@@ -205,7 +205,7 @@ std::ostream& operator<<(std::ostream& out, const DebugSideTableEntry& entry) {
out << "{"; out << "{";
const char* comma = ""; const char* comma = "";
for (auto& v : entry.values) { for (auto& v : entry.values) {
out << comma << v.type.type_name() << " "; out << comma << v.type.name() << " ";
switch (v.kind) { switch (v.kind) {
case DebugSideTable::Entry::kConstant: case DebugSideTable::Entry::kConstant:
out << "const:" << v.i32_const; out << "const:" << v.i32_const;
......
...@@ -237,7 +237,7 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes, ...@@ -237,7 +237,7 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
ValueType type = decls.type_list[pos]; ValueType type = decls.type_list[pos];
while (pos + count < locals && decls.type_list[pos + count] == type) while (pos + count < locals && decls.type_list[pos + count] == type)
++count; ++count;
os << ".addLocals({" << type.type_name() << "_count: " << count << "})"; os << ".addLocals({" << type.name() << "_count: " << count << "})";
} }
os << "\n"; os << "\n";
} }
......
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