[wasm-gc][cleanup] Fix/Tidy up some easy TODOs etc.
Bug: v8:7748 Change-Id: I45a8f1398554da8a9543c866b4125fd9711e230b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2263933 Commit-Queue: Manos Koukoutos <manoskouk@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#68524}
This commit is contained in:
parent
f0c9e93297
commit
305e3dfcc9
@ -399,8 +399,11 @@ class LiftoffCompiler {
|
||||
return kSimd;
|
||||
case ValueType::kOptRef:
|
||||
case ValueType::kRef:
|
||||
// TODO(7748): Refine this.
|
||||
return kRefTypes;
|
||||
if (type.heap_type() == kHeapExn) {
|
||||
return kExceptionHandling;
|
||||
} else {
|
||||
return kRefTypes;
|
||||
}
|
||||
case ValueType::kBottom:
|
||||
return kMultiValue;
|
||||
default:
|
||||
|
@ -1415,12 +1415,19 @@ void PushArgs(const i::wasm::FunctionSig* sig, const Val args[],
|
||||
break;
|
||||
case i::wasm::ValueType::kRef:
|
||||
case i::wasm::ValueType::kOptRef:
|
||||
// TODO(7748): Make sure this works for all types.
|
||||
// TODO(7748): Make sure this works for all heap types.
|
||||
packer->Push(WasmRefToV8(store->i_isolate(), args[i].ref())->ptr());
|
||||
break;
|
||||
default:
|
||||
// TODO(7748): Implement these.
|
||||
case i::wasm::ValueType::kRtt:
|
||||
case i::wasm::ValueType::kS128:
|
||||
// TODO(7748): Implement.
|
||||
UNIMPLEMENTED();
|
||||
case i::wasm::ValueType::kI8:
|
||||
case i::wasm::ValueType::kI16:
|
||||
case i::wasm::ValueType::kStmt:
|
||||
case i::wasm::ValueType::kBottom:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1444,23 +1451,23 @@ void PopArgs(const i::wasm::FunctionSig* sig, Val results[],
|
||||
results[i] = Val(packer->Pop<double>());
|
||||
break;
|
||||
case i::wasm::ValueType::kRef:
|
||||
case i::wasm::ValueType::kOptRef:
|
||||
switch (type.heap_type()) {
|
||||
case i::wasm::kHeapExtern:
|
||||
case i::wasm::kHeapFunc: {
|
||||
i::Address raw = packer->Pop<i::Address>();
|
||||
i::Handle<i::Object> obj(i::Object(raw), store->i_isolate());
|
||||
results[i] = Val(V8RefValueToWasm(store, obj));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// TODO(jkummerow): Implement these.
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
case i::wasm::ValueType::kOptRef: {
|
||||
// TODO(7748): Make sure this works for all heap types.
|
||||
i::Address raw = packer->Pop<i::Address>();
|
||||
i::Handle<i::Object> obj(i::Object(raw), store->i_isolate());
|
||||
results[i] = Val(V8RefValueToWasm(store, obj));
|
||||
break;
|
||||
default:
|
||||
// TODO(7748): Implement these.
|
||||
}
|
||||
case i::wasm::ValueType::kRtt:
|
||||
case i::wasm::ValueType::kS128:
|
||||
// TODO(7748): Implement.
|
||||
UNIMPLEMENTED();
|
||||
case i::wasm::ValueType::kI8:
|
||||
case i::wasm::ValueType::kI16:
|
||||
case i::wasm::ValueType::kStmt:
|
||||
case i::wasm::ValueType::kBottom:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1707,20 +1714,20 @@ auto Global::get() const -> Val {
|
||||
case i::wasm::ValueType::kF64:
|
||||
return Val(v8_global->GetF64());
|
||||
case i::wasm::ValueType::kRef:
|
||||
case i::wasm::ValueType::kOptRef:
|
||||
switch (v8_global->type().heap_type()) {
|
||||
case i::wasm::kHeapExtern:
|
||||
case i::wasm::kHeapFunc: {
|
||||
StoreImpl* store = impl(this)->store();
|
||||
i::HandleScope scope(store->i_isolate());
|
||||
return Val(V8RefValueToWasm(store, v8_global->GetRef()));
|
||||
}
|
||||
default:
|
||||
// TODO(wasm+): Support new value types.
|
||||
UNREACHABLE();
|
||||
}
|
||||
default:
|
||||
case i::wasm::ValueType::kOptRef: {
|
||||
// TODO(7748): Make sure this works for all heap types.
|
||||
StoreImpl* store = impl(this)->store();
|
||||
i::HandleScope scope(store->i_isolate());
|
||||
return Val(V8RefValueToWasm(store, v8_global->GetRef()));
|
||||
}
|
||||
case i::wasm::ValueType::kRtt:
|
||||
case i::wasm::ValueType::kS128:
|
||||
// TODO(7748): Implement these.
|
||||
UNIMPLEMENTED();
|
||||
case i::wasm::ValueType::kI8:
|
||||
case i::wasm::ValueType::kI16:
|
||||
case i::wasm::ValueType::kStmt:
|
||||
case i::wasm::ValueType::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ ACCESSORS(WasmIndirectFunctionTable, refs, FixedArray, kRefsOffset)
|
||||
#undef PRIMITIVE_ACCESSORS
|
||||
|
||||
wasm::ValueType WasmTableObject::type() {
|
||||
// TODO(7748): Support non-nullable tables?
|
||||
// TODO(7748): Support other table types? Wait for spec to clear up.
|
||||
return wasm::ValueType::Ref(static_cast<wasm::HeapType>(raw_type()),
|
||||
wasm::kNullable);
|
||||
}
|
||||
|
@ -261,6 +261,9 @@ Handle<WasmTableObject> WasmTableObject::New(Isolate* isolate,
|
||||
uint32_t initial, bool has_maximum,
|
||||
uint32_t maximum,
|
||||
Handle<FixedArray>* entries) {
|
||||
// TODO(7748): Make this work with other types when spec clears up.
|
||||
CHECK(type.is_nullable());
|
||||
|
||||
Handle<FixedArray> backing_store = isolate->factory()->NewFixedArray(initial);
|
||||
Object null = ReadOnlyRoots(isolate).null_value();
|
||||
for (int i = 0; i < static_cast<int>(initial); ++i) {
|
||||
@ -283,8 +286,6 @@ Handle<WasmTableObject> WasmTableObject::New(Isolate* isolate,
|
||||
table_obj->set_entries(*backing_store);
|
||||
table_obj->set_current_length(initial);
|
||||
table_obj->set_maximum_length(*max);
|
||||
// TODO(7748): Make this work with other table types.
|
||||
CHECK(type.is_nullable());
|
||||
table_obj->set_raw_type(static_cast<int>(type.heap_type()));
|
||||
|
||||
table_obj->set_dispatch_tables(ReadOnlyRoots(isolate).empty_fixed_array());
|
||||
|
@ -21,24 +21,24 @@ std::ostream& operator<<(std::ostream& os, const FunctionSig& function);
|
||||
bool IsJSCompatibleSignature(const FunctionSig* sig, const WasmFeatures&);
|
||||
|
||||
// Control expressions and blocks.
|
||||
#define FOREACH_CONTROL_OPCODE(V) \
|
||||
V(Unreachable, 0x00, _) \
|
||||
V(Nop, 0x01, _) \
|
||||
V(Block, 0x02, _) \
|
||||
V(Loop, 0x03, _) \
|
||||
V(If, 0x04, _) \
|
||||
V(Else, 0x05, _) \
|
||||
V(Try, 0x06, _ /* eh_prototype */) \
|
||||
V(Catch, 0x07, _ /* eh_prototype */) \
|
||||
V(Throw, 0x08, _ /* eh_prototype */) \
|
||||
V(Rethrow, 0x09, _ /* eh_prototype */) \
|
||||
V(BrOnExn, 0x0a, _ /* eh prototype */) \
|
||||
V(End, 0x0b, _) \
|
||||
V(Br, 0x0c, _) \
|
||||
V(BrIf, 0x0d, _) \
|
||||
V(BrTable, 0x0e, _) \
|
||||
V(Return, 0x0f, _) \
|
||||
V(Let, 0x17, _ /* gc prototype */) \
|
||||
#define FOREACH_CONTROL_OPCODE(V) \
|
||||
V(Unreachable, 0x00, _) \
|
||||
V(Nop, 0x01, _) \
|
||||
V(Block, 0x02, _) \
|
||||
V(Loop, 0x03, _) \
|
||||
V(If, 0x04, _) \
|
||||
V(Else, 0x05, _) \
|
||||
V(Try, 0x06, _ /* eh_prototype */) \
|
||||
V(Catch, 0x07, _ /* eh_prototype */) \
|
||||
V(Throw, 0x08, _ /* eh_prototype */) \
|
||||
V(Rethrow, 0x09, _ /* eh_prototype */) \
|
||||
V(BrOnExn, 0x0a, _ /* eh prototype */) \
|
||||
V(End, 0x0b, _) \
|
||||
V(Br, 0x0c, _) \
|
||||
V(BrIf, 0x0d, _) \
|
||||
V(BrTable, 0x0e, _) \
|
||||
V(Return, 0x0f, _) \
|
||||
V(Let, 0x17, _ /* typed_funcref prototype */) \
|
||||
V(BrOnNull, 0xd4, _ /* gc prototype */)
|
||||
|
||||
// Constants, locals, globals, and calls.
|
||||
@ -64,7 +64,7 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, const WasmFeatures&);
|
||||
V(RefNull, 0xd0, _) \
|
||||
V(RefIsNull, 0xd1, _) \
|
||||
V(RefFunc, 0xd2, _) \
|
||||
V(RefAsNonNull, 0xd3, _)
|
||||
V(RefAsNonNull, 0xd3, _ /* typed_funcref prototype */)
|
||||
|
||||
// Load memory expressions.
|
||||
#define FOREACH_LOAD_MEM_OPCODE(V) \
|
||||
@ -596,8 +596,6 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, const WasmFeatures&);
|
||||
V(I64AtomicCompareExchange16U, 0xfe4d, l_ill) \
|
||||
V(I64AtomicCompareExchange32U, 0xfe4e, l_ill)
|
||||
|
||||
// Opcode values are guesswork for now, see:
|
||||
// https://docs.google.com/document/d/1DklC3qVuOdLHSXB5UXghM_syCh-4cMinQ50ICiXnK3Q/edit
|
||||
#define FOREACH_GC_OPCODE(V) \
|
||||
V(StructNew, 0xfb00, _) \
|
||||
V(StructNewSub, 0xfb01, _) \
|
||||
|
@ -2813,6 +2813,7 @@ class WasmInterpreterInternals {
|
||||
encoded_values->set(encoded_index++, *externref);
|
||||
break;
|
||||
}
|
||||
case kHeapEq:
|
||||
default:
|
||||
// TODO(7748): Implement these.
|
||||
UNIMPLEMENTED();
|
||||
|
Loading…
Reference in New Issue
Block a user