Commit 1771e4aa authored by Manos Koukoutos's avatar Manos Koukoutos Committed by V8 LUCI CQ

[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/+/3329781Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78351}
parent 9310a162
...@@ -1054,7 +1054,6 @@ FOREACH_WASM_FEATURE_FLAG(DECL_WASM_FLAG) ...@@ -1054,7 +1054,6 @@ FOREACH_WASM_FEATURE_FLAG(DECL_WASM_FLAG)
#undef DECL_WASM_FLAG #undef DECL_WASM_FLAG
DEFINE_IMPLICATION(experimental_wasm_gc, experimental_wasm_typed_funcref) 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") DEFINE_BOOL(wasm_gc_js_interop, false, "experimental WasmGC-JS interop")
......
...@@ -586,7 +586,7 @@ class LiftoffCompiler { ...@@ -586,7 +586,7 @@ class LiftoffCompiler {
case kRttWithDepth: case kRttWithDepth:
case kI8: case kI8:
case kI16: case kI16:
bailout_reason = kRefTypes; bailout_reason = kGC;
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
......
...@@ -392,7 +392,6 @@ void Engine::operator delete(void* p) { ::operator delete(p); } ...@@ -392,7 +392,6 @@ void Engine::operator delete(void* p) { ::operator delete(p); }
auto Engine::make(own<Config>&& config) -> own<Engine> { auto Engine::make(own<Config>&& config) -> own<Engine> {
i::FLAG_expose_gc = true; i::FLAG_expose_gc = true;
i::FLAG_experimental_wasm_reftypes = true;
auto engine = new (std::nothrow) EngineImpl; auto engine = new (std::nothrow) EngineImpl;
if (!engine) return own<Engine>(); if (!engine) return own<Engine>();
engine->platform = v8::platform::NewDefaultPlatform(); engine->platform = v8::platform::NewDefaultPlatform();
...@@ -1931,7 +1930,6 @@ auto Table::make(Store* store_abs, const TableType* type, const Ref* ref) ...@@ -1931,7 +1930,6 @@ auto Table::make(Store* store_abs, const TableType* type, const Ref* ref)
break; break;
case ANYREF: case ANYREF:
// See Engine::make(). // See Engine::make().
DCHECK(i::wasm::WasmFeatures::FromFlags().has_reftypes());
i_type = i::wasm::kWasmExternRef; i_type = i::wasm::kWasmExternRef;
break; break;
default: default:
......
...@@ -183,21 +183,6 @@ void DecodeError(Decoder* decoder, const char* str) { ...@@ -183,21 +183,6 @@ void DecodeError(Decoder* decoder, const char* str) {
namespace value_type_reader { 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 // If {module} is not null, the read index will be checked against the module's
// type capacity. // type capacity.
template <Decoder::ValidateFlag validate> template <Decoder::ValidateFlag validate>
...@@ -215,29 +200,26 @@ HeapType read_heap_type(Decoder* decoder, const byte* pc, ...@@ -215,29 +200,26 @@ HeapType read_heap_type(Decoder* decoder, const byte* pc,
uint8_t uint_7_mask = 0x7F; uint8_t uint_7_mask = 0x7F;
uint8_t code = static_cast<ValueTypeCode>(heap_index) & uint_7_mask; uint8_t code = static_cast<ValueTypeCode>(heap_index) & uint_7_mask;
switch (code) { switch (code) {
case kFuncRefCode:
case kEqRefCode: case kEqRefCode:
case kExternRefCode:
case kI31RefCode: case kI31RefCode:
case kDataRefCode: case kDataRefCode:
case kAnyRefCode: { case kAnyRefCode:
HeapType result = HeapType::from_code(code); if (!VALIDATE(enabled.has_gc())) {
if (!VALIDATE(enabled.contains(feature_for_heap_type(result)))) {
DecodeError<validate>( DecodeError<validate>(
decoder, pc, decoder, pc,
"invalid heap type '%s', enable with --experimental-wasm-%s", "invalid heap type '%s', enable with --experimental-wasm-gc",
result.name().c_str(), HeapType::from_code(code).name().c_str());
WasmFeatures::name_for_feature(feature_for_heap_type(result)));
return HeapType(HeapType::kBottom); return HeapType(HeapType::kBottom);
} }
return result; V8_FALLTHROUGH;
} case kExternRefCode:
case kFuncRefCode:
return HeapType::from_code(code);
default: default:
DecodeError<validate>(decoder, pc, "Unknown heap type %" PRId64, DecodeError<validate>(decoder, pc, "Unknown heap type %" PRId64,
heap_index); heap_index);
return HeapType(HeapType::kBottom); return HeapType(HeapType::kBottom);
} }
UNREACHABLE();
} else { } else {
if (!VALIDATE(enabled.has_typed_funcref())) { if (!VALIDATE(enabled.has_typed_funcref())) {
DecodeError<validate>(decoder, pc, DecodeError<validate>(decoder, pc,
...@@ -281,26 +263,25 @@ ValueType read_value_type(Decoder* decoder, const byte* pc, ...@@ -281,26 +263,25 @@ ValueType read_value_type(Decoder* decoder, const byte* pc,
} }
ValueTypeCode code = static_cast<ValueTypeCode>(val); ValueTypeCode code = static_cast<ValueTypeCode>(val);
switch (code) { switch (code) {
case kFuncRefCode:
case kEqRefCode: case kEqRefCode:
case kExternRefCode:
case kI31RefCode: case kI31RefCode:
case kDataRefCode: case kDataRefCode:
case kAnyRefCode: { case kAnyRefCode:
HeapType heap_type = HeapType::from_code(code); if (!VALIDATE(enabled.has_gc())) {
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>( DecodeError<validate>(
decoder, pc, decoder, pc,
"invalid value type '%s', enable with --experimental-wasm-%s", "invalid value type '%sref', enable with --experimental-wasm-gc",
result.name().c_str(), HeapType::from_code(code).name().c_str());
WasmFeatures::name_for_feature(feature_for_heap_type(heap_type)));
return kWasmBottom; return kWasmBottom;
} }
return result; V8_FALLTHROUGH;
case kExternRefCode:
case kFuncRefCode: {
HeapType heap_type = HeapType::from_code(code);
Nullability nullability = code == kI31RefCode || code == kDataRefCode
? kNonNullable
: kNullable;
return ValueType::Ref(heap_type, nullability);
} }
case kI32Code: case kI32Code:
return kWasmI32; return kWasmI32;
...@@ -1354,13 +1335,6 @@ class WasmDecoder : public Decoder { ...@@ -1354,13 +1335,6 @@ class WasmDecoder : public Decoder {
bool Validate(const byte* pc, CallIndirectImmediate<validate>& imm) { bool Validate(const byte* pc, CallIndirectImmediate<validate>& imm) {
if (!ValidateSignature(pc, imm.sig_imm)) return false; 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)) { if (!ValidateTable(pc + imm.sig_imm.length, imm.table_imm)) {
return false; return false;
} }
...@@ -1538,6 +1512,9 @@ class WasmDecoder : public Decoder { ...@@ -1538,6 +1512,9 @@ class WasmDecoder : public Decoder {
// The following Validate* functions all validate an IndexImmediate, albeit // The following Validate* functions all validate an IndexImmediate, albeit
// differently according to context. // differently according to context.
bool ValidateTable(const byte* pc, IndexImmediate<validate>& imm) { 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())) { if (!VALIDATE(imm.index < module_->tables.size())) {
DecodeError(pc, "invalid table index: %u", imm.index); DecodeError(pc, "invalid table index: %u", imm.index);
return false; return false;
...@@ -2941,7 +2918,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -2941,7 +2918,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
} }
DECODE(SelectWithType) { DECODE(SelectWithType) {
CHECK_PROTOTYPE_OPCODE(reftypes); this->detected_->Add(kFeature_reftypes);
SelectTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1, SelectTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
this->module_); this->module_);
if (this->failed()) return 0; if (this->failed()) return 0;
...@@ -3075,7 +3052,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -3075,7 +3052,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
} }
DECODE(RefNull) { DECODE(RefNull) {
CHECK_PROTOTYPE_OPCODE(reftypes); this->detected_->Add(kFeature_reftypes);
HeapTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1, HeapTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
this->module_); this->module_);
if (!VALIDATE(this->ok())) return 0; if (!VALIDATE(this->ok())) return 0;
...@@ -3087,7 +3064,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -3087,7 +3064,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
} }
DECODE(RefIsNull) { DECODE(RefIsNull) {
CHECK_PROTOTYPE_OPCODE(reftypes); this->detected_->Add(kFeature_reftypes);
Value value = Peek(0, 0); Value value = Peek(0, 0);
Value result = CreateValue(kWasmI32); Value result = CreateValue(kWasmI32);
switch (value.type.kind()) { switch (value.type.kind()) {
...@@ -3116,7 +3093,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -3116,7 +3093,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
} }
DECODE(RefFunc) { DECODE(RefFunc) {
CHECK_PROTOTYPE_OPCODE(reftypes); this->detected_->Add(kFeature_reftypes);
IndexImmediate<validate> imm(this, this->pc_ + 1, "function index"); IndexImmediate<validate> imm(this, this->pc_ + 1, "function index");
if (!this->ValidateFunction(this->pc_ + 1, imm)) return 0; if (!this->ValidateFunction(this->pc_ + 1, imm)) return 0;
HeapType heap_type(this->enabled_.has_typed_funcref() HeapType heap_type(this->enabled_.has_typed_funcref()
...@@ -3221,7 +3198,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -3221,7 +3198,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
} }
DECODE(TableGet) { DECODE(TableGet) {
CHECK_PROTOTYPE_OPCODE(reftypes); this->detected_->Add(kFeature_reftypes);
IndexImmediate<validate> imm(this, this->pc_ + 1, "table index"); IndexImmediate<validate> imm(this, this->pc_ + 1, "table index");
if (!this->ValidateTable(this->pc_ + 1, imm)) return 0; if (!this->ValidateTable(this->pc_ + 1, imm)) return 0;
Value index = Peek(0, 0, kWasmI32); Value index = Peek(0, 0, kWasmI32);
...@@ -3233,7 +3210,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -3233,7 +3210,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
} }
DECODE(TableSet) { DECODE(TableSet) {
CHECK_PROTOTYPE_OPCODE(reftypes); this->detected_->Add(kFeature_reftypes);
IndexImmediate<validate> imm(this, this->pc_ + 1, "table index"); IndexImmediate<validate> imm(this, this->pc_ + 1, "table index");
if (!this->ValidateTable(this->pc_ + 1, imm)) return 0; if (!this->ValidateTable(this->pc_ + 1, imm)) return 0;
Value value = Peek(0, 1, this->module_->tables[imm.index].type); Value value = Peek(0, 1, this->module_->tables[imm.index].type);
...@@ -3419,7 +3396,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> { ...@@ -3419,7 +3396,7 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
this->pc_, &opcode_length, "numeric index"); this->pc_, &opcode_length, "numeric index");
if (full_opcode == kExprTableGrow || full_opcode == kExprTableSize || if (full_opcode == kExprTableGrow || full_opcode == kExprTableSize ||
full_opcode == kExprTableFill) { full_opcode == kExprTableFill) {
CHECK_PROTOTYPE_OPCODE(reftypes); this->detected_->Add(kFeature_reftypes);
} }
trace_msg->AppendOpcode(full_opcode); trace_msg->AppendOpcode(full_opcode);
return DecodeNumericOpcode(full_opcode, opcode_length); return DecodeNumericOpcode(full_opcode, opcode_length);
......
...@@ -722,7 +722,6 @@ class ModuleDecoderImpl : public Decoder { ...@@ -722,7 +722,6 @@ class ModuleDecoderImpl : public Decoder {
} }
case kExternalTable: { case kExternalTable: {
// ===== Imported table ============================================== // ===== Imported table ==============================================
if (!AddTable(module_.get())) break;
import->index = static_cast<uint32_t>(module_->tables.size()); import->index = static_cast<uint32_t>(module_->tables.size());
module_->num_imported_tables++; module_->num_imported_tables++;
module_->tables.emplace_back(); module_->tables.emplace_back();
...@@ -818,14 +817,9 @@ class ModuleDecoderImpl : public Decoder { ...@@ -818,14 +817,9 @@ class ModuleDecoderImpl : public Decoder {
} }
void DecodeTableSection() { void DecodeTableSection() {
// TODO(ahaas): Set the correct limit to {kV8MaxWasmTables} once the uint32_t table_count = consume_count("table count", kV8MaxWasmTables);
// implementation of ExternRef landed.
uint32_t max_count =
enabled_features_.has_reftypes() ? 100000 : kV8MaxWasmTables;
uint32_t table_count = consume_count("table count", max_count);
for (uint32_t i = 0; ok() && i < table_count; i++) { for (uint32_t i = 0; ok() && i < table_count; i++) {
if (!AddTable(module_.get())) break;
module_->tables.emplace_back(); module_->tables.emplace_back();
WasmTable* table = &module_->tables.back(); WasmTable* table = &module_->tables.back();
const byte* type_position = pc(); const byte* type_position = pc();
...@@ -1536,16 +1530,6 @@ class ModuleDecoderImpl : public Decoder { ...@@ -1536,16 +1530,6 @@ class ModuleDecoderImpl : public Decoder {
return static_cast<uint32_t>(ptr - start_) + buffer_offset_; 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) { bool AddMemory(WasmModule* module) {
if (module->has_memory) { if (module->has_memory) {
error("At most one memory is supported"); error("At most one memory is supported");
...@@ -1854,27 +1838,13 @@ class ModuleDecoderImpl : public Decoder { ...@@ -1854,27 +1838,13 @@ class ModuleDecoderImpl : public Decoder {
} }
// Reads a reference type for tables and element segment headers. // 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() { ValueType consume_reference_type() {
if (!enabled_features_.has_reftypes()) { const byte* position = pc();
uint8_t ref_type = consume_u8("reference type"); ValueType result = consume_value_type();
if (ref_type != kFuncRefCode) { if (!result.is_reference()) {
error(pc_ - 1, error(position, "expected reference type");
"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;
} }
return result;
} }
const FunctionSig* consume_sig(Zone* zone) { const FunctionSig* consume_sig(Zone* zone) {
...@@ -1969,12 +1939,6 @@ class ModuleDecoderImpl : public Decoder { ...@@ -1969,12 +1939,6 @@ class ModuleDecoderImpl : public Decoder {
? WasmElemSegment::kStatusDeclarative ? WasmElemSegment::kStatusDeclarative
: WasmElemSegment::kStatusPassive : WasmElemSegment::kStatusPassive
: WasmElemSegment::kStatusActive; : 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; const bool is_active = status == WasmElemSegment::kStatusActive;
*expressions_as_elements = flag & kExpressionsAsElementsMask; *expressions_as_elements = flag & kExpressionsAsElementsMask;
...@@ -2093,9 +2057,8 @@ class ModuleDecoderImpl : public Decoder { ...@@ -2093,9 +2057,8 @@ class ModuleDecoderImpl : public Decoder {
return index; return index;
} }
// TODO(manoskouk): When reftypes lands, consider if we can implement this // TODO(manoskouk): Implement this with consume_init_expr(). It will require
// with consume_init_expr(). It will require changes in module-instantiate.cc, // changes in module-instantiate.cc, in {LoadElemSegmentImpl}.
// in {LoadElemSegmentImpl}.
WasmElemSegment::Entry consume_element_expr() { WasmElemSegment::Entry consume_element_expr() {
uint8_t opcode = consume_u8("element opcode"); uint8_t opcode = consume_u8("element opcode");
if (failed()) return {}; if (failed()) return {};
...@@ -2115,13 +2078,6 @@ class ModuleDecoderImpl : public Decoder { ...@@ -2115,13 +2078,6 @@ class ModuleDecoderImpl : public Decoder {
return {WasmElemSegment::Entry::kRefFuncEntry, index}; return {WasmElemSegment::Entry::kRefFuncEntry, index};
} }
case kExprGlobalGet: { 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"); uint32_t index = this->consume_u32v("global index");
if (failed()) return {}; if (failed()) return {};
if (index >= module_->globals.size()) { if (index >= module_->globals.size()) {
......
...@@ -24,7 +24,7 @@ constexpr uint32_t kWasmVersion = 0x01; ...@@ -24,7 +24,7 @@ constexpr uint32_t kWasmVersion = 0x01;
// Binary encoding of value and heap types. // Binary encoding of value and heap types.
enum ValueTypeCode : uint8_t { enum ValueTypeCode : uint8_t {
// Current wasm types // Current value types
kVoidCode = 0x40, kVoidCode = 0x40,
kI32Code = 0x7f, kI32Code = 0x7f,
kI64Code = 0x7e, kI64Code = 0x7e,
...@@ -32,11 +32,13 @@ enum ValueTypeCode : uint8_t { ...@@ -32,11 +32,13 @@ enum ValueTypeCode : uint8_t {
kF64Code = 0x7c, kF64Code = 0x7c,
// Simd proposal // Simd proposal
kS128Code = 0x7b, kS128Code = 0x7b,
// reftypes, typed-funcref, and GC proposals // GC proposal packed types
kI8Code = 0x7a, kI8Code = 0x7a,
kI16Code = 0x79, kI16Code = 0x79,
// Current reference types
kFuncRefCode = 0x70, kFuncRefCode = 0x70,
kExternRefCode = 0x6f, kExternRefCode = 0x6f,
// typed-funcref and GC proposal types
kAnyRefCode = 0x6e, kAnyRefCode = 0x6e,
kEqRefCode = 0x6d, kEqRefCode = 0x6d,
kOptRefCode = 0x6c, kOptRefCode = 0x6c,
......
...@@ -98,13 +98,6 @@ ...@@ -98,13 +98,6 @@
/* Shipped in v9.1 * */ \ /* Shipped in v9.1 * */ \
V(simd, "SIMD opcodes", true) \ 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. */ \ /* Threads proposal. */ \
/* https://github.com/webassembly/threads */ \ /* https://github.com/webassembly/threads */ \
/* NOTE: This is enabled via chromium flag on desktop systems since v7.4, */ \ /* NOTE: This is enabled via chromium flag on desktop systems since v7.4, */ \
......
...@@ -16,8 +16,11 @@ WasmFeatures WasmFeatures::FromFlags() { ...@@ -16,8 +16,11 @@ WasmFeatures WasmFeatures::FromFlags() {
WasmFeatures features = WasmFeatures::None(); WasmFeatures features = WasmFeatures::None();
#define FLAG_REF(feat, ...) \ #define FLAG_REF(feat, ...) \
if (FLAG_experimental_wasm_##feat) features.Add(kFeature_##feat); if (FLAG_experimental_wasm_##feat) features.Add(kFeature_##feat);
FOREACH_WASM_FEATURE(FLAG_REF) FOREACH_WASM_FEATURE_FLAG(FLAG_REF)
#undef 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; return features;
} }
......
...@@ -14,8 +14,14 @@ ...@@ -14,8 +14,14 @@
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/wasm/wasm-feature-flags.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. // 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 v8 {
namespace internal { namespace internal {
...@@ -58,6 +64,8 @@ class WasmFeatures : public base::EnumSet<WasmFeature> { ...@@ -58,6 +64,8 @@ class WasmFeatures : public base::EnumSet<WasmFeature> {
static inline constexpr WasmFeatures All(); static inline constexpr WasmFeatures All();
static inline constexpr WasmFeatures None(); static inline constexpr WasmFeatures None();
static inline constexpr WasmFeatures ForAsmjs(); 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 WasmFeatures FromFlags();
static V8_EXPORT_PRIVATE WasmFeatures FromIsolate(Isolate*); static V8_EXPORT_PRIVATE WasmFeatures FromIsolate(Isolate*);
static V8_EXPORT_PRIVATE WasmFeatures FromContext(Isolate*, static V8_EXPORT_PRIVATE WasmFeatures FromContext(Isolate*,
......
...@@ -1158,8 +1158,7 @@ void WebAssemblyTable(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -1158,8 +1158,7 @@ void WebAssemblyTable(const v8::FunctionCallbackInfo<v8::Value>& args) {
// With the type reflection proposal, "funcref" replaces "anyfunc", // With the type reflection proposal, "funcref" replaces "anyfunc",
// and anyfunc just becomes an alias for "funcref". // and anyfunc just becomes an alias for "funcref".
type = i::wasm::kWasmFuncRef; type = i::wasm::kWasmFuncRef;
} else if (enabled_features.has_reftypes() && } else if (string->StringEquals(v8_str(isolate, "externref"))) {
string->StringEquals(v8_str(isolate, "externref"))) {
type = i::wasm::kWasmExternRef; type = i::wasm::kWasmExternRef;
} else { } else {
thrower.TypeError( thrower.TypeError(
...@@ -1331,16 +1330,14 @@ bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe, ...@@ -1331,16 +1330,14 @@ bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
*type = i::wasm::kWasmI64; *type = i::wasm::kWasmI64;
} else if (string->StringEquals(v8_str(isolate, "f64"))) { } else if (string->StringEquals(v8_str(isolate, "f64"))) {
*type = i::wasm::kWasmF64; *type = i::wasm::kWasmF64;
} else if (enabled_features.has_reftypes() && } else if (string->StringEquals(v8_str(isolate, "externref"))) {
string->StringEquals(v8_str(isolate, "externref"))) {
*type = i::wasm::kWasmExternRef; *type = i::wasm::kWasmExternRef;
} else if (enabled_features.has_type_reflection() && } else if (enabled_features.has_type_reflection() &&
string->StringEquals(v8_str(isolate, "funcref"))) { string->StringEquals(v8_str(isolate, "funcref"))) {
// The type reflection proposal renames "anyfunc" to "funcref", and makes // The type reflection proposal renames "anyfunc" to "funcref", and makes
// "anyfunc" an alias of "funcref". // "anyfunc" an alias of "funcref".
*type = i::wasm::kWasmFuncRef; *type = i::wasm::kWasmFuncRef;
} else if (enabled_features.has_reftypes() && } else if (string->StringEquals(v8_str(isolate, "anyfunc"))) {
string->StringEquals(v8_str(isolate, "anyfunc"))) {
// The JS api spec uses 'anyfunc' instead of 'funcref'. // The JS api spec uses 'anyfunc' instead of 'funcref'.
*type = i::wasm::kWasmFuncRef; *type = i::wasm::kWasmFuncRef;
} else if (enabled_features.has_gc() && } else if (enabled_features.has_gc() &&
......
...@@ -52,7 +52,7 @@ constexpr size_t kV8MaxWasmFunctionBrTableSize = 65520; ...@@ -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. // Don't use this limit directly, but use the value of FLAG_wasm_max_table_size.
constexpr size_t kV8MaxWasmTableSize = 10000000; constexpr size_t kV8MaxWasmTableSize = 10000000;
constexpr size_t kV8MaxWasmTableInitEntries = 10000000; constexpr size_t kV8MaxWasmTableInitEntries = 10000000;
constexpr size_t kV8MaxWasmTables = 1; constexpr size_t kV8MaxWasmTables = 100000;
constexpr size_t kV8MaxWasmMemories = 1; constexpr size_t kV8MaxWasmMemories = 1;
// GC proposal. These limits are not standardized yet. // GC proposal. These limits are not standardized yet.
......
...@@ -785,59 +785,40 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer* buffer) const { ...@@ -785,59 +785,40 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer* buffer) const {
buffer->write_size(element_segments_.size()); buffer->write_size(element_segments_.size());
for (const WasmElemSegment& segment : element_segments_) { for (const WasmElemSegment& segment : element_segments_) {
bool is_active = segment.status == WasmElemSegment::kStatusActive; bool is_active = segment.status == WasmElemSegment::kStatusActive;
// If this segment is expressible in the backwards-compatible syntax // We pick the most general syntax, i.e., we always explicitly emit the
// (before reftypes proposal), we should emit it in that syntax. // table index and the type, and use the expressions-as-elements syntax.
// This is the case if the segment is active and all entries are function // The initial byte is one of 0x05, 0x06, and 0x07.
// references. Note that this is currently the only path that allows uint8_t kind_mask =
// kRelativeToImports function indexing mode. segment.status == WasmElemSegment::kStatusActive
// TODO(manoskouk): Remove this logic once reftypes has shipped. ? 0b10
bool backwards_compatible = : segment.status == WasmElemSegment::kStatusDeclarative ? 0b11
is_active && segment.table_index == 0 && : 0b01;
std::all_of( uint8_t expressions_as_elements_mask = 0b100;
segment.entries.begin(), segment.entries.end(), [](auto& entry) { buffer->write_u8(kind_mask | expressions_as_elements_mask);
return entry.kind == if (is_active) {
WasmModuleBuilder::WasmElemSegment::Entry::kRefFuncEntry; buffer->write_u32v(segment.table_index);
});
if (backwards_compatible) {
buffer->write_u8(0);
WriteInitializerExpression(buffer, segment.offset, segment.type); WriteInitializerExpression(buffer, segment.offset, segment.type);
buffer->write_size(segment.entries.size()); }
for (const WasmElemSegment::Entry entry : segment.entries) { WriteValueType(buffer, segment.type);
buffer->write_u32v( buffer->write_size(segment.entries.size());
segment.indexing_mode == WasmElemSegment::kRelativeToImports for (const WasmElemSegment::Entry entry : segment.entries) {
? entry.index uint8_t opcode =
: entry.index + entry.kind == WasmElemSegment::Entry::kGlobalGetEntry
static_cast<uint32_t>(function_imports_.size())); ? kExprGlobalGet
} : entry.kind == WasmElemSegment::Entry::kRefFuncEntry
} else { ? kExprRefFunc
DCHECK_EQ(segment.indexing_mode, WasmElemSegment::kRelativeToImports); : kExprRefNull;
// If we pick the general syntax, we always explicitly emit the table bool needs_function_offset =
// index and the type, and use the expressions-as-elements syntax. I.e. segment.indexing_mode ==
// the initial byte is one of 0x05, 0x06, and 0x07. WasmElemSegment::kRelativeToDeclaredFunctions &&
uint8_t kind_mask = entry.kind == WasmElemSegment::Entry::kRefFuncEntry;
segment.status == WasmElemSegment::kStatusActive uint32_t index =
? 0b10 entry.index + (needs_function_offset
: segment.status == WasmElemSegment::kStatusDeclarative ? 0b11 ? static_cast<uint32_t>(function_imports_.size())
: 0b01; : 0);
uint8_t expressions_as_elements_mask = 0b100; buffer->write_u8(opcode);
buffer->write_u8(kind_mask | expressions_as_elements_mask); buffer->write_u32v(index);
if (is_active) { buffer->write_u8(kExprEnd);
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);
}
} }
} }
FixupSection(buffer, start); FixupSection(buffer, start);
......
...@@ -33,7 +33,6 @@ class WasmGCTester { ...@@ -33,7 +33,6 @@ class WasmGCTester {
explicit WasmGCTester( explicit WasmGCTester(
TestExecutionTier execution_tier = TestExecutionTier::kTurbofan) TestExecutionTier execution_tier = TestExecutionTier::kTurbofan)
: flag_gc(&v8::internal::FLAG_experimental_wasm_gc, true), : 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, flag_typedfuns(&v8::internal::FLAG_experimental_wasm_typed_funcref,
true), true),
flag_liftoff(&v8::internal::FLAG_liftoff, flag_liftoff(&v8::internal::FLAG_liftoff,
...@@ -176,7 +175,6 @@ class WasmGCTester { ...@@ -176,7 +175,6 @@ class WasmGCTester {
private: private:
const FlagScope<bool> flag_gc; const FlagScope<bool> flag_gc;
const FlagScope<bool> flag_reftypes;
const FlagScope<bool> flag_typedfuns; const FlagScope<bool> flag_typedfuns;
const FlagScope<bool> flag_liftoff; const FlagScope<bool> flag_liftoff;
const FlagScope<bool> flag_liftoff_only; const FlagScope<bool> flag_liftoff_only;
......
...@@ -359,17 +359,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom0To0) { ...@@ -359,17 +359,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom0To0) {
} }
WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom3To0) { WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom3To0) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyInbounds(execution_tier, 3, 0); TestTableCopyInbounds(execution_tier, 3, 0);
} }
WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom5To9) { WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom5To9) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyInbounds(execution_tier, 5, 9); TestTableCopyInbounds(execution_tier, 5, 9);
} }
WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom6To6) { WASM_COMPILED_EXEC_TEST(TableCopyInboundsFrom6To6) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyInbounds(execution_tier, 6, 6); TestTableCopyInbounds(execution_tier, 6, 6);
} }
...@@ -466,11 +463,9 @@ WASM_COMPILED_EXEC_TEST(TableInitElems0) { ...@@ -466,11 +463,9 @@ WASM_COMPILED_EXEC_TEST(TableInitElems0) {
TestTableInitElems(execution_tier, 0); TestTableInitElems(execution_tier, 0);
} }
WASM_COMPILED_EXEC_TEST(TableInitElems7) { WASM_COMPILED_EXEC_TEST(TableInitElems7) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableInitElems(execution_tier, 7); TestTableInitElems(execution_tier, 7);
} }
WASM_COMPILED_EXEC_TEST(TableInitElems9) { WASM_COMPILED_EXEC_TEST(TableInitElems9) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableInitElems(execution_tier, 9); TestTableInitElems(execution_tier, 9);
} }
...@@ -543,14 +538,8 @@ void TestTableInitOob(TestExecutionTier execution_tier, int table_index) { ...@@ -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(TableInitOob0) { TestTableInitOob(execution_tier, 0); }
WASM_COMPILED_EXEC_TEST(TableInitOob7) { WASM_COMPILED_EXEC_TEST(TableInitOob7) { TestTableInitOob(execution_tier, 7); }
EXPERIMENTAL_FLAG_SCOPE(reftypes); WASM_COMPILED_EXEC_TEST(TableInitOob9) { TestTableInitOob(execution_tier, 9); }
TestTableInitOob(execution_tier, 7);
}
WASM_COMPILED_EXEC_TEST(TableInitOob9) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableInitOob(execution_tier, 9);
}
void TestTableCopyElems(TestExecutionTier execution_tier, int table_dst, void TestTableCopyElems(TestExecutionTier execution_tier, int table_dst,
int table_src) { int table_src) {
...@@ -619,17 +608,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom0To0) { ...@@ -619,17 +608,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom0To0) {
} }
WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom3To0) { WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom3To0) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyElems(execution_tier, 3, 0); TestTableCopyElems(execution_tier, 3, 0);
} }
WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom5To9) { WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom5To9) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyElems(execution_tier, 5, 9); TestTableCopyElems(execution_tier, 5, 9);
} }
WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom6To6) { WASM_COMPILED_EXEC_TEST(TableCopyElemsFrom6To6) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyElems(execution_tier, 6, 6); TestTableCopyElems(execution_tier, 6, 6);
} }
...@@ -693,17 +679,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyCallsTo0From0) { ...@@ -693,17 +679,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyCallsTo0From0) {
} }
WASM_COMPILED_EXEC_TEST(TableCopyCallsTo3From0) { WASM_COMPILED_EXEC_TEST(TableCopyCallsTo3From0) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyCalls(execution_tier, 3, 0); TestTableCopyCalls(execution_tier, 3, 0);
} }
WASM_COMPILED_EXEC_TEST(TableCopyCallsTo5From9) { WASM_COMPILED_EXEC_TEST(TableCopyCallsTo5From9) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyCalls(execution_tier, 5, 9); TestTableCopyCalls(execution_tier, 5, 9);
} }
WASM_COMPILED_EXEC_TEST(TableCopyCallsTo6From6) { WASM_COMPILED_EXEC_TEST(TableCopyCallsTo6From6) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyCalls(execution_tier, 6, 6); TestTableCopyCalls(execution_tier, 6, 6);
} }
...@@ -768,17 +751,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom0To0) { ...@@ -768,17 +751,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom0To0) {
} }
WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom3To0) { WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom3To0) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyOobWrites(execution_tier, 3, 0); TestTableCopyOobWrites(execution_tier, 3, 0);
} }
WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom5To9) { WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom5To9) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyOobWrites(execution_tier, 5, 9); TestTableCopyOobWrites(execution_tier, 5, 9);
} }
WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom6To6) { WASM_COMPILED_EXEC_TEST(TableCopyOobWritesFrom6To6) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyOobWrites(execution_tier, 6, 6); TestTableCopyOobWrites(execution_tier, 6, 6);
} }
...@@ -826,17 +806,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyOob1From0To0) { ...@@ -826,17 +806,14 @@ WASM_COMPILED_EXEC_TEST(TableCopyOob1From0To0) {
} }
WASM_COMPILED_EXEC_TEST(TableCopyOob1From3To0) { WASM_COMPILED_EXEC_TEST(TableCopyOob1From3To0) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyOob1(execution_tier, 3, 0); TestTableCopyOob1(execution_tier, 3, 0);
} }
WASM_COMPILED_EXEC_TEST(TableCopyOob1From5To9) { WASM_COMPILED_EXEC_TEST(TableCopyOob1From5To9) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyOob1(execution_tier, 5, 9); TestTableCopyOob1(execution_tier, 5, 9);
} }
WASM_COMPILED_EXEC_TEST(TableCopyOob1From6To6) { WASM_COMPILED_EXEC_TEST(TableCopyOob1From6To6) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
TestTableCopyOob1(execution_tier, 6, 6); TestTableCopyOob1(execution_tier, 6, 6);
} }
......
...@@ -565,7 +565,6 @@ WASM_EXEC_TEST(TryCatchTrapRemByZero) { ...@@ -565,7 +565,6 @@ WASM_EXEC_TEST(TryCatchTrapRemByZero) {
} }
WASM_EXEC_TEST(TryCatchTrapTableFill) { WASM_EXEC_TEST(TryCatchTrapTableFill) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
int table_index = 0; int table_index = 0;
int length = 10; // OOB. int length = 10; // OOB.
int start = 10; // OOB. int start = 10; // OOB.
......
...@@ -801,7 +801,6 @@ WASM_EXEC_TEST(Select_s128_parameters) { ...@@ -801,7 +801,6 @@ WASM_EXEC_TEST(Select_s128_parameters) {
} }
WASM_EXEC_TEST(SelectWithType_float_parameters) { WASM_EXEC_TEST(SelectWithType_float_parameters) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
WasmRunner<float, float, float, int32_t> r(execution_tier); WasmRunner<float, float, float, int32_t> r(execution_tier);
BUILD(r, BUILD(r,
WASM_SELECT_F(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2))); WASM_SELECT_F(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)));
...@@ -819,7 +818,6 @@ WASM_EXEC_TEST(Select) { ...@@ -819,7 +818,6 @@ WASM_EXEC_TEST(Select) {
} }
WASM_EXEC_TEST(SelectWithType) { WASM_EXEC_TEST(SelectWithType) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
// return select(11, 22, a); // return select(11, 22, a);
BUILD(r, WASM_SELECT_I(WASM_I32V_1(11), WASM_I32V_1(22), WASM_LOCAL_GET(0))); 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) { ...@@ -841,7 +839,6 @@ WASM_EXEC_TEST(Select_strict1) {
} }
WASM_EXEC_TEST(SelectWithType_strict1) { WASM_EXEC_TEST(SelectWithType_strict1) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
// select(a=0, a=1, a=2); return a // select(a=0, a=1, a=2); return a
BUILD(r, BUILD(r,
...@@ -866,7 +863,6 @@ WASM_EXEC_TEST(Select_strict2) { ...@@ -866,7 +863,6 @@ WASM_EXEC_TEST(Select_strict2) {
} }
WASM_EXEC_TEST(SelectWithType_strict2) { WASM_EXEC_TEST(SelectWithType_strict2) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmI32);
...@@ -894,7 +890,6 @@ WASM_EXEC_TEST(Select_strict3) { ...@@ -894,7 +890,6 @@ WASM_EXEC_TEST(Select_strict3) {
} }
WASM_EXEC_TEST(SelectWithType_strict3) { WASM_EXEC_TEST(SelectWithType_strict3) {
EXPERIMENTAL_FLAG_SCOPE(reftypes);
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmI32);
......
...@@ -2581,7 +2581,6 @@ class WasmCompileFuzzer : public WasmExecutionFuzzer { ...@@ -2581,7 +2581,6 @@ class WasmCompileFuzzer : public WasmExecutionFuzzer {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
constexpr bool require_valid = true; constexpr bool require_valid = true;
EXPERIMENTAL_FLAG_SCOPE(reftypes);
EXPERIMENTAL_FLAG_SCOPE(typed_funcref); EXPERIMENTAL_FLAG_SCOPE(typed_funcref);
EXPERIMENTAL_FLAG_SCOPE(gc); EXPERIMENTAL_FLAG_SCOPE(gc);
EXPERIMENTAL_FLAG_SCOPE(simd); EXPERIMENTAL_FLAG_SCOPE(simd);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-reftypes
utils.load('test/inspector/wasm-inspector-test.js'); utils.load('test/inspector/wasm-inspector-test.js');
let {session, contextGroup, Protocol} = let {session, contextGroup, Protocol} =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-reftypes --expose-gc // Flags: --expose-gc
utils.load('test/inspector/wasm-inspector-test.js'); utils.load('test/inspector/wasm-inspector-test.js');
let {session, contextGroup, Protocol} = let {session, contextGroup, Protocol} =
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --liftoff --no-wasm-tier-up --wasm-tier-mask-for-testing=2 // 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'); d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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'); d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// The test needs --wasm-tier-up because we can't serialize and deserialize // The test needs --wasm-tier-up because we can't serialize and deserialize
// Liftoff code. // 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"); d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-reftypes // Flags: --expose-wasm
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js'); d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-reftypes --experimental-wasm-typed-funcref // Flags: --experimental-wasm-typed-funcref
let raw = new Uint8Array([ let raw = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, // wasm magic 0x00, 0x61, 0x73, 0x6d, // wasm magic
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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'); d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-eh --experimental-wasm-reftypes // Flags: --experimental-wasm-eh
load("test/mjsunit/wasm/wasm-module-builder.js"); load("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/wasm-module-builder.js");
d8.file.execute("test/mjsunit/wasm/exceptions-utils.js"); d8.file.execute("test/mjsunit/wasm/exceptions-utils.js");
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-reftypes --expose-gc --liftoff // Flags: --expose-gc --liftoff --no-wasm-tier-up
// Flags: --no-wasm-tier-up --experimental-liftoff-extern-ref
d8.file.execute("test/mjsunit/wasm/externref-globals.js"); d8.file.execute("test/mjsunit/wasm/externref-globals.js");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-reftypes --expose-gc // Flags: --expose-gc
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-reftypes --expose-gc --liftoff // Flags: --expose-wasm --expose-gc --liftoff --no-wasm-tier-up
// Flags: --no-wasm-tier-up --experimental-liftoff-extern-ref
// Flags: --allow-natives-syntax // Flags: --allow-natives-syntax
d8.file.execute("test/mjsunit/wasm/externref.js"); d8.file.execute("test/mjsunit/wasm/externref.js");
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-reftypes --expose-gc // Flags: --expose-wasm --expose-gc --allow-natives-syntax
// Flags: --allow-natives-syntax
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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"); d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-reftypes // Flags: --expose-wasm
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-reftypes --liftoff // Flags: --liftoff --no-wasm-tier-up
// Flags: --no-wasm-tier-up --liftoff-extern-ref
d8.file.execute("test/mjsunit/wasm/table-access.js"); d8.file.execute("test/mjsunit/wasm/table-access.js");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-reftypes // Flags: --expose-wasm
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --experimental-wasm-reftypes
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js'); d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
let kTableSize = 5; let kTableSize = 5;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-reftypes // Flags: --expose-wasm
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js'); d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-reftypes // Flags: --expose-wasm
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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'); d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
...@@ -79,9 +79,6 @@ 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()); 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() { (function TestFunctionMultiTableSetAndCall() {
let builder = new WasmModuleBuilder(); let builder = new WasmModuleBuilder();
let v1 = 7; let v2 = 9; let v3 = 0.0; let v1 = 7; let v2 = 9; let v3 = 0.0;
......
...@@ -528,29 +528,6 @@ d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js'); ...@@ -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() { (function TestFunctionTableSetI64() {
let builder = new WasmModuleBuilder(); let builder = new WasmModuleBuilder();
let fun = new WebAssembly.Function({parameters:[], results:["i64"]}, _ => 0n); let fun = new WebAssembly.Function({parameters:[], results:["i64"]}, _ => 0n);
......
...@@ -47,7 +47,7 @@ class TestCase(testcase.D8TestCase): ...@@ -47,7 +47,7 @@ class TestCase(testcase.D8TestCase):
for proposal in proposal_flags: for proposal in proposal_flags:
if os.sep.join(['proposals', proposal['name']]) in self.path: if os.sep.join(['proposals', proposal['name']]) in self.path:
return proposal['flags'] return proposal['flags']
return ['--experimental-wasm-reftypes'] return []
def GetSuite(*args, **kwargs): def GetSuite(*args, **kwargs):
......
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