[wasm] Remove --experimental-wasm-reftypes flag
Since the reftypes proposal has shipped, we remove the respective flag and the code that handled its absence. We maintain a WasmFeature for reftypes for feature detection purposes. We remove the flag declaration from tests, and adapt some tests that make no sense without the flag. Bug: v8:7581 Change-Id: Icf2f8d0feae8f30ec68d5560f1e7ee5959481483 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3329781 Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Manos Koukoutos <manoskouk@chromium.org> Cr-Commit-Position: refs/heads/main@{#78351}
This commit is contained in:
parent
9310a1620e
commit
1771e4aaa3
@ -1054,7 +1054,6 @@ FOREACH_WASM_FEATURE_FLAG(DECL_WASM_FLAG)
|
||||
#undef DECL_WASM_FLAG
|
||||
|
||||
DEFINE_IMPLICATION(experimental_wasm_gc, experimental_wasm_typed_funcref)
|
||||
DEFINE_IMPLICATION(experimental_wasm_typed_funcref, experimental_wasm_reftypes)
|
||||
|
||||
DEFINE_BOOL(wasm_gc_js_interop, false, "experimental WasmGC-JS interop")
|
||||
|
||||
|
@ -586,7 +586,7 @@ class LiftoffCompiler {
|
||||
case kRttWithDepth:
|
||||
case kI8:
|
||||
case kI16:
|
||||
bailout_reason = kRefTypes;
|
||||
bailout_reason = kGC;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -392,7 +392,6 @@ void Engine::operator delete(void* p) { ::operator delete(p); }
|
||||
|
||||
auto Engine::make(own<Config>&& config) -> own<Engine> {
|
||||
i::FLAG_expose_gc = true;
|
||||
i::FLAG_experimental_wasm_reftypes = true;
|
||||
auto engine = new (std::nothrow) EngineImpl;
|
||||
if (!engine) return own<Engine>();
|
||||
engine->platform = v8::platform::NewDefaultPlatform();
|
||||
@ -1931,7 +1930,6 @@ auto Table::make(Store* store_abs, const TableType* type, const Ref* ref)
|
||||
break;
|
||||
case ANYREF:
|
||||
// See Engine::make().
|
||||
DCHECK(i::wasm::WasmFeatures::FromFlags().has_reftypes());
|
||||
i_type = i::wasm::kWasmExternRef;
|
||||
break;
|
||||
default:
|
||||
|
@ -183,21 +183,6 @@ void DecodeError(Decoder* decoder, const char* str) {
|
||||
|
||||
namespace value_type_reader {
|
||||
|
||||
V8_INLINE WasmFeature feature_for_heap_type(HeapType heap_type) {
|
||||
switch (heap_type.representation()) {
|
||||
case HeapType::kFunc:
|
||||
case HeapType::kExtern:
|
||||
return WasmFeature::kFeature_reftypes;
|
||||
case HeapType::kEq:
|
||||
case HeapType::kI31:
|
||||
case HeapType::kData:
|
||||
case HeapType::kAny:
|
||||
return WasmFeature::kFeature_gc;
|
||||
case HeapType::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
// If {module} is not null, the read index will be checked against the module's
|
||||
// type capacity.
|
||||
template <Decoder::ValidateFlag validate>
|
||||
@ -215,29 +200,26 @@ HeapType read_heap_type(Decoder* decoder, const byte* pc,
|
||||
uint8_t uint_7_mask = 0x7F;
|
||||
uint8_t code = static_cast<ValueTypeCode>(heap_index) & uint_7_mask;
|
||||
switch (code) {
|
||||
case kFuncRefCode:
|
||||
case kEqRefCode:
|
||||
case kExternRefCode:
|
||||
case kI31RefCode:
|
||||
case kDataRefCode:
|
||||
case kAnyRefCode: {
|
||||
HeapType result = HeapType::from_code(code);
|
||||
if (!VALIDATE(enabled.contains(feature_for_heap_type(result)))) {
|
||||
case kAnyRefCode:
|
||||
if (!VALIDATE(enabled.has_gc())) {
|
||||
DecodeError<validate>(
|
||||
decoder, pc,
|
||||
"invalid heap type '%s', enable with --experimental-wasm-%s",
|
||||
result.name().c_str(),
|
||||
WasmFeatures::name_for_feature(feature_for_heap_type(result)));
|
||||
"invalid heap type '%s', enable with --experimental-wasm-gc",
|
||||
HeapType::from_code(code).name().c_str());
|
||||
return HeapType(HeapType::kBottom);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
V8_FALLTHROUGH;
|
||||
case kExternRefCode:
|
||||
case kFuncRefCode:
|
||||
return HeapType::from_code(code);
|
||||
default:
|
||||
DecodeError<validate>(decoder, pc, "Unknown heap type %" PRId64,
|
||||
heap_index);
|
||||
return HeapType(HeapType::kBottom);
|
||||
}
|
||||
UNREACHABLE();
|
||||
} else {
|
||||
if (!VALIDATE(enabled.has_typed_funcref())) {
|
||||
DecodeError<validate>(decoder, pc,
|
||||
@ -281,26 +263,25 @@ ValueType read_value_type(Decoder* decoder, const byte* pc,
|
||||
}
|
||||
ValueTypeCode code = static_cast<ValueTypeCode>(val);
|
||||
switch (code) {
|
||||
case kFuncRefCode:
|
||||
case kEqRefCode:
|
||||
case kExternRefCode:
|
||||
case kI31RefCode:
|
||||
case kDataRefCode:
|
||||
case kAnyRefCode: {
|
||||
case kAnyRefCode:
|
||||
if (!VALIDATE(enabled.has_gc())) {
|
||||
DecodeError<validate>(
|
||||
decoder, pc,
|
||||
"invalid value type '%sref', enable with --experimental-wasm-gc",
|
||||
HeapType::from_code(code).name().c_str());
|
||||
return kWasmBottom;
|
||||
}
|
||||
V8_FALLTHROUGH;
|
||||
case kExternRefCode:
|
||||
case kFuncRefCode: {
|
||||
HeapType heap_type = HeapType::from_code(code);
|
||||
Nullability nullability = code == kI31RefCode || code == kDataRefCode
|
||||
? kNonNullable
|
||||
: kNullable;
|
||||
ValueType result = ValueType::Ref(heap_type, nullability);
|
||||
if (!VALIDATE(enabled.contains(feature_for_heap_type(heap_type)))) {
|
||||
DecodeError<validate>(
|
||||
decoder, pc,
|
||||
"invalid value type '%s', enable with --experimental-wasm-%s",
|
||||
result.name().c_str(),
|
||||
WasmFeatures::name_for_feature(feature_for_heap_type(heap_type)));
|
||||
return kWasmBottom;
|
||||
}
|
||||
return result;
|
||||
return ValueType::Ref(heap_type, nullability);
|
||||
}
|
||||
case kI32Code:
|
||||
return kWasmI32;
|
||||
@ -1354,13 +1335,6 @@ class WasmDecoder : public Decoder {
|
||||
|
||||
bool Validate(const byte* pc, CallIndirectImmediate<validate>& imm) {
|
||||
if (!ValidateSignature(pc, imm.sig_imm)) return false;
|
||||
// call_indirect is not behind the reftypes feature, so we have to impose
|
||||
// the older format if reftypes is not enabled.
|
||||
if (!VALIDATE((imm.table_imm.index == 0 && imm.table_imm.length == 1) ||
|
||||
this->enabled_.has_reftypes())) {
|
||||
DecodeError(pc + imm.sig_imm.length, "expected table index 0, found %u",
|
||||
imm.table_imm.index);
|
||||
}
|
||||
if (!ValidateTable(pc + imm.sig_imm.length, imm.table_imm)) {
|
||||
return false;
|
||||
}
|
||||
@ -1538,6 +1512,9 @@ class WasmDecoder : public Decoder {
|
||||
// The following Validate* functions all validate an IndexImmediate, albeit
|
||||
// differently according to context.
|
||||
bool ValidateTable(const byte* pc, IndexImmediate<validate>& imm) {
|
||||
if (imm.index > 0 || imm.length > 1) {
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
}
|
||||
if (!VALIDATE(imm.index < module_->tables.size())) {
|
||||
DecodeError(pc, "invalid table index: %u", imm.index);
|
||||
return false;
|
||||
@ -2941,7 +2918,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
|
||||
}
|
||||
|
||||
DECODE(SelectWithType) {
|
||||
CHECK_PROTOTYPE_OPCODE(reftypes);
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
SelectTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
|
||||
this->module_);
|
||||
if (this->failed()) return 0;
|
||||
@ -3075,7 +3052,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
|
||||
}
|
||||
|
||||
DECODE(RefNull) {
|
||||
CHECK_PROTOTYPE_OPCODE(reftypes);
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
HeapTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
|
||||
this->module_);
|
||||
if (!VALIDATE(this->ok())) return 0;
|
||||
@ -3087,7 +3064,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
|
||||
}
|
||||
|
||||
DECODE(RefIsNull) {
|
||||
CHECK_PROTOTYPE_OPCODE(reftypes);
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
Value value = Peek(0, 0);
|
||||
Value result = CreateValue(kWasmI32);
|
||||
switch (value.type.kind()) {
|
||||
@ -3116,7 +3093,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
|
||||
}
|
||||
|
||||
DECODE(RefFunc) {
|
||||
CHECK_PROTOTYPE_OPCODE(reftypes);
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
IndexImmediate<validate> imm(this, this->pc_ + 1, "function index");
|
||||
if (!this->ValidateFunction(this->pc_ + 1, imm)) return 0;
|
||||
HeapType heap_type(this->enabled_.has_typed_funcref()
|
||||
@ -3221,7 +3198,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
|
||||
}
|
||||
|
||||
DECODE(TableGet) {
|
||||
CHECK_PROTOTYPE_OPCODE(reftypes);
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
IndexImmediate<validate> imm(this, this->pc_ + 1, "table index");
|
||||
if (!this->ValidateTable(this->pc_ + 1, imm)) return 0;
|
||||
Value index = Peek(0, 0, kWasmI32);
|
||||
@ -3233,7 +3210,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
|
||||
}
|
||||
|
||||
DECODE(TableSet) {
|
||||
CHECK_PROTOTYPE_OPCODE(reftypes);
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
IndexImmediate<validate> imm(this, this->pc_ + 1, "table index");
|
||||
if (!this->ValidateTable(this->pc_ + 1, imm)) return 0;
|
||||
Value value = Peek(0, 1, this->module_->tables[imm.index].type);
|
||||
@ -3419,7 +3396,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
|
||||
this->pc_, &opcode_length, "numeric index");
|
||||
if (full_opcode == kExprTableGrow || full_opcode == kExprTableSize ||
|
||||
full_opcode == kExprTableFill) {
|
||||
CHECK_PROTOTYPE_OPCODE(reftypes);
|
||||
this->detected_->Add(kFeature_reftypes);
|
||||
}
|
||||
trace_msg->AppendOpcode(full_opcode);
|
||||
return DecodeNumericOpcode(full_opcode, opcode_length);
|
||||
|
@ -722,7 +722,6 @@ class ModuleDecoderImpl : public Decoder {
|
||||
}
|
||||
case kExternalTable: {
|
||||
// ===== Imported table ==============================================
|
||||
if (!AddTable(module_.get())) break;
|
||||
import->index = static_cast<uint32_t>(module_->tables.size());
|
||||
module_->num_imported_tables++;
|
||||
module_->tables.emplace_back();
|
||||
@ -818,14 +817,9 @@ class ModuleDecoderImpl : public Decoder {
|
||||
}
|
||||
|
||||
void DecodeTableSection() {
|
||||
// TODO(ahaas): Set the correct limit to {kV8MaxWasmTables} once the
|
||||
// implementation of ExternRef landed.
|
||||
uint32_t max_count =
|
||||
enabled_features_.has_reftypes() ? 100000 : kV8MaxWasmTables;
|
||||
uint32_t table_count = consume_count("table count", max_count);
|
||||
uint32_t table_count = consume_count("table count", kV8MaxWasmTables);
|
||||
|
||||
for (uint32_t i = 0; ok() && i < table_count; i++) {
|
||||
if (!AddTable(module_.get())) break;
|
||||
module_->tables.emplace_back();
|
||||
WasmTable* table = &module_->tables.back();
|
||||
const byte* type_position = pc();
|
||||
@ -1536,16 +1530,6 @@ class ModuleDecoderImpl : public Decoder {
|
||||
return static_cast<uint32_t>(ptr - start_) + buffer_offset_;
|
||||
}
|
||||
|
||||
bool AddTable(WasmModule* module) {
|
||||
if (enabled_features_.has_reftypes()) return true;
|
||||
if (module->tables.size() > 0) {
|
||||
error("At most one table is supported");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool AddMemory(WasmModule* module) {
|
||||
if (module->has_memory) {
|
||||
error("At most one memory is supported");
|
||||
@ -1854,27 +1838,13 @@ class ModuleDecoderImpl : public Decoder {
|
||||
}
|
||||
|
||||
// Reads a reference type for tables and element segment headers.
|
||||
// Unless extensions are enabled, only funcref is allowed.
|
||||
// TODO(manoskouk): Replace this with consume_value_type (and checks against
|
||||
// the returned type at callsites as needed) once the
|
||||
// 'reftypes' proposal is standardized.
|
||||
ValueType consume_reference_type() {
|
||||
if (!enabled_features_.has_reftypes()) {
|
||||
uint8_t ref_type = consume_u8("reference type");
|
||||
if (ref_type != kFuncRefCode) {
|
||||
error(pc_ - 1,
|
||||
"invalid table type. Consider using experimental flags.");
|
||||
return kWasmBottom;
|
||||
}
|
||||
return kWasmFuncRef;
|
||||
} else {
|
||||
const byte* position = pc();
|
||||
ValueType result = consume_value_type();
|
||||
if (!result.is_reference()) {
|
||||
error(position, "expected reference type");
|
||||
}
|
||||
return result;
|
||||
const byte* position = pc();
|
||||
ValueType result = consume_value_type();
|
||||
if (!result.is_reference()) {
|
||||
error(position, "expected reference type");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const FunctionSig* consume_sig(Zone* zone) {
|
||||
@ -1969,12 +1939,6 @@ class ModuleDecoderImpl : public Decoder {
|
||||
? WasmElemSegment::kStatusDeclarative
|
||||
: WasmElemSegment::kStatusPassive
|
||||
: WasmElemSegment::kStatusActive;
|
||||
if (status == WasmElemSegment::kStatusDeclarative &&
|
||||
!enabled_features_.has_reftypes()) {
|
||||
error(
|
||||
"Declarative element segments require --experimental-wasm-reftypes");
|
||||
return {};
|
||||
}
|
||||
const bool is_active = status == WasmElemSegment::kStatusActive;
|
||||
|
||||
*expressions_as_elements = flag & kExpressionsAsElementsMask;
|
||||
@ -2093,9 +2057,8 @@ class ModuleDecoderImpl : public Decoder {
|
||||
return index;
|
||||
}
|
||||
|
||||
// TODO(manoskouk): When reftypes lands, consider if we can implement this
|
||||
// with consume_init_expr(). It will require changes in module-instantiate.cc,
|
||||
// in {LoadElemSegmentImpl}.
|
||||
// TODO(manoskouk): Implement this with consume_init_expr(). It will require
|
||||
// changes in module-instantiate.cc, in {LoadElemSegmentImpl}.
|
||||
WasmElemSegment::Entry consume_element_expr() {
|
||||
uint8_t opcode = consume_u8("element opcode");
|
||||
if (failed()) return {};
|
||||
@ -2115,13 +2078,6 @@ class ModuleDecoderImpl : public Decoder {
|
||||
return {WasmElemSegment::Entry::kRefFuncEntry, index};
|
||||
}
|
||||
case kExprGlobalGet: {
|
||||
if (!enabled_features_.has_reftypes()) {
|
||||
errorf(
|
||||
"Unexpected opcode 0x%x in element. Enable with "
|
||||
"--experimental-wasm-reftypes",
|
||||
kExprGlobalGet);
|
||||
return {};
|
||||
}
|
||||
uint32_t index = this->consume_u32v("global index");
|
||||
if (failed()) return {};
|
||||
if (index >= module_->globals.size()) {
|
||||
|
@ -24,7 +24,7 @@ constexpr uint32_t kWasmVersion = 0x01;
|
||||
|
||||
// Binary encoding of value and heap types.
|
||||
enum ValueTypeCode : uint8_t {
|
||||
// Current wasm types
|
||||
// Current value types
|
||||
kVoidCode = 0x40,
|
||||
kI32Code = 0x7f,
|
||||
kI64Code = 0x7e,
|
||||
@ -32,11 +32,13 @@ enum ValueTypeCode : uint8_t {
|
||||
kF64Code = 0x7c,
|
||||
// Simd proposal
|
||||
kS128Code = 0x7b,
|
||||
// reftypes, typed-funcref, and GC proposals
|
||||
// GC proposal packed types
|
||||
kI8Code = 0x7a,
|
||||
kI16Code = 0x79,
|
||||
// Current reference types
|
||||
kFuncRefCode = 0x70,
|
||||
kExternRefCode = 0x6f,
|
||||
// typed-funcref and GC proposal types
|
||||
kAnyRefCode = 0x6e,
|
||||
kEqRefCode = 0x6d,
|
||||
kOptRefCode = 0x6c,
|
||||
|
@ -98,13 +98,6 @@
|
||||
/* Shipped in v9.1 * */ \
|
||||
V(simd, "SIMD opcodes", true) \
|
||||
\
|
||||
/* Reference Types, a.k.a. reftypes proposal. */ \
|
||||
/* https://github.com/WebAssembly/reference-types */ \
|
||||
/* V8 side owner: ahaas */ \
|
||||
/* Staged in v7.8. */ \
|
||||
/* Shipped in v9.6 * */ \
|
||||
V(reftypes, "reference type opcodes", true) \
|
||||
\
|
||||
/* Threads proposal. */ \
|
||||
/* https://github.com/webassembly/threads */ \
|
||||
/* NOTE: This is enabled via chromium flag on desktop systems since v7.4, */ \
|
||||
|
@ -16,8 +16,11 @@ WasmFeatures WasmFeatures::FromFlags() {
|
||||
WasmFeatures features = WasmFeatures::None();
|
||||
#define FLAG_REF(feat, ...) \
|
||||
if (FLAG_experimental_wasm_##feat) features.Add(kFeature_##feat);
|
||||
FOREACH_WASM_FEATURE(FLAG_REF)
|
||||
FOREACH_WASM_FEATURE_FLAG(FLAG_REF)
|
||||
#undef FLAG_REF
|
||||
#define NON_FLAG_REF(feat, ...) features.Add(kFeature_##feat);
|
||||
FOREACH_WASM_NON_FLAG_FEATURE(NON_FLAG_REF)
|
||||
#undef NON_FLAG_REF
|
||||
return features;
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,14 @@
|
||||
#include "src/base/macros.h"
|
||||
#include "src/wasm/wasm-feature-flags.h"
|
||||
|
||||
// Features that are always enabled and do not have a flag.
|
||||
#define FOREACH_WASM_NON_FLAG_FEATURE(V) \
|
||||
V(reftypes, "reference type opcodes", true)
|
||||
|
||||
// All features, including features that do not have flags.
|
||||
#define FOREACH_WASM_FEATURE FOREACH_WASM_FEATURE_FLAG
|
||||
#define FOREACH_WASM_FEATURE(V) \
|
||||
FOREACH_WASM_FEATURE_FLAG(V) \
|
||||
FOREACH_WASM_NON_FLAG_FEATURE(V)
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
@ -58,6 +64,8 @@ class WasmFeatures : public base::EnumSet<WasmFeature> {
|
||||
static inline constexpr WasmFeatures All();
|
||||
static inline constexpr WasmFeatures None();
|
||||
static inline constexpr WasmFeatures ForAsmjs();
|
||||
// Retuns optional features that are enabled by flags, plus features that are
|
||||
// not enabled by a flag and are always on.
|
||||
static WasmFeatures FromFlags();
|
||||
static V8_EXPORT_PRIVATE WasmFeatures FromIsolate(Isolate*);
|
||||
static V8_EXPORT_PRIVATE WasmFeatures FromContext(Isolate*,
|
||||
|
@ -1158,8 +1158,7 @@ void WebAssemblyTable(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
// With the type reflection proposal, "funcref" replaces "anyfunc",
|
||||
// and anyfunc just becomes an alias for "funcref".
|
||||
type = i::wasm::kWasmFuncRef;
|
||||
} else if (enabled_features.has_reftypes() &&
|
||||
string->StringEquals(v8_str(isolate, "externref"))) {
|
||||
} else if (string->StringEquals(v8_str(isolate, "externref"))) {
|
||||
type = i::wasm::kWasmExternRef;
|
||||
} else {
|
||||
thrower.TypeError(
|
||||
@ -1331,16 +1330,14 @@ bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
|
||||
*type = i::wasm::kWasmI64;
|
||||
} else if (string->StringEquals(v8_str(isolate, "f64"))) {
|
||||
*type = i::wasm::kWasmF64;
|
||||
} else if (enabled_features.has_reftypes() &&
|
||||
string->StringEquals(v8_str(isolate, "externref"))) {
|
||||
} else if (string->StringEquals(v8_str(isolate, "externref"))) {
|
||||
*type = i::wasm::kWasmExternRef;
|
||||
} else if (enabled_features.has_type_reflection() &&
|
||||
string->StringEquals(v8_str(isolate, "funcref"))) {
|
||||
// The type reflection proposal renames "anyfunc" to "funcref", and makes
|
||||
// "anyfunc" an alias of "funcref".
|
||||
*type = i::wasm::kWasmFuncRef;
|
||||
} else if (enabled_features.has_reftypes() &&
|
||||
string->StringEquals(v8_str(isolate, "anyfunc"))) {
|
||||
} else if (string->StringEquals(v8_str(isolate, "anyfunc"))) {
|
||||
// The JS api spec uses 'anyfunc' instead of 'funcref'.
|
||||
*type = i::wasm::kWasmFuncRef;
|
||||
} else if (enabled_features.has_gc() &&
|
||||
|
@ -52,7 +52,7 @@ constexpr size_t kV8MaxWasmFunctionBrTableSize = 65520;
|
||||
// Don't use this limit directly, but use the value of FLAG_wasm_max_table_size.
|
||||
constexpr size_t kV8MaxWasmTableSize = 10000000;
|
||||
constexpr size_t kV8MaxWasmTableInitEntries = 10000000;
|
||||
constexpr size_t kV8MaxWasmTables = 1;
|
||||
constexpr size_t kV8MaxWasmTables = 100000;
|
||||
constexpr size_t kV8MaxWasmMemories = 1;
|
||||
|
||||
// GC proposal. These limits are not standardized yet.
|
||||
|
@ -785,59 +785,40 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer* buffer) const {
|
||||
buffer->write_size(element_segments_.size());
|
||||
for (const WasmElemSegment& segment : element_segments_) {
|
||||
bool is_active = segment.status == WasmElemSegment::kStatusActive;
|
||||
// If this segment is expressible in the backwards-compatible syntax
|
||||
// (before reftypes proposal), we should emit it in that syntax.
|
||||
// This is the case if the segment is active and all entries are function
|
||||
// references. Note that this is currently the only path that allows
|
||||
// kRelativeToImports function indexing mode.
|
||||
// TODO(manoskouk): Remove this logic once reftypes has shipped.
|
||||
bool backwards_compatible =
|
||||
is_active && segment.table_index == 0 &&
|
||||
std::all_of(
|
||||
segment.entries.begin(), segment.entries.end(), [](auto& entry) {
|
||||
return entry.kind ==
|
||||
WasmModuleBuilder::WasmElemSegment::Entry::kRefFuncEntry;
|
||||
});
|
||||
if (backwards_compatible) {
|
||||
buffer->write_u8(0);
|
||||
// We pick the most general syntax, i.e., we always explicitly emit the
|
||||
// table index and the type, and use the expressions-as-elements syntax.
|
||||
// The initial byte is one of 0x05, 0x06, and 0x07.
|
||||
uint8_t kind_mask =
|
||||
segment.status == WasmElemSegment::kStatusActive
|
||||
? 0b10
|
||||
: segment.status == WasmElemSegment::kStatusDeclarative ? 0b11
|
||||
: 0b01;
|
||||
uint8_t expressions_as_elements_mask = 0b100;
|
||||
buffer->write_u8(kind_mask | expressions_as_elements_mask);
|
||||
if (is_active) {
|
||||
buffer->write_u32v(segment.table_index);
|
||||
WriteInitializerExpression(buffer, segment.offset, segment.type);
|
||||
buffer->write_size(segment.entries.size());
|
||||
for (const WasmElemSegment::Entry entry : segment.entries) {
|
||||
buffer->write_u32v(
|
||||
segment.indexing_mode == WasmElemSegment::kRelativeToImports
|
||||
? entry.index
|
||||
: entry.index +
|
||||
static_cast<uint32_t>(function_imports_.size()));
|
||||
}
|
||||
} else {
|
||||
DCHECK_EQ(segment.indexing_mode, WasmElemSegment::kRelativeToImports);
|
||||
// If we pick the general syntax, we always explicitly emit the table
|
||||
// index and the type, and use the expressions-as-elements syntax. I.e.
|
||||
// the initial byte is one of 0x05, 0x06, and 0x07.
|
||||
uint8_t kind_mask =
|
||||
segment.status == WasmElemSegment::kStatusActive
|
||||
? 0b10
|
||||
: segment.status == WasmElemSegment::kStatusDeclarative ? 0b11
|
||||
: 0b01;
|
||||
uint8_t expressions_as_elements_mask = 0b100;
|
||||
buffer->write_u8(kind_mask | expressions_as_elements_mask);
|
||||
if (is_active) {
|
||||
buffer->write_u32v(segment.table_index);
|
||||
WriteInitializerExpression(buffer, segment.offset, segment.type);
|
||||
}
|
||||
WriteValueType(buffer, segment.type);
|
||||
buffer->write_size(segment.entries.size());
|
||||
for (const WasmElemSegment::Entry entry : segment.entries) {
|
||||
uint8_t opcode =
|
||||
entry.kind == WasmElemSegment::Entry::kGlobalGetEntry
|
||||
? kExprGlobalGet
|
||||
: entry.kind == WasmElemSegment::Entry::kRefFuncEntry
|
||||
? kExprRefFunc
|
||||
: kExprRefNull;
|
||||
buffer->write_u8(opcode);
|
||||
buffer->write_u32v(entry.index);
|
||||
buffer->write_u8(kExprEnd);
|
||||
}
|
||||
}
|
||||
WriteValueType(buffer, segment.type);
|
||||
buffer->write_size(segment.entries.size());
|
||||
for (const WasmElemSegment::Entry entry : segment.entries) {
|
||||
uint8_t opcode =
|
||||
entry.kind == WasmElemSegment::Entry::kGlobalGetEntry
|
||||
? kExprGlobalGet
|
||||
: entry.kind == WasmElemSegment::Entry::kRefFuncEntry
|
||||
? kExprRefFunc
|
||||
: kExprRefNull;
|
||||
bool needs_function_offset =
|
||||
segment.indexing_mode ==
|
||||
WasmElemSegment::kRelativeToDeclaredFunctions &&
|
||||
entry.kind == WasmElemSegment::Entry::kRefFuncEntry;
|
||||
uint32_t index =
|
||||
entry.index + (needs_function_offset
|
||||
? static_cast<uint32_t>(function_imports_.size())
|
||||
: 0);
|
||||
buffer->write_u8(opcode);
|
||||
buffer->write_u32v(index);
|
||||
buffer->write_u8(kExprEnd);
|
||||
}
|
||||
}
|
||||
FixupSection(buffer, start);
|
||||
|
@ -33,7 +33,6 @@ class WasmGCTester {
|
||||
explicit WasmGCTester(
|
||||
TestExecutionTier execution_tier = TestExecutionTier::kTurbofan)
|
||||
: flag_gc(&v8::internal::FLAG_experimental_wasm_gc, true),
|
||||
flag_reftypes(&v8::internal::FLAG_experimental_wasm_reftypes, true),
|
||||
flag_typedfuns(&v8::internal::FLAG_experimental_wasm_typed_funcref,
|
||||
true),
|
||||
flag_liftoff(&v8::internal::FLAG_liftoff,
|
||||
@ -176,7 +175,6 @@ class WasmGCTester {
|
||||
|
||||
private:
|
||||
const FlagScope<bool> flag_gc;
|
||||
const FlagScope<bool> flag_reftypes;
|
||||
const FlagScope<bool> flag_typedfuns;
|
||||
const FlagScope<bool> flag_liftoff;
|
||||
const FlagScope<bool> flag_liftoff_only;
|
||||
|
@ -359,17 +359,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom0To0) {
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom3To0) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyInbounds(execution_tier, 3, 0);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom5To9) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyInbounds(execution_tier, 5, 9);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom6To6) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyInbounds(execution_tier, 6, 6);
|
||||
}
|
||||
|
||||
@ -466,11 +463,9 @@ WASM_COMPILED_EXEC_TEST(TableInitElems0) {
|
||||
TestTableInitElems(execution_tier, 0);
|
||||
}
|
||||
WASM_COMPILED_EXEC_TEST(TableInitElems7) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableInitElems(execution_tier, 7);
|
||||
}
|
||||
WASM_COMPILED_EXEC_TEST(TableInitElems9) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableInitElems(execution_tier, 9);
|
||||
}
|
||||
|
||||
@ -543,14 +538,8 @@ void TestTableInitOob(TestExecutionTier execution_tier, int table_index) {
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableInitOob0) { TestTableInitOob(execution_tier, 0); }
|
||||
WASM_COMPILED_EXEC_TEST(TableInitOob7) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableInitOob(execution_tier, 7);
|
||||
}
|
||||
WASM_COMPILED_EXEC_TEST(TableInitOob9) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableInitOob(execution_tier, 9);
|
||||
}
|
||||
WASM_COMPILED_EXEC_TEST(TableInitOob7) { TestTableInitOob(execution_tier, 7); }
|
||||
WASM_COMPILED_EXEC_TEST(TableInitOob9) { TestTableInitOob(execution_tier, 9); }
|
||||
|
||||
void TestTableCopyElems(TestExecutionTier execution_tier, int table_dst,
|
||||
int table_src) {
|
||||
@ -619,17 +608,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom0To0) {
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom3To0) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyElems(execution_tier, 3, 0);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom5To9) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyElems(execution_tier, 5, 9);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom6To6) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyElems(execution_tier, 6, 6);
|
||||
}
|
||||
|
||||
@ -693,17 +679,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyCallsTo0From0) {
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyCallsTo3From0) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyCalls(execution_tier, 3, 0);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyCallsTo5From9) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyCalls(execution_tier, 5, 9);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyCallsTo6From6) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyCalls(execution_tier, 6, 6);
|
||||
}
|
||||
|
||||
@ -768,17 +751,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom0To0) {
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom3To0) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyOobWrites(execution_tier, 3, 0);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom5To9) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyOobWrites(execution_tier, 5, 9);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom6To6) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyOobWrites(execution_tier, 6, 6);
|
||||
}
|
||||
|
||||
@ -826,17 +806,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyOob1From0To0) {
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyOob1From3To0) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyOob1(execution_tier, 3, 0);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyOob1From5To9) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyOob1(execution_tier, 5, 9);
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(TableCopyOob1From6To6) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
TestTableCopyOob1(execution_tier, 6, 6);
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,6 @@ WASM_EXEC_TEST(TryCatchTrapRemByZero) {
|
||||
}
|
||||
|
||||
WASM_EXEC_TEST(TryCatchTrapTableFill) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
int table_index = 0;
|
||||
int length = 10; // OOB.
|
||||
int start = 10; // OOB.
|
||||
|
@ -801,7 +801,6 @@ WASM_EXEC_TEST(Select_s128_parameters) {
|
||||
}
|
||||
|
||||
WASM_EXEC_TEST(SelectWithType_float_parameters) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
WasmRunner<float, float, float, int32_t> r(execution_tier);
|
||||
BUILD(r,
|
||||
WASM_SELECT_F(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)));
|
||||
@ -819,7 +818,6 @@ WASM_EXEC_TEST(Select) {
|
||||
}
|
||||
|
||||
WASM_EXEC_TEST(SelectWithType) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
WasmRunner<int32_t, int32_t> r(execution_tier);
|
||||
// return select(11, 22, a);
|
||||
BUILD(r, WASM_SELECT_I(WASM_I32V_1(11), WASM_I32V_1(22), WASM_LOCAL_GET(0)));
|
||||
@ -841,7 +839,6 @@ WASM_EXEC_TEST(Select_strict1) {
|
||||
}
|
||||
|
||||
WASM_EXEC_TEST(SelectWithType_strict1) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
WasmRunner<int32_t, int32_t> r(execution_tier);
|
||||
// select(a=0, a=1, a=2); return a
|
||||
BUILD(r,
|
||||
@ -866,7 +863,6 @@ WASM_EXEC_TEST(Select_strict2) {
|
||||
}
|
||||
|
||||
WASM_EXEC_TEST(SelectWithType_strict2) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
WasmRunner<int32_t, int32_t> r(execution_tier);
|
||||
r.AllocateLocal(kWasmI32);
|
||||
r.AllocateLocal(kWasmI32);
|
||||
@ -894,7 +890,6 @@ WASM_EXEC_TEST(Select_strict3) {
|
||||
}
|
||||
|
||||
WASM_EXEC_TEST(SelectWithType_strict3) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
WasmRunner<int32_t, int32_t> r(execution_tier);
|
||||
r.AllocateLocal(kWasmI32);
|
||||
r.AllocateLocal(kWasmI32);
|
||||
|
@ -2581,7 +2581,6 @@ class WasmCompileFuzzer : public WasmExecutionFuzzer {
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
constexpr bool require_valid = true;
|
||||
EXPERIMENTAL_FLAG_SCOPE(reftypes);
|
||||
EXPERIMENTAL_FLAG_SCOPE(typed_funcref);
|
||||
EXPERIMENTAL_FLAG_SCOPE(gc);
|
||||
EXPERIMENTAL_FLAG_SCOPE(simd);
|
||||
|
@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes
|
||||
|
||||
utils.load('test/inspector/wasm-inspector-test.js');
|
||||
|
||||
let {session, contextGroup, Protocol} =
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes --expose-gc
|
||||
// Flags: --expose-gc
|
||||
utils.load('test/inspector/wasm-inspector-test.js');
|
||||
|
||||
let {session, contextGroup, Protocol} =
|
||||
|
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --liftoff --no-wasm-tier-up --wasm-tier-mask-for-testing=2
|
||||
// Flags: --experimental-wasm-reftypes
|
||||
|
||||
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes --trace-turbo-graph
|
||||
// Flags: --trace-turbo-graph
|
||||
|
||||
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// The test needs --wasm-tier-up because we can't serialize and deserialize
|
||||
// Liftoff code.
|
||||
// Flags: --allow-natives-syntax --experimental-wasm-reftypes --wasm-tier-up
|
||||
// Flags: --allow-natives-syntax --wasm-tier-up
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes
|
||||
// Flags: --expose-wasm
|
||||
|
||||
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes --experimental-wasm-typed-funcref
|
||||
// Flags: --experimental-wasm-typed-funcref
|
||||
|
||||
let raw = new Uint8Array([
|
||||
0x00, 0x61, 0x73, 0x6d, // wasm magic
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes --expose-gc
|
||||
// Flags: --expose-wasm --expose-gc
|
||||
|
||||
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-eh --experimental-wasm-reftypes
|
||||
// Flags: --experimental-wasm-eh
|
||||
|
||||
load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-eh --experimental-wasm-reftypes --allow-natives-syntax
|
||||
// Flags: --experimental-wasm-eh --allow-natives-syntax
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
d8.file.execute("test/mjsunit/wasm/exceptions-utils.js");
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes --expose-gc --liftoff
|
||||
// Flags: --no-wasm-tier-up --experimental-liftoff-extern-ref
|
||||
// Flags: --expose-gc --liftoff --no-wasm-tier-up
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/externref-globals.js");
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes --expose-gc
|
||||
// Flags: --expose-gc
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes --expose-gc --liftoff
|
||||
// Flags: --no-wasm-tier-up --experimental-liftoff-extern-ref
|
||||
// Flags: --expose-wasm --expose-gc --liftoff --no-wasm-tier-up
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/externref.js");
|
||||
|
@ -2,8 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes --expose-gc
|
||||
// Flags: --allow-natives-syntax
|
||||
// Flags: --expose-wasm --expose-gc --allow-natives-syntax
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes --experimental-wasm-return-call
|
||||
// Flags: --expose-wasm --experimental-wasm-return-call
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes
|
||||
// Flags: --expose-wasm
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes --liftoff
|
||||
// Flags: --no-wasm-tier-up --liftoff-extern-ref
|
||||
// Flags: --liftoff --no-wasm-tier-up
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/table-access.js");
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes
|
||||
// Flags: --expose-wasm
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-reftypes
|
||||
|
||||
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
let kTableSize = 5;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes
|
||||
// Flags: --expose-wasm
|
||||
|
||||
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm --experimental-wasm-reftypes
|
||||
// Flags: --expose-wasm
|
||||
|
||||
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-type-reflection --experimental-wasm-reftypes
|
||||
// Flags: --experimental-wasm-type-reflection
|
||||
|
||||
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
@ -79,9 +79,6 @@ d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
assertEquals(fun2, instance.exports.get_global());
|
||||
})();
|
||||
|
||||
// This is an extension of "type-reflection.js/TestFunctionTableSetAndCall" to
|
||||
// multiple table indexes. If --experimental-wasm-reftypes is enabled by default
|
||||
// this test case can supersede the other one.
|
||||
(function TestFunctionMultiTableSetAndCall() {
|
||||
let builder = new WasmModuleBuilder();
|
||||
let v1 = 7; let v2 = 9; let v3 = 0.0;
|
||||
|
@ -528,29 +528,6 @@ d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
});
|
||||
})();
|
||||
|
||||
(function TestFunctionTableSetAndCall() {
|
||||
let builder = new WasmModuleBuilder();
|
||||
let fun1 = new WebAssembly.Function({parameters:[], results:["i32"]}, _ => 7);
|
||||
let fun2 = new WebAssembly.Function({parameters:[], results:["i32"]}, _ => 9);
|
||||
let fun3 = new WebAssembly.Function({parameters:[], results:["f64"]}, _ => 0);
|
||||
let table = new WebAssembly.Table({element: "anyfunc", initial: 2});
|
||||
let table_index = builder.addImportedTable("m", "table", 2);
|
||||
let sig_index = builder.addType(kSig_i_v);
|
||||
table.set(0, fun1);
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([
|
||||
kExprLocalGet, 0,
|
||||
kExprCallIndirect, sig_index, table_index
|
||||
])
|
||||
.exportFunc();
|
||||
let instance = builder.instantiate({ m: { table: table }});
|
||||
assertEquals(7, instance.exports.main(0));
|
||||
table.set(1, fun2);
|
||||
assertEquals(9, instance.exports.main(1));
|
||||
table.set(1, fun3);
|
||||
assertTraps(kTrapFuncSigMismatch, () => instance.exports.main(1));
|
||||
})();
|
||||
|
||||
(function TestFunctionTableSetI64() {
|
||||
let builder = new WasmModuleBuilder();
|
||||
let fun = new WebAssembly.Function({parameters:[], results:["i64"]}, _ => 0n);
|
||||
|
@ -346,8 +346,6 @@ TEST_F(FunctionBodyDecoderTest, Int32Const1) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RefFunc) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
|
||||
builder.AddFunction(sigs.v_ii());
|
||||
builder.AddFunction(sigs.ii_v());
|
||||
ExpectValidates(sigs.a_v(), {kExprRefFunc, 1});
|
||||
@ -1102,7 +1100,6 @@ TEST_F(FunctionBodyDecoderTest, Unreachable_select2) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, UnreachableRefTypes) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
WASM_FEATURE_SCOPE(return_call);
|
||||
@ -1517,7 +1514,6 @@ TEST_F(FunctionBodyDecoderTest, MacrosInt64) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, AllSimpleExpressions) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
// Test all simple expressions which are described by a signature.
|
||||
#define DECODE_TEST(name, opcode, sig) \
|
||||
{ \
|
||||
@ -1935,7 +1931,6 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsWithMismatchedSigs1) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, IndirectCallsWithMismatchedSigs2) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
byte table_type_index = builder.AddSignature(sigs.i_i());
|
||||
byte table_index =
|
||||
@ -1963,7 +1958,6 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsWithMismatchedSigs2) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, TablesWithFunctionSubtyping) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
EXPERIMENTAL_FLAG_SCOPE(gc);
|
||||
@ -2183,7 +2177,6 @@ TEST_F(FunctionBodyDecoderTest, AllSetGlobalCombinations) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, TableSet) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
byte tab_type = builder.AddSignature(sigs.i_i());
|
||||
@ -2240,7 +2233,6 @@ TEST_F(FunctionBodyDecoderTest, TableSet) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, TableGet) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
byte tab_type = builder.AddSignature(sigs.i_i());
|
||||
@ -2308,7 +2300,6 @@ TEST_F(FunctionBodyDecoderTest, TableGet) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, MultiTableCallIndirect) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
byte tab_ref = builder.AddTable(kWasmExternRef, 10, true, 20);
|
||||
byte tab_func = builder.AddTable(kWasmFuncRef, 20, true, 30);
|
||||
|
||||
@ -2547,7 +2538,6 @@ TEST_F(FunctionBodyDecoderTest, Break_TypeCheck) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll1) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
ValueType storage[] = {kValueTypes[i], kValueTypes[i], kValueTypes[j]};
|
||||
@ -2562,7 +2552,6 @@ TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll1) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll2) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
ValueType storage[] = {kValueTypes[i], kValueTypes[i], kValueTypes[j]};
|
||||
@ -2577,7 +2566,6 @@ TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll2) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll3) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
ValueType storage[] = {kValueTypes[i], kValueTypes[i], kValueTypes[j]};
|
||||
@ -2608,7 +2596,6 @@ TEST_F(FunctionBodyDecoderTest, Break_Unify) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, BreakIf_cond_type) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
ValueType types[] = {kValueTypes[i], kValueTypes[i], kValueTypes[j]};
|
||||
@ -2622,7 +2609,6 @@ TEST_F(FunctionBodyDecoderTest, BreakIf_cond_type) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, BreakIf_val_type) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
ValueType types[] = {kValueTypes[i], kValueTypes[i], kValueTypes[j],
|
||||
@ -2693,7 +2679,6 @@ TEST_F(FunctionBodyDecoderTest, BrTable2b) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, BrTableSubtyping) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -2863,7 +2848,6 @@ TEST_F(FunctionBodyDecoderTest, Select) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, Select_needs_value_type) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectFailure(sigs.e_e(),
|
||||
{WASM_SELECT(WASM_LOCAL_GET(0), WASM_LOCAL_GET(0), WASM_ZERO)});
|
||||
ExpectFailure(sigs.c_c(),
|
||||
@ -2915,7 +2899,6 @@ TEST_F(FunctionBodyDecoderTest, Select_TypeCheck) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, SelectWithType) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectValidates(sigs.i_i(), {WASM_SELECT_I(WASM_LOCAL_GET(0),
|
||||
WASM_LOCAL_GET(0), WASM_ZERO)});
|
||||
ExpectValidates(sigs.f_ff(),
|
||||
@ -2933,7 +2916,6 @@ TEST_F(FunctionBodyDecoderTest, SelectWithType) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, SelectWithType_fail) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectFailure(sigs.i_i(), {WASM_SELECT_F(WASM_LOCAL_GET(0), WASM_LOCAL_GET(0),
|
||||
WASM_ZERO)});
|
||||
ExpectFailure(sigs.f_ff(),
|
||||
@ -3368,8 +3350,6 @@ TEST_F(FunctionBodyDecoderTest, TableInitWrongType) {
|
||||
uint32_t table_index = builder.InitializeTable(wasm::kWasmFuncRef);
|
||||
uint32_t element_index =
|
||||
builder.AddPassiveElementSegment(wasm::kWasmExternRef);
|
||||
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectFailure(sigs.v_v(), {WASM_TABLE_INIT(table_index, element_index,
|
||||
WASM_ZERO, WASM_ZERO, WASM_ZERO)});
|
||||
}
|
||||
@ -3397,8 +3377,6 @@ TEST_F(FunctionBodyDecoderTest, ElemDrop) {
|
||||
TEST_F(FunctionBodyDecoderTest, TableInitDeclarativeElem) {
|
||||
builder.InitializeTable(wasm::kWasmFuncRef);
|
||||
builder.AddDeclarativeElementSegment();
|
||||
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
byte code[] = {WASM_TABLE_INIT(0, 0, WASM_ZERO, WASM_ZERO, WASM_ZERO),
|
||||
WASM_END};
|
||||
for (size_t i = 0; i <= arraysize(code); ++i) {
|
||||
@ -3410,8 +3388,6 @@ TEST_F(FunctionBodyDecoderTest, TableInitDeclarativeElem) {
|
||||
TEST_F(FunctionBodyDecoderTest, DeclarativeElemDrop) {
|
||||
builder.InitializeTable(wasm::kWasmFuncRef);
|
||||
builder.AddDeclarativeElementSegment();
|
||||
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectValidates(sigs.v_v(), {WASM_ELEM_DROP(0)});
|
||||
ExpectFailure(sigs.v_v(), {WASM_ELEM_DROP(1)});
|
||||
}
|
||||
@ -3419,17 +3395,12 @@ TEST_F(FunctionBodyDecoderTest, DeclarativeElemDrop) {
|
||||
TEST_F(FunctionBodyDecoderTest, RefFuncDeclared) {
|
||||
builder.InitializeTable(wasm::kWasmVoid);
|
||||
byte function_index = builder.AddFunction(sigs.v_i());
|
||||
|
||||
ExpectFailure(sigs.a_v(), {WASM_REF_FUNC(function_index)});
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectValidates(sigs.a_v(), {WASM_REF_FUNC(function_index)});
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RefFuncUndeclared) {
|
||||
builder.InitializeTable(wasm::kWasmVoid);
|
||||
byte function_index = builder.AddFunction(sigs.v_i(), false);
|
||||
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectFailure(sigs.a_v(), {WASM_REF_FUNC(function_index)});
|
||||
}
|
||||
|
||||
@ -3456,8 +3427,6 @@ TEST_F(FunctionBodyDecoderTest, TableCopy) {
|
||||
TEST_F(FunctionBodyDecoderTest, TableCopyWrongType) {
|
||||
uint32_t dst_table_index = builder.InitializeTable(wasm::kWasmFuncRef);
|
||||
uint32_t src_table_index = builder.InitializeTable(wasm::kWasmExternRef);
|
||||
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectFailure(sigs.v_v(), {WASM_TABLE_COPY(dst_table_index, src_table_index,
|
||||
WASM_ZERO, WASM_ZERO, WASM_ZERO)});
|
||||
}
|
||||
@ -3466,10 +3435,6 @@ TEST_F(FunctionBodyDecoderTest, TableGrow) {
|
||||
byte tab_func = builder.AddTable(kWasmFuncRef, 10, true, 20);
|
||||
byte tab_ref = builder.AddTable(kWasmExternRef, 10, true, 20);
|
||||
|
||||
ExpectFailure(
|
||||
sigs.i_c(),
|
||||
{WASM_TABLE_GROW(tab_func, WASM_REF_NULL(kFuncRefCode), WASM_ONE)});
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectValidates(
|
||||
sigs.i_c(),
|
||||
{WASM_TABLE_GROW(tab_func, WASM_REF_NULL(kFuncRefCode), WASM_ONE)});
|
||||
@ -3490,9 +3455,6 @@ TEST_F(FunctionBodyDecoderTest, TableGrow) {
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, TableSize) {
|
||||
int tab = builder.AddTable(kWasmFuncRef, 10, true, 20);
|
||||
|
||||
ExpectFailure(sigs.i_v(), {WASM_TABLE_SIZE(tab)});
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectValidates(sigs.i_v(), {WASM_TABLE_SIZE(tab)});
|
||||
ExpectFailure(sigs.i_v(), {WASM_TABLE_SIZE(tab + 2)});
|
||||
}
|
||||
@ -3500,11 +3462,6 @@ TEST_F(FunctionBodyDecoderTest, TableSize) {
|
||||
TEST_F(FunctionBodyDecoderTest, TableFill) {
|
||||
byte tab_func = builder.AddTable(kWasmFuncRef, 10, true, 20);
|
||||
byte tab_ref = builder.AddTable(kWasmExternRef, 10, true, 20);
|
||||
|
||||
ExpectFailure(sigs.v_c(),
|
||||
{WASM_TABLE_FILL(tab_func, WASM_ONE,
|
||||
WASM_REF_NULL(kFuncRefCode), WASM_ONE)});
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectValidates(sigs.v_c(),
|
||||
{WASM_TABLE_FILL(tab_func, WASM_ONE,
|
||||
WASM_REF_NULL(kFuncRefCode), WASM_ONE)});
|
||||
@ -3524,15 +3481,12 @@ TEST_F(FunctionBodyDecoderTest, TableFill) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, TableOpsWithoutTable) {
|
||||
{
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
ExpectFailure(sigs.i_v(), {WASM_TABLE_GROW(0, WASM_REF_NULL(kExternRefCode),
|
||||
WASM_ONE)});
|
||||
ExpectFailure(sigs.i_v(), {WASM_TABLE_SIZE(0)});
|
||||
ExpectFailure(sigs.i_e(),
|
||||
{WASM_TABLE_FILL(0, WASM_ONE, WASM_REF_NULL(kExternRefCode),
|
||||
WASM_ONE)});
|
||||
}
|
||||
ExpectFailure(sigs.i_v(),
|
||||
{WASM_TABLE_GROW(0, WASM_REF_NULL(kExternRefCode), WASM_ONE)});
|
||||
ExpectFailure(sigs.i_v(), {WASM_TABLE_SIZE(0)});
|
||||
ExpectFailure(
|
||||
sigs.i_e(),
|
||||
{WASM_TABLE_FILL(0, WASM_ONE, WASM_REF_NULL(kExternRefCode), WASM_ONE)});
|
||||
builder.AddPassiveElementSegment(wasm::kWasmFuncRef);
|
||||
ExpectFailure(sigs.v_v(),
|
||||
{WASM_TABLE_INIT(0, 0, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
|
||||
@ -3541,7 +3495,6 @@ TEST_F(FunctionBodyDecoderTest, TableOpsWithoutTable) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, TableCopyMultiTable) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
{
|
||||
TestModuleBuilder builder;
|
||||
builder.AddTable(kWasmExternRef, 10, true, 20);
|
||||
@ -3590,7 +3543,6 @@ TEST_F(FunctionBodyDecoderTest, TableCopyMultiTable) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, TableInitMultiTable) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
{
|
||||
TestModuleBuilder builder;
|
||||
builder.AddTable(kWasmExternRef, 10, true, 20);
|
||||
@ -3623,7 +3575,6 @@ TEST_F(FunctionBodyDecoderTest, TableInitMultiTable) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, UnpackPackedTypes) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
{
|
||||
@ -3659,7 +3610,6 @@ ValueType optref(byte type_index) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, StructNewDefaultWithRtt) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
{
|
||||
@ -3692,7 +3642,6 @@ TEST_F(FunctionBodyDecoderTest, StructNewDefaultWithRtt) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, NominalStructSubtyping) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
byte structural_type = builder.AddStruct({F(kWasmI32, true)});
|
||||
@ -3720,14 +3669,12 @@ TEST_F(FunctionBodyDecoderTest, NominalStructSubtyping) {
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, DefaultableLocal) {
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
AddLocals(kWasmExternRef, 1);
|
||||
ExpectValidates(sigs.v_v(), {});
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, NonDefaultableLocal) {
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
AddLocals(ValueType::Ref(HeapType::kExtern, kNonNullable), 1);
|
||||
ExpectFailure(sigs.v_v(), {}, kAppendEnd,
|
||||
"Cannot define function-level local of non-defaultable type");
|
||||
@ -3735,7 +3682,6 @@ TEST_F(FunctionBodyDecoderTest, NonDefaultableLocal) {
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, AllowingNonDefaultableLocals) {
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(nn_locals);
|
||||
byte struct_type_index = builder.AddStruct({F(kWasmI32, true)});
|
||||
ValueType rep = ref(struct_type_index);
|
||||
@ -3770,7 +3716,6 @@ TEST_F(FunctionBodyDecoderTest, AllowingNonDefaultableLocals) {
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, UnsafeNonDefaultableLocals) {
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(unsafe_nn_locals);
|
||||
byte struct_type_index = builder.AddStruct({F(kWasmI32, true)});
|
||||
ValueType rep = ref(struct_type_index);
|
||||
@ -3801,7 +3746,6 @@ TEST_F(FunctionBodyDecoderTest, UnsafeNonDefaultableLocals) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RefEq) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(eh);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(simd);
|
||||
@ -3848,7 +3792,6 @@ TEST_F(FunctionBodyDecoderTest, RefEq) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RefAsNonNull) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(eh);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(simd);
|
||||
@ -3889,7 +3832,6 @@ TEST_F(FunctionBodyDecoderTest, RefAsNonNull) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RefNull) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(eh);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
@ -3911,7 +3853,6 @@ TEST_F(FunctionBodyDecoderTest, RefNull) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RefIsNull) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(eh);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
@ -3945,7 +3886,6 @@ TEST_F(FunctionBodyDecoderTest, RefIsNull) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, BrOnNull) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -3967,7 +3907,6 @@ TEST_F(FunctionBodyDecoderTest, BrOnNull) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, BrOnNonNull) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -3992,7 +3931,6 @@ TEST_F(FunctionBodyDecoderTest, BrOnNonNull) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, GCStruct) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4125,7 +4063,6 @@ TEST_F(FunctionBodyDecoderTest, GCStruct) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, GCArray) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4282,7 +4219,6 @@ TEST_F(FunctionBodyDecoderTest, GCArray) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, PackedFields) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4367,7 +4303,6 @@ TEST_F(FunctionBodyDecoderTest, PackedFields) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, PackedTypesAsLocals) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
AddLocals(kWasmI8, 1);
|
||||
@ -4375,7 +4310,6 @@ TEST_F(FunctionBodyDecoderTest, PackedTypesAsLocals) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RttCanon) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
WASM_FEATURE_SCOPE(eh);
|
||||
@ -4397,7 +4331,6 @@ TEST_F(FunctionBodyDecoderTest, RttCanon) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RttSub) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4486,7 +4419,6 @@ TEST_F(FunctionBodyDecoderTest, RttSub) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, RefTestCast) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4580,7 +4512,6 @@ TEST_F(FunctionBodyDecoderTest, RefTestCast) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, BrOnCastOrCastFail) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4648,7 +4579,6 @@ TEST_F(FunctionBodyDecoderTest, BrOnCastOrCastFail) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, BrOnAbstractType) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4705,7 +4635,6 @@ TEST_F(FunctionBodyDecoderTest, BrOnAbstractType) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, LocalTeeTyping) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4724,7 +4653,6 @@ TEST_F(FunctionBodyDecoderTest, LocalTeeTyping) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionBodyDecoderTest, MergeNullableTypes) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -4746,7 +4674,6 @@ TEST_F(FunctionBodyDecoderTest, MergeNullableTypes) {
|
||||
// This tests that num_locals_ in decoder remains consistent, even if we fail
|
||||
// mid-DecodeLocals().
|
||||
TEST_F(FunctionBodyDecoderTest, Regress_1154439) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
AddLocals(kWasmI32, 1);
|
||||
AddLocals(kWasmI64, 1000000);
|
||||
@ -5057,7 +4984,6 @@ class TypeReaderTest : public TestWithZone {
|
||||
|
||||
TEST_F(TypeReaderTest, HeapTypeDecodingTest) {
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
HeapType heap_func = HeapType(HeapType::kFunc);
|
||||
@ -5160,7 +5086,6 @@ TEST_F(LocalDeclDecoderTest, WrongLocalDeclsCount2) {
|
||||
}
|
||||
|
||||
TEST_F(LocalDeclDecoderTest, OneLocal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
ValueType type = kValueTypes[i];
|
||||
const byte data[] = {1, 1, static_cast<byte>(type.value_type_code())};
|
||||
@ -5175,7 +5100,6 @@ TEST_F(LocalDeclDecoderTest, OneLocal) {
|
||||
}
|
||||
|
||||
TEST_F(LocalDeclDecoderTest, FiveLocals) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
ValueType type = kValueTypes[i];
|
||||
const byte data[] = {1, 5, static_cast<byte>(type.value_type_code())};
|
||||
@ -5241,7 +5165,6 @@ TEST_F(LocalDeclDecoderTest, UseEncoder) {
|
||||
}
|
||||
|
||||
TEST_F(LocalDeclDecoderTest, InvalidTypeIndex) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
const byte* data = nullptr;
|
||||
|
@ -300,7 +300,6 @@ TEST_F(WasmModuleVerifyTest, S128Global) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, ExternRefGlobal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -345,7 +344,6 @@ TEST_F(WasmModuleVerifyTest, ExternRefGlobal) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, FuncRefGlobal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -389,7 +387,6 @@ TEST_F(WasmModuleVerifyTest, FuncRefGlobal) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, InvalidFuncRefGlobal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -405,7 +402,6 @@ TEST_F(WasmModuleVerifyTest, InvalidFuncRefGlobal) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, ExternRefGlobalWithGlobalInit) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
SECTION(Import, // --
|
||||
ENTRY_COUNT(1), // number of imports
|
||||
@ -437,7 +433,6 @@ TEST_F(WasmModuleVerifyTest, ExternRefGlobalWithGlobalInit) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, NullGlobalWithGlobalInit) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
SECTION(Import, // --
|
||||
ENTRY_COUNT(1), // number of imports
|
||||
@ -569,7 +564,6 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
|
||||
"Invalid global index: 1");
|
||||
|
||||
{
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte referencing_undefined_global_nested[] = {
|
||||
@ -766,7 +760,6 @@ TEST_F(WasmModuleVerifyTest, TwoGlobals) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, RefNullGlobal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {SECTION(Global, ENTRY_COUNT(1), kFuncRefCode, 1,
|
||||
WASM_REF_NULL(kFuncRefCode), kExprEnd)};
|
||||
ModuleResult result = DecodeModule(data, data + sizeof(data));
|
||||
@ -774,7 +767,6 @@ TEST_F(WasmModuleVerifyTest, RefNullGlobal) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, RefNullGlobalInvalid1) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
static const byte data[] = {SECTION(Global, ENTRY_COUNT(1), kOptRefCode, 0, 1,
|
||||
WASM_REF_NULL(0), kExprEnd)};
|
||||
@ -783,7 +775,6 @@ TEST_F(WasmModuleVerifyTest, RefNullGlobalInvalid1) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, RefNullGlobalInvalid2) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
static const byte data[] = {SECTION(Global, ENTRY_COUNT(1), kFuncRefCode, 1,
|
||||
kExprRefNull, U32V_5(1000001), kExprEnd)};
|
||||
@ -794,7 +785,6 @@ TEST_F(WasmModuleVerifyTest, RefNullGlobalInvalid2) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, RttCanonGlobalStruct) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -807,7 +797,6 @@ TEST_F(WasmModuleVerifyTest, RttCanonGlobalStruct) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, RttCanonGlobalTypeError) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -822,7 +811,6 @@ TEST_F(WasmModuleVerifyTest, RttCanonGlobalTypeError) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttSubOfCanon) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -837,7 +825,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttSubOfCanon) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfCanon) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -853,7 +840,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfCanon) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttSubOfSubOfCanon) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -868,7 +854,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttSubOfSubOfCanon) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfSubOfCanon) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -885,7 +870,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfSubOfCanon) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfFreshSubOfCanon) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -902,7 +886,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfFreshSubOfCanon) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttSubOfGlobal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -924,7 +907,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttSubOfGlobal) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfGlobal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -947,7 +929,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfGlobal) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttSubOfGlobalTypeError) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -969,7 +950,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttSubOfGlobalTypeError) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfGlobalTypeError) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -993,7 +973,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubOfGlobalTypeError) {
|
||||
|
||||
#if !V8_OS_FUCHSIA
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttSubIllegalParent) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -1009,7 +988,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttSubIllegalParent) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubIllegalParent) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -1027,7 +1005,6 @@ TEST_F(WasmModuleVerifyTest, GlobalRttFreshSubIllegalParent) {
|
||||
#endif // !V8_OS_FUCHSIA
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, RttSubGlobalTypeError) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -1042,7 +1019,6 @@ TEST_F(WasmModuleVerifyTest, RttSubGlobalTypeError) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, RttFreshSubGlobalTypeError) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -1058,7 +1034,6 @@ TEST_F(WasmModuleVerifyTest, RttFreshSubGlobalTypeError) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, StructNewInitExpr) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -1107,7 +1082,6 @@ TEST_F(WasmModuleVerifyTest, StructNewInitExpr) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, ArrayInitInitExpr) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -1169,7 +1143,6 @@ TEST_F(WasmModuleVerifyTest, ArrayInitInitExpr) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, EmptyStruct) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte empty_struct[] = {SECTION(Type, ENTRY_COUNT(1), // --
|
||||
@ -1180,7 +1153,6 @@ TEST_F(WasmModuleVerifyTest, EmptyStruct) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, InvalidStructTypeDef) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte all_good[] = {
|
||||
@ -1253,7 +1225,6 @@ TEST_F(WasmModuleVerifyTest, InvalidStructTypeDef) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, NominalStructTypeDef) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -1353,7 +1324,6 @@ TEST_F(WasmModuleVerifyTest, NominalStructTypeDef) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, NominalFunctionTypeDef) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
EXPERIMENTAL_FLAG_SCOPE(gc); // Needed for subtype checking.
|
||||
@ -1382,7 +1352,6 @@ TEST_F(WasmModuleVerifyTest, NominalFunctionTypeDef) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, InvalidArrayTypeDef) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte all_good[] = {
|
||||
@ -1648,7 +1617,6 @@ TEST_F(WasmModuleVerifyTest, MultipleSignatures) {
|
||||
TEST_F(WasmModuleVerifyTest, CanonicalTypeIds) {
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
|
||||
static const byte data[] = {
|
||||
SECTION(Type, // --
|
||||
@ -1999,7 +1967,6 @@ TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) {
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTables) {
|
||||
// Test that if we have multiple tables, in the element section we can target
|
||||
// and initialize all tables.
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -2031,7 +1998,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTables) {
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionMixedTables) {
|
||||
// Test that if we have multiple tables, both imported and module-defined, in
|
||||
// the element section we can target and initialize all tables.
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -2088,7 +2054,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTables) {
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTablesArbitraryOrder) {
|
||||
// Test that the order in which tables are targeted in the element secion
|
||||
// can be arbitrary.
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -2124,7 +2089,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTablesArbitraryOrder) {
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) {
|
||||
// Test that the order in which tables are targeted in the element secion can
|
||||
// be arbitrary. In this test, tables can be both imported and module-defined.
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -2179,7 +2143,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionInitExternRefTableWithFuncRef) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -2213,7 +2176,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionInitExternRefTableWithFuncRef) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionInitFuncRefTableWithFuncRefNull) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// table declaration ---------------------------------------------------
|
||||
SECTION(Table, ENTRY_COUNT(1), // section header
|
||||
@ -2232,7 +2194,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionInitFuncRefTableWithFuncRefNull) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionInitFuncRefTableWithExternRefNull) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// table declaration ---------------------------------------------------
|
||||
SECTION(Table, ENTRY_COUNT(1), // section header
|
||||
@ -2256,7 +2217,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionInitFuncRefTableWithExternRefNull) {
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionDontInitExternRefImportedTable) {
|
||||
// Test that imported tables of type ExternRef cannot be initialized in the
|
||||
// elements section.
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 ---------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -2299,7 +2259,6 @@ TEST_F(WasmModuleVerifyTest, ElementSectionDontInitExternRefImportedTable) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, ElementSectionGlobalGetOutOfBounds) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
SECTION(Element, ENTRY_COUNT(1),
|
||||
0x05, // Mode: Passive with expressions-as-elements
|
||||
@ -2331,22 +2290,7 @@ TEST_F(WasmModuleVerifyTest, IndirectFunctionInvalidIndex) {
|
||||
EXPECT_FAILURE(data);
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, MultipleTablesWithoutFlag) {
|
||||
static const byte data[] = {
|
||||
SECTION(Table, // table section
|
||||
ENTRY_COUNT(2), // 2 tables
|
||||
kFuncRefCode, // table 1: type
|
||||
0, // table 1: no maximum
|
||||
10, // table 1: minimum size
|
||||
kFuncRefCode, // table 2: type
|
||||
0, // table 2: no maximum
|
||||
10), // table 2: minimum size
|
||||
};
|
||||
EXPECT_FAILURE(data);
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, MultipleTablesWithFlag) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
TEST_F(WasmModuleVerifyTest, MultipleTables) {
|
||||
static const byte data[] = {
|
||||
SECTION(Table, // table section
|
||||
ENTRY_COUNT(2), // 2 tables
|
||||
@ -2371,7 +2315,6 @@ TEST_F(WasmModuleVerifyTest, MultipleTablesWithFlag) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, TypedFunctionTable) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
static const byte data[] = {
|
||||
@ -2387,7 +2330,6 @@ TEST_F(WasmModuleVerifyTest, TypedFunctionTable) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, NullableTableIllegalInitializer) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
static const byte data[] = {
|
||||
@ -2405,7 +2347,6 @@ TEST_F(WasmModuleVerifyTest, NullableTableIllegalInitializer) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, IllegalTableTypes) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
|
||||
@ -2439,7 +2380,6 @@ TEST_F(WasmModuleVerifyTest, IllegalTableTypes) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, NonNullableTable) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
static const byte data[] = {
|
||||
@ -2457,7 +2397,6 @@ TEST_F(WasmModuleVerifyTest, NonNullableTable) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, NonNullableTableNoInitializer) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
|
||||
static const byte data[] = {
|
||||
@ -2552,7 +2491,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_v) {
|
||||
}
|
||||
|
||||
TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
ValueTypePair ret_type = kValueTypes[i];
|
||||
const byte data[] = {SIG_ENTRY_x(ret_type.code)};
|
||||
@ -2566,7 +2504,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
|
||||
}
|
||||
|
||||
TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
ValueTypePair param_type = kValueTypes[i];
|
||||
const byte data[] = {SIG_ENTRY_v_x(param_type.code)};
|
||||
@ -2580,7 +2517,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
|
||||
}
|
||||
|
||||
TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
ValueTypePair ret_type = kValueTypes[i];
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
@ -2598,7 +2534,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
|
||||
}
|
||||
|
||||
TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
ValueTypePair p0_type = kValueTypes[i];
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
@ -2617,7 +2552,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
|
||||
}
|
||||
|
||||
TEST_F(WasmSignatureDecodeTest, Ok_tt_tt) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
|
||||
ValueTypePair p0_type = kValueTypes[i];
|
||||
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
|
||||
@ -2668,21 +2602,6 @@ TEST_F(WasmSignatureDecodeTest, Fail_off_end) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WasmSignatureDecodeTest, Fail_externref_without_flag) {
|
||||
// Disable ExternRef support and check that decoding fails.
|
||||
WASM_FEATURE_SCOPE_VAL(reftypes, false);
|
||||
byte ref_types[] = {kFuncRefCode, kExternRefCode};
|
||||
for (byte invalid_type : ref_types) {
|
||||
for (size_t i = 0;; i++) {
|
||||
byte data[] = {SIG_ENTRY_x_xx(kI32Code, kI32Code, kI32Code)};
|
||||
if (i >= arraysize(data)) break;
|
||||
data[i] = invalid_type;
|
||||
const FunctionSig* sig = DecodeSig(data, data + sizeof(data));
|
||||
EXPECT_EQ(nullptr, sig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WasmSignatureDecodeTest, Fail_invalid_type) {
|
||||
byte kInvalidType = 76;
|
||||
for (size_t i = 0;; i++) {
|
||||
@ -3494,7 +3413,7 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegmentExternRef) {
|
||||
U32V_1(0)),
|
||||
// code ------------------------------------------------------------------
|
||||
ONE_EMPTY_BODY};
|
||||
EXPECT_FAILURE(data);
|
||||
EXPECT_VERIFIES(data);
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, PassiveElementSegmentWithIndices) {
|
||||
@ -3528,13 +3447,10 @@ TEST_F(WasmModuleVerifyTest, DeclarativeElementSegmentFuncRef) {
|
||||
U32V_1(0)), // func ref count
|
||||
// code ------------------------------------------------------------------
|
||||
ONE_EMPTY_BODY};
|
||||
EXPECT_FAILURE(data);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
EXPECT_VERIFIES(data);
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, DeclarativeElementSegmentWithInvalidIndex) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
static const byte data[] = {
|
||||
// sig#0 -----------------------------------------------------------------
|
||||
TYPE_SECTION_ONE_SIG_VOID_VOID,
|
||||
@ -3637,7 +3553,6 @@ TEST_F(WasmModuleVerifyTest, DataCountSegmentCount_omitted) {
|
||||
TEST_F(WasmModuleVerifyTest, GcStructIdsPass) {
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
|
||||
static const byte data[] = {SECTION(
|
||||
Type, ENTRY_COUNT(3),
|
||||
@ -3652,7 +3567,6 @@ TEST_F(WasmModuleVerifyTest, GcStructIdsPass) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, OutOfBoundsTypeInGlobal) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
static const byte data[] = {
|
||||
SECTION(Global, ENTRY_COUNT(1), kRefCode, 0, WASM_REF_NULL(0), kExprEnd)};
|
||||
@ -3661,7 +3575,6 @@ TEST_F(WasmModuleVerifyTest, OutOfBoundsTypeInGlobal) {
|
||||
}
|
||||
|
||||
TEST_F(WasmModuleVerifyTest, OutOfBoundsTypeInType) {
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
static const byte data[] = {
|
||||
@ -3674,7 +3587,6 @@ TEST_F(WasmModuleVerifyTest, OutOfBoundsTypeInType) {
|
||||
TEST_F(WasmModuleVerifyTest, IllegalPackedFields) {
|
||||
WASM_FEATURE_SCOPE(gc);
|
||||
WASM_FEATURE_SCOPE(typed_funcref);
|
||||
WASM_FEATURE_SCOPE(reftypes);
|
||||
|
||||
static const byte data[] = {
|
||||
SECTION(Global, ENTRY_COUNT(1), kI16Code, 0, WASM_INIT_EXPR_I32V_1(13))};
|
||||
|
@ -47,7 +47,7 @@ class TestCase(testcase.D8TestCase):
|
||||
for proposal in proposal_flags:
|
||||
if os.sep.join(['proposals', proposal['name']]) in self.path:
|
||||
return proposal['flags']
|
||||
return ['--experimental-wasm-reftypes']
|
||||
return []
|
||||
|
||||
|
||||
def GetSuite(*args, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user