Commit 48ae9bb6 authored by Matthias Liedtke's avatar Matthias Liedtke Committed by V8 LUCI CQ

[wasm-gc] Remove obsolete RTT statements from internal processing

This is a follow up to Iadf73c294904ec20cefe1053a2969aa1dbb91a39.

Bug: v8:7748
Change-Id: I59390b8c82c4ebed58f2d3130cd9b1578bffdd4b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780535
Commit-Queue: Matthias Liedtke <mliedtke@google.com>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@google.com>
Cr-Commit-Position: refs/heads/main@{#81908}
parent df4cbb4d
......@@ -5207,10 +5207,9 @@ Node* WasmGraphBuilder::DefaultValue(wasm::ValueType type) {
}
}
Node* WasmGraphBuilder::StructNewWithRtt(uint32_t struct_index,
const wasm::StructType* type,
Node* rtt,
base::Vector<Node*> fields) {
Node* WasmGraphBuilder::StructNew(uint32_t struct_index,
const wasm::StructType* type, Node* rtt,
base::Vector<Node*> fields) {
int size = WasmStruct::Size(type);
Node* s = gasm_->Allocate(size);
gasm_->StoreMap(s, rtt);
......@@ -5229,11 +5228,10 @@ Node* WasmGraphBuilder::StructNewWithRtt(uint32_t struct_index,
return s;
}
Node* WasmGraphBuilder::ArrayNewWithRtt(uint32_t array_index,
const wasm::ArrayType* type,
Node* length, Node* initial_value,
Node* rtt,
wasm::WasmCodePosition position) {
Node* WasmGraphBuilder::ArrayNew(uint32_t array_index,
const wasm::ArrayType* type, Node* length,
Node* initial_value, Node* rtt,
wasm::WasmCodePosition position) {
TrapIfFalse(wasm::kTrapArrayTooLarge,
gasm_->Uint32LessThanOrEqual(
length, gasm_->Uint32Constant(WasmArray::MaxLength(type))),
......@@ -5267,7 +5265,7 @@ Node* WasmGraphBuilder::ArrayNewWithRtt(uint32_t array_index,
// size limit was determined by running array-copy-benchmark.js.
auto done = gasm_->MakeLabel();
// TODO(manoskouk): If the loop is ever removed here, we have to update
// ArrayNewWithRtt() in graph-builder-interface.cc to not mark the current
// ArrayNew() in graph-builder-interface.cc to not mark the current
// loop as non-innermost.
auto loop = gasm_->MakeLoopLabel(MachineRepresentation::kWord32);
Node* start_offset = gasm_->IntPtrConstant(
......
......@@ -474,17 +474,17 @@ class WasmGraphBuilder {
Node* TableSize(uint32_t table_index);
void TableFill(uint32_t table_index, Node* start, Node* value, Node* count);
Node* StructNewWithRtt(uint32_t struct_index, const wasm::StructType* type,
Node* rtt, base::Vector<Node*> fields);
Node* StructNew(uint32_t struct_index, const wasm::StructType* type,
Node* rtt, base::Vector<Node*> fields);
Node* StructGet(Node* struct_object, const wasm::StructType* struct_type,
uint32_t field_index, CheckForNull null_check, bool is_signed,
wasm::WasmCodePosition position);
void StructSet(Node* struct_object, const wasm::StructType* struct_type,
uint32_t field_index, Node* value, CheckForNull null_check,
wasm::WasmCodePosition position);
Node* ArrayNewWithRtt(uint32_t array_index, const wasm::ArrayType* type,
Node* length, Node* initial_value, Node* rtt,
wasm::WasmCodePosition position);
Node* ArrayNew(uint32_t array_index, const wasm::ArrayType* type,
Node* length, Node* initial_value, Node* rtt,
wasm::WasmCodePosition position);
Node* ArrayGet(Node* array_object, const wasm::ArrayType* type, Node* index,
CheckForNull null_check, bool is_signed,
wasm::WasmCodePosition position);
......
......@@ -5454,9 +5454,9 @@ class LiftoffCompiler {
__ PushRegister(kRef, obj);
}
void StructNewWithRtt(FullDecoder* decoder,
const StructIndexImmediate<validate>& imm,
const Value& rtt, const Value args[], Value* result) {
void StructNew(FullDecoder* decoder,
const StructIndexImmediate<validate>& imm, const Value& rtt,
const Value args[], Value* result) {
StructNew(decoder, imm, rtt, true);
}
......@@ -5573,10 +5573,9 @@ class LiftoffCompiler {
__ PushRegister(kRef, obj);
}
void ArrayNewWithRtt(FullDecoder* decoder,
const ArrayIndexImmediate<validate>& imm,
const Value& length_value, const Value& initial_value,
const Value& rtt, Value* result) {
void ArrayNew(FullDecoder* decoder, const ArrayIndexImmediate<validate>& imm,
const Value& length_value, const Value& initial_value,
const Value& rtt, Value* result) {
ArrayNew(decoder, imm, rtt.type.kind(), true);
}
......
......@@ -117,7 +117,7 @@ void ConstantExpressionInterface::GlobalGet(
global.type);
}
void ConstantExpressionInterface::StructNewWithRtt(
void ConstantExpressionInterface::StructNew(
FullDecoder* decoder, const StructIndexImmediate<validate>& imm,
const Value& rtt, const Value args[], Value* result) {
if (!generate_value()) return;
......@@ -195,7 +195,7 @@ void ConstantExpressionInterface::StructNewDefault(
ValueType::Ref(imm.index));
}
void ConstantExpressionInterface::ArrayNewWithRtt(
void ConstantExpressionInterface::ArrayNew(
FullDecoder* decoder, const ArrayIndexImmediate<validate>& imm,
const Value& length, const Value& initial_value, const Value& rtt,
Value* result) {
......@@ -220,7 +220,7 @@ void ConstantExpressionInterface::ArrayNewDefault(
Value initial_value(decoder->pc(), imm.array_type->element_type());
initial_value.runtime_value =
DefaultValueForType(imm.array_type->element_type(), isolate_);
return ArrayNewWithRtt(decoder, imm, length, initial_value, rtt, result);
return ArrayNew(decoder, imm, length, initial_value, rtt, result);
}
void ConstantExpressionInterface::ArrayNewFixed(
......
......@@ -1006,13 +1006,12 @@ struct ControlBase : public PcForErrors<validate> {
Value* result) \
F(RefNull, ValueType type, Value* result) \
F(RefFunc, uint32_t function_index, Value* result) \
F(StructNewWithRtt, const StructIndexImmediate<validate>& imm, \
const Value& rtt, const Value args[], Value* result) \
F(StructNew, const StructIndexImmediate<validate>& imm, const Value& rtt, \
const Value args[], Value* result) \
F(StructNewDefault, const StructIndexImmediate<validate>& imm, \
const Value& rtt, Value* result) \
F(ArrayNewWithRtt, const ArrayIndexImmediate<validate>& imm, \
const Value& length, const Value& initial_value, const Value& rtt, \
Value* result) \
F(ArrayNew, const ArrayIndexImmediate<validate>& imm, const Value& length, \
const Value& initial_value, const Value& rtt, Value* result) \
F(ArrayNewDefault, const ArrayIndexImmediate<validate>& imm, \
const Value& length, const Value& rtt, Value* result) \
F(ArrayNewFixed, const ArrayIndexImmediate<validate>& imm, \
......@@ -4314,8 +4313,8 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
Push(rtt);
ArgVector args = PeekArgs(imm.struct_type, 1);
Value value = CreateValue(ValueType::Ref(imm.index));
CALL_INTERFACE_IF_OK_AND_REACHABLE(StructNewWithRtt, imm, rtt,
args.begin(), &value);
CALL_INTERFACE_IF_OK_AND_REACHABLE(StructNew, imm, rtt, args.begin(),
&value);
Drop(rtt);
DropArgs(imm.struct_type);
Push(value);
......@@ -4423,8 +4422,8 @@ class WasmFullDecoder : public WasmDecoder<validate, decoding_mode> {
Value initial_value =
Peek(2, 0, imm.array_type->element_type().Unpacked());
Value value = CreateValue(ValueType::Ref(imm.index));
CALL_INTERFACE_IF_OK_AND_REACHABLE(ArrayNewWithRtt, imm, length,
initial_value, rtt, &value);
CALL_INTERFACE_IF_OK_AND_REACHABLE(ArrayNew, imm, length, initial_value,
rtt, &value);
Drop(3); // rtt, length, initial_value.
Push(value);
return opcode_length + imm.length;
......
......@@ -1073,17 +1073,17 @@ class WasmGraphBuildingInterface {
builder_->TableFill(imm.index, start.node, value.node, count.node);
}
void StructNewWithRtt(FullDecoder* decoder,
const StructIndexImmediate<validate>& imm,
const Value& rtt, const Value args[], Value* result) {
void StructNew(FullDecoder* decoder,
const StructIndexImmediate<validate>& imm, const Value& rtt,
const Value args[], Value* result) {
uint32_t field_count = imm.struct_type->field_count();
NodeVector arg_nodes(field_count);
for (uint32_t i = 0; i < field_count; i++) {
arg_nodes[i] = args[i].node;
}
SetAndTypeNode(
result, builder_->StructNewWithRtt(imm.index, imm.struct_type, rtt.node,
base::VectorOf(arg_nodes)));
SetAndTypeNode(result,
builder_->StructNew(imm.index, imm.struct_type, rtt.node,
base::VectorOf(arg_nodes)));
}
void StructNewDefault(FullDecoder* decoder,
const StructIndexImmediate<validate>& imm,
......@@ -1095,9 +1095,9 @@ class WasmGraphBuildingInterface {
arg_nodes[i] = builder_->SetType(builder_->DefaultValue(field_type),
field_type.Unpacked());
}
SetAndTypeNode(
result, builder_->StructNewWithRtt(imm.index, imm.struct_type, rtt.node,
base::VectorOf(arg_nodes)));
SetAndTypeNode(result,
builder_->StructNew(imm.index, imm.struct_type, rtt.node,
base::VectorOf(arg_nodes)));
}
void StructGet(FullDecoder* decoder, const Value& struct_object,
......@@ -1118,14 +1118,12 @@ class WasmGraphBuildingInterface {
NullCheckFor(struct_object.type), decoder->position());
}
void ArrayNewWithRtt(FullDecoder* decoder,
const ArrayIndexImmediate<validate>& imm,
const Value& length, const Value& initial_value,
const Value& rtt, Value* result) {
SetAndTypeNode(result,
builder_->ArrayNewWithRtt(imm.index, imm.array_type,
length.node, initial_value.node,
rtt.node, decoder->position()));
void ArrayNew(FullDecoder* decoder, const ArrayIndexImmediate<validate>& imm,
const Value& length, const Value& initial_value,
const Value& rtt, Value* result) {
SetAndTypeNode(result, builder_->ArrayNew(imm.index, imm.array_type,
length.node, initial_value.node,
rtt.node, decoder->position()));
// array.new_with_rtt introduces a loop. Therefore, we have to mark the
// immediately nesting loop (if any) as non-innermost.
if (!loop_infos_.empty()) loop_infos_.back().can_be_innermost = false;
......@@ -1136,9 +1134,9 @@ class WasmGraphBuildingInterface {
const Value& length, const Value& rtt, Value* result) {
// This will be set in {builder_}.
TFNode* initial_value = nullptr;
SetAndTypeNode(result, builder_->ArrayNewWithRtt(
imm.index, imm.array_type, length.node,
initial_value, rtt.node, decoder->position()));
SetAndTypeNode(result, builder_->ArrayNew(imm.index, imm.array_type,
length.node, initial_value,
rtt.node, decoder->position()));
}
void ArrayGet(FullDecoder* decoder, const Value& array_obj,
......
......@@ -38,17 +38,12 @@ ValueType WasmInitExpr::type(const WasmModule* module,
}
case kRefNullConst:
return ValueType::RefNull(immediate().heap_type);
case kStructNewWithRtt:
case kStructNew:
case kStructNewDefaultWithRtt:
case kStructNewDefault:
case kArrayNewFixed:
case kArrayNewFixedStatic:
return ValueType::Ref(immediate().index);
case kI31New:
return kWasmI31Ref.AsNonNull();
case kRttCanon:
return ValueType::Rtt(immediate().heap_type);
case kStringConst:
return ValueType::Ref(HeapType::kString);
}
......
......@@ -36,14 +36,10 @@ class WasmInitExpr : public ZoneObject {
kS128Const,
kRefNullConst,
kRefFuncConst,
kStructNewWithRtt,
kStructNew,
kStructNewDefaultWithRtt,
kStructNewDefault,
kArrayNewFixed,
kArrayNewFixedStatic,
kI31New,
kRttCanon,
kStringConst,
};
......@@ -98,13 +94,6 @@ class WasmInitExpr : public ZoneObject {
return expr;
}
static WasmInitExpr StructNewWithRtt(uint32_t index,
ZoneVector<WasmInitExpr>* elements) {
WasmInitExpr expr(kStructNewWithRtt, elements);
expr.immediate_.index = index;
return expr;
}
static WasmInitExpr StructNew(uint32_t index,
ZoneVector<WasmInitExpr>* elements) {
WasmInitExpr expr(kStructNew, elements);
......@@ -112,15 +101,6 @@ class WasmInitExpr : public ZoneObject {
return expr;
}
static WasmInitExpr StructNewDefaultWithRtt(Zone* zone, uint32_t index,
WasmInitExpr rtt) {
WasmInitExpr expr(kStructNewDefaultWithRtt,
zone->New<ZoneVector<WasmInitExpr>>(
std::initializer_list<WasmInitExpr>{rtt}, zone));
expr.immediate_.index = index;
return expr;
}
static WasmInitExpr StructNewDefault(uint32_t index) {
WasmInitExpr expr;
expr.kind_ = kStructNewDefault;
......@@ -128,13 +108,6 @@ class WasmInitExpr : public ZoneObject {
return expr;
}
static WasmInitExpr ArrayNewFixed(uint32_t index,
ZoneVector<WasmInitExpr>* elements) {
WasmInitExpr expr(kArrayNewFixed, elements);
expr.immediate_.index = index;
return expr;
}
static WasmInitExpr ArrayNewFixedStatic(uint32_t index,
ZoneVector<WasmInitExpr>* elements) {
WasmInitExpr expr(kArrayNewFixedStatic, elements);
......@@ -142,13 +115,6 @@ class WasmInitExpr : public ZoneObject {
return expr;
}
static WasmInitExpr RttCanon(uint32_t index) {
WasmInitExpr expr;
expr.kind_ = kRttCanon;
expr.immediate_.index = index;
return expr;
}
static WasmInitExpr I31New(Zone* zone, WasmInitExpr value) {
WasmInitExpr expr(kI31New,
zone->New<ZoneVector<WasmInitExpr>>(
......@@ -174,7 +140,6 @@ class WasmInitExpr : public ZoneObject {
return true;
case kGlobalGet:
case kRefFuncConst:
case kRttCanon:
case kStringConst:
return immediate().index == other.immediate().index;
case kI32Const:
......@@ -189,9 +154,7 @@ class WasmInitExpr : public ZoneObject {
return immediate().s128_const == other.immediate().s128_const;
case kRefNullConst:
return immediate().heap_type == other.immediate().heap_type;
case kStructNewWithRtt:
case kStructNew:
case kStructNewDefaultWithRtt:
case kStructNewDefault:
if (immediate().index != other.immediate().index) return false;
DCHECK_EQ(operands()->size(), other.operands()->size());
......@@ -199,7 +162,6 @@ class WasmInitExpr : public ZoneObject {
if (operands()[i] != other.operands()[i]) return false;
}
return true;
case kArrayNewFixed:
case kArrayNewFixedStatic:
if (immediate().index != other.immediate().index) return false;
if (operands()->size() != other.operands()->size()) return false;
......
......@@ -522,28 +522,18 @@ void WriteInitializerExpressionWithEnd(ZoneBuffer* buffer,
break;
}
case WasmInitExpr::kStructNew:
case WasmInitExpr::kStructNewWithRtt:
case WasmInitExpr::kStructNewDefault:
case WasmInitExpr::kStructNewDefaultWithRtt:
static_assert((kExprStructNew >> 8) == kGCPrefix);
static_assert((kExprStructNewWithRtt >> 8) == kGCPrefix);
static_assert((kExprStructNewDefault >> 8) == kGCPrefix);
static_assert((kExprStructNewDefaultWithRtt >> 8) == kGCPrefix);
for (const WasmInitExpr& operand : *init.operands()) {
WriteInitializerExpressionWithEnd(buffer, operand, kWasmBottom);
}
buffer->write_u8(kGCPrefix);
WasmOpcode opcode;
switch (init.kind()) {
case WasmInitExpr::kStructNewWithRtt:
opcode = kExprStructNewWithRtt;
break;
case WasmInitExpr::kStructNew:
opcode = kExprStructNew;
break;
case WasmInitExpr::kStructNewDefaultWithRtt:
opcode = kExprStructNewDefaultWithRtt;
break;
case WasmInitExpr::kStructNewDefault:
opcode = kExprStructNewDefault;
break;
......@@ -553,20 +543,15 @@ void WriteInitializerExpressionWithEnd(ZoneBuffer* buffer,
buffer->write_u8(static_cast<uint8_t>(opcode));
buffer->write_u32v(init.immediate().index);
break;
case WasmInitExpr::kArrayNewFixed:
case WasmInitExpr::kArrayNewFixedStatic: {
static_assert((kExprArrayNewFixed >> 8) == kGCPrefix);
static_assert((kExprArrayNewFixedStatic >> 8) == kGCPrefix);
bool is_static = init.kind() == WasmInitExpr::kArrayNewFixedStatic;
for (const WasmInitExpr& operand : *init.operands()) {
WriteInitializerExpressionWithEnd(buffer, operand, kWasmBottom);
}
buffer->write_u8(kGCPrefix);
buffer->write_u8(static_cast<uint8_t>(is_static ? kExprArrayNewFixedStatic
: kExprArrayNewFixed));
buffer->write_u8(static_cast<uint8_t>(kExprArrayNewFixedStatic));
buffer->write_u32v(init.immediate().index);
buffer->write_u32v(
static_cast<uint32_t>(init.operands()->size() - (is_static ? 0 : 1)));
buffer->write_u32v(static_cast<uint32_t>(init.operands()->size()));
break;
}
case WasmInitExpr::kI31New:
......@@ -577,12 +562,6 @@ void WriteInitializerExpressionWithEnd(ZoneBuffer* buffer,
buffer->write_u8(kGCPrefix);
buffer->write_u8(static_cast<uint8_t>(kExprI31New));
break;
case WasmInitExpr::kRttCanon:
static_assert((kExprRttCanon >> 8) == kGCPrefix);
buffer->write_u8(kGCPrefix);
buffer->write_u8(static_cast<uint8_t>(kExprRttCanon));
buffer->write_i32v(static_cast<int32_t>(init.immediate().index));
break;
case WasmInitExpr::kStringConst:
buffer->write_u8(kGCPrefix);
......
......@@ -684,16 +684,12 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
V(AtomicFence, 0xfe03, v_v, "atomic.fence")
#define FOREACH_GC_OPCODE(V) /* Force 80 columns */ \
V(StructNewWithRtt, 0xfb01, _, "struct.new_with_rtt") \
V(StructNewDefaultWithRtt, 0xfb02, _, "struct.new_default_with_rtt") \
V(StructGet, 0xfb03, _, "struct.get") \
V(StructGetS, 0xfb04, _, "struct.get_s") \
V(StructGetU, 0xfb05, _, "struct.get_u") \
V(StructSet, 0xfb06, _, "struct.set") \
V(StructNew, 0xfb07, _, "struct.new") \
V(StructNewDefault, 0xfb08, _, "struct.new_default") \
V(ArrayNewWithRtt, 0xfb11, _, "array.new_with_rtt") \
V(ArrayNewDefaultWithRtt, 0xfb12, _, "array.new_default_with_rtt") \
V(ArrayGet, 0xfb13, _, "array.get") \
V(ArrayGetS, 0xfb14, _, "array.get_s") \
V(ArrayGetU, 0xfb15, _, "array.get_u") \
......@@ -701,21 +697,14 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
V(ArrayLen, 0xfb17, _, "array.len") \
V(ArrayCopy, 0xfb18, _, \
"array.copy") /* not standardized - V8 experimental */ \
V(ArrayNewFixed, 0xfb19, _, "array.new_fixed") \
V(ArrayNewFixedStatic, 0xfb1a, _, "array.new_fixed_static") \
V(ArrayNew, 0xfb1b, _, "array.new") \
V(ArrayNewDefault, 0xfb1c, _, "array.new_default") \
V(ArrayNewData, 0xfb1e, _, "array.new_data") \
V(ArrayNewDataStatic, 0xfb1d, _, "array.new_data_static") \
V(ArrayNewElemStatic, 0xfb1f, _, "array.new_elem_static") \
V(I31New, 0xfb20, _, "i31.new") \
V(I31GetS, 0xfb21, _, "i31.get_s") \
V(I31GetU, 0xfb22, _, "i31.get_u") \
V(RttCanon, 0xfb30, _, "rtt.canon") \
V(RefTest, 0xfb40, _, "ref.test") \
V(RefCast, 0xfb41, _, "ref.cast") \
V(BrOnCast, 0xfb42, _, "br_on_cast") \
V(BrOnCastFail, 0xfb43, _, "br_on_cast_fail") \
V(RefTestStatic, 0xfb44, _, "ref.test_static") \
V(RefCastStatic, 0xfb45, _, "ref.cast_static") \
V(BrOnCastStatic, 0xfb46, _, "br_on_cast_static") \
......
......@@ -393,9 +393,9 @@ class InitExprInterface {
}
// The following operations assume non-rtt versions of the instructions.
void StructNewWithRtt(FullDecoder* decoder,
const StructIndexImmediate<validate>& imm,
const Value& rtt, const Value args[], Value* result) {
void StructNew(FullDecoder* decoder,
const StructIndexImmediate<validate>& imm, const Value& rtt,
const Value args[], Value* result) {
os_ << "kGCPrefix, kExprStructNew, " << index(imm.index);
}
......@@ -405,10 +405,9 @@ class InitExprInterface {
os_ << "kGCPrefix, kExprStructNewDefault, " << index(imm.index);
}
void ArrayNewWithRtt(FullDecoder* decoder,
const ArrayIndexImmediate<validate>& imm,
const Value& length, const Value& initial_value,
const Value& rtt, Value* result) {
void ArrayNew(FullDecoder* decoder, const ArrayIndexImmediate<validate>& imm,
const Value& length, const Value& initial_value,
const Value& rtt, Value* result) {
os_ << "kGCPrefix, kExprArrayNew, " << index(imm.index);
}
......
......@@ -103,61 +103,3 @@ d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
assertTraps(kTrapDataSegmentOutOfBounds, () => init(1, 2, 0));
})();
(function TestArrayNewData() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
builder.setEarlyDataCountSection();
let array_type_index = builder.addArray(kWasmI16, true);
let dummy_byte = 0xff;
let element_0 = 1000;
let element_1 = -2222;
let data_segment = builder.addPassiveDataSegment(
[dummy_byte, element_0 & 0xff, (element_0 >> 8) & 0xff,
element_1 & 0xff, (element_1 >> 8) & 0xff]);
let global = builder.addGlobal(
wasmRefType(array_type_index), true,
[...wasmI32Const(1), ...wasmI32Const(2),
kGCPrefix, kExprArrayNewDataStatic, array_type_index, data_segment],
builder);
builder.addFunction("global_get", kSig_i_i)
.addBody([
kExprGlobalGet, global.index,
kExprLocalGet, 0,
kGCPrefix, kExprArrayGetS, array_type_index])
.exportFunc();
// parameters: (segment offset, array length, array index)
builder.addFunction("init_from_data", kSig_i_iii)
.addBody([
kExprLocalGet, 0, kExprLocalGet, 1,
kGCPrefix, kExprArrayNewDataStatic, array_type_index, data_segment,
kExprLocalGet, 2,
kGCPrefix, kExprArrayGetS, array_type_index])
.exportFunc();
builder.addFunction("drop_segment", kSig_v_v)
.addBody([kNumericPrefix, kExprDataDrop, data_segment])
.exportFunc();
let instance = builder.instantiate();
assertEquals(element_0, instance.exports.global_get(0));
assertEquals(element_1, instance.exports.global_get(1));
let init = instance.exports.init_from_data;
assertEquals(element_0, init(1, 2, 0));
assertEquals(element_1, init(1, 2, 1));
assertTraps(kTrapArrayTooLarge, () => init(1, 1000000000, 0));
assertTraps(kTrapDataSegmentOutOfBounds, () => init(2, 2, 0));
instance.exports.drop_segment();
assertTraps(kTrapDataSegmentOutOfBounds, () => init(1, 2, 0));
})();
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