Commit 81c19070 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by V8 LUCI CQ

[wasm] A few small cleanups

Change-Id: Ie07e626900f8fc8218944be2b33da6fc109adf92
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3168273
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76930}
parent 7511020b
...@@ -1254,17 +1254,12 @@ Reduction MachineOperatorReducer::ReduceUint32Mod(Node* node) { ...@@ -1254,17 +1254,12 @@ Reduction MachineOperatorReducer::ReduceUint32Mod(Node* node) {
Reduction MachineOperatorReducer::ReduceStore(Node* node) { Reduction MachineOperatorReducer::ReduceStore(Node* node) {
NodeMatcher nm(node); NodeMatcher nm(node);
MachineRepresentation rep; DCHECK(nm.IsStore() || nm.IsUnalignedStore());
int value_input; MachineRepresentation rep =
if (nm.IsStore()) { nm.IsStore() ? StoreRepresentationOf(node->op()).representation()
rep = StoreRepresentationOf(node->op()).representation(); : UnalignedStoreRepresentationOf(node->op());
value_input = 2;
} else {
DCHECK(nm.IsUnalignedStore());
rep = UnalignedStoreRepresentationOf(node->op());
value_input = 2;
}
const int value_input = 2;
Node* const value = node->InputAt(value_input); Node* const value = node->InputAt(value_input);
switch (value->opcode()) { switch (value->opcode()) {
......
...@@ -2905,8 +2905,8 @@ Node* WasmGraphBuilder::BuildWasmCall(const wasm::FunctionSig* sig, ...@@ -2905,8 +2905,8 @@ Node* WasmGraphBuilder::BuildWasmCall(const wasm::FunctionSig* sig,
const Operator* op = mcgraph()->common()->Call(call_descriptor); const Operator* op = mcgraph()->common()->Call(call_descriptor);
Node* call = Node* call =
BuildCallNode(sig, args, position, instance_node, op, frame_state); BuildCallNode(sig, args, position, instance_node, op, frame_state);
// TODO(manoskouk): Don't always set control if we ever add properties to wasm // TODO(manoskouk): If we have kNoThrow calls, do not set them as control.
// calls. DCHECK_GT(call->op()->ControlOutputCount(), 0);
SetControl(call); SetControl(call);
size_t ret_count = sig->return_count(); size_t ret_count = sig->return_count();
...@@ -2935,8 +2935,8 @@ Node* WasmGraphBuilder::BuildWasmReturnCall(const wasm::FunctionSig* sig, ...@@ -2935,8 +2935,8 @@ Node* WasmGraphBuilder::BuildWasmReturnCall(const wasm::FunctionSig* sig,
const Operator* op = mcgraph()->common()->TailCall(call_descriptor); const Operator* op = mcgraph()->common()->TailCall(call_descriptor);
Node* call = BuildCallNode(sig, args, position, instance_node, op); Node* call = BuildCallNode(sig, args, position, instance_node, op);
// TODO(manoskouk): {call} will not always be a control node if we ever add // TODO(manoskouk): If we have kNoThrow calls, do not merge them to end.
// properties to wasm calls. DCHECK_GT(call->op()->ControlOutputCount(), 0);
gasm_->MergeControlToEnd(call); gasm_->MergeControlToEnd(call);
return call; return call;
......
...@@ -1899,10 +1899,11 @@ void WasmStruct::WasmStructPrint(std::ostream& os) { ...@@ -1899,10 +1899,11 @@ void WasmStruct::WasmStructPrint(std::ostream& os) {
os << Brief(base::ReadUnalignedValue<Object>(field_address)); os << Brief(base::ReadUnalignedValue<Object>(field_address));
break; break;
case wasm::kS128: case wasm::kS128:
case wasm::kBottom:
case wasm::kVoid:
os << "UNIMPLEMENTED"; // TODO(7748): Implement. os << "UNIMPLEMENTED"; // TODO(7748): Implement.
break; break;
case wasm::kBottom:
case wasm::kVoid:
UNREACHABLE();
} }
} }
os << "\n"; os << "\n";
......
...@@ -2725,19 +2725,19 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -2725,19 +2725,19 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
// the stack as it is. // the stack as it is.
break; break;
case kOptRef: { case kOptRef: {
Value result = CreateValue( Value result = CreateValue(
ValueType::Ref(ref_object.type.heap_type(), kNonNullable)); ValueType::Ref(ref_object.type.heap_type(), kNonNullable));
// The result of br_on_null has the same value as the argument (but a // The result of br_on_null has the same value as the argument (but a
// non-nullable type). // non-nullable type).
if (V8_LIKELY(current_code_reachable_and_ok_)) { if (V8_LIKELY(current_code_reachable_and_ok_)) {
CALL_INTERFACE(BrOnNull, ref_object, imm.depth); CALL_INTERFACE(BrOnNull, ref_object, imm.depth);
CALL_INTERFACE(Forward, ref_object, &result); CALL_INTERFACE(Forward, ref_object, &result);
c->br_merge()->reached = true; c->br_merge()->reached = true;
} }
// In unreachable code, we still have to push a value of the correct // In unreachable code, we still have to push a value of the correct
// type onto the stack. // type onto the stack.
Drop(ref_object); Drop(ref_object);
Push(result); Push(result);
break; break;
} }
default: default:
......
...@@ -653,7 +653,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() { ...@@ -653,7 +653,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
Handle<FixedArray> tables = isolate_->factory()->NewFixedArray(table_count); Handle<FixedArray> tables = isolate_->factory()->NewFixedArray(table_count);
for (int i = module_->num_imported_tables; i < table_count; i++) { for (int i = module_->num_imported_tables; i < table_count; i++) {
const WasmTable& table = module_->tables[i]; const WasmTable& table = module_->tables[i];
// TODO(9495): Initialize with initializer from module if present. // Initialize tables with null for now. We will initialize non-defaultable
// tables later, in {InitializeIndirectFunctionTables}.
Handle<WasmTableObject> table_obj = WasmTableObject::New( Handle<WasmTableObject> table_obj = WasmTableObject::New(
isolate_, instance, table.type, table.initial_size, isolate_, instance, table.type, table.initial_size,
table.has_maximum_size, table.maximum_size, nullptr, table.has_maximum_size, table.maximum_size, nullptr,
......
...@@ -284,8 +284,8 @@ constexpr bool is_defaultable(ValueKind kind) { ...@@ -284,8 +284,8 @@ constexpr bool is_defaultable(ValueKind kind) {
// representation (for reference types), and an inheritance depth (for rtts // representation (for reference types), and an inheritance depth (for rtts
// only). Those are encoded into 32 bits using base::BitField. The underlying // only). Those are encoded into 32 bits using base::BitField. The underlying
// ValueKind enumeration includes four elements which do not strictly correspond // ValueKind enumeration includes four elements which do not strictly correspond
// to value types: the two packed types i8 and i16, the type of void blocks // to value types: the two packed types i8 and i16, the void type (for control
// (stmt), and a bottom value (for internal use). // structures), and a bottom value (for internal use).
class ValueType { class ValueType {
public: public:
/******************************* Constructors *******************************/ /******************************* Constructors *******************************/
......
...@@ -294,7 +294,6 @@ std::ostream& operator<<(std::ostream& os, WasmElemSegment::Entry entry) { ...@@ -294,7 +294,6 @@ std::ostream& operator<<(std::ostream& os, WasmElemSegment::Entry entry) {
// Appends an initializer expression encoded in {wire_bytes}, in the offset // Appends an initializer expression encoded in {wire_bytes}, in the offset
// contained in {expr}. // contained in {expr}.
// TODO(7748): Find a way to implement other expressions here.
void AppendInitExpr(std::ostream& os, ModuleWireBytes wire_bytes, void AppendInitExpr(std::ostream& os, ModuleWireBytes wire_bytes,
WireBytesRef expr) { WireBytesRef expr) {
Decoder decoder(wire_bytes.module_bytes()); Decoder decoder(wire_bytes.module_bytes());
......
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