Commit c536ea2d authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Remove temporary table immutability workaround

Now that tables and stack frames properly root instances, there is no
longer any need to disallow mutations that could unroot instances
while their code is on the stack.

Bug: v8:7232
Change-Id: I907b9522ac12ad7a67fb4124774713b6b3b40bb7
Reviewed-on: https://chromium-review.googlesource.com/1007004
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52629}
parent 73aa5633
......@@ -910,20 +910,7 @@ void WebAssemblyTableSet(const v8::FunctionCallbackInfo<v8::Value>& args) {
return;
}
// TODO(v8:7232) Allow reset/mutation after addressing referenced issue.
int32_t int_index = static_cast<int32_t>(index);
if (receiver->functions()->get(int_index) !=
i_isolate->heap()->undefined_value() &&
receiver->functions()->get(int_index) !=
i_isolate->heap()->null_value()) {
for (i::StackFrameIterator it(i_isolate); !it.done(); it.Advance()) {
if (it.frame()->type() == i::StackFrame::WASM_TO_JS) {
thrower.RangeError("Modifying existing entry in table not supported.");
return;
}
}
}
i::WasmTableObject::Set(i_isolate, receiver, static_cast<int32_t>(int_index),
i::WasmTableObject::Set(i_isolate, receiver, static_cast<int32_t>(index),
value->IsNull(i_isolate)
? i::Handle<i::JSFunction>::null()
: i::Handle<i::JSFunction>::cast(value));
......
......@@ -708,44 +708,6 @@ function js_div(a, b) { return (a / b) | 0; }
})();
// Remove this test when v8:7232 is addressed comprehensively.
(function TablesAreImmutableInWasmCallstacks() {
print(arguments.callee.name);
let table = new WebAssembly.Table({initial:2, element:'anyfunc'});
let builder = new WasmModuleBuilder();
builder.addImport('', 'mutator', kSig_v_v);
builder.addFunction('main', kSig_v_v)
.addBody([
kExprCallFunction, 0
]).exportAs('main');
let module = new WebAssembly.Module(builder.toBuffer());
let instance = new WebAssembly.Instance(module, {
'': {
'mutator': () => {table.set(0, null);}
}
});
table.set(0, instance.exports.main);
try {
instance.exports.main();
assertUnreached();
} catch (e) {
assertTrue(e instanceof RangeError);
}
try {
instance.exports.main();
assertUnreached();
} catch (e) {
assertTrue(e instanceof RangeError);
}
table.set(0, null);
assertEquals(null, table.get(0));
})();
(function ImportedWasmFunctionPutIntoTable() {
print(arguments.callee.name);
......
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