Commit 76481581 authored by Sven Sauleau's avatar Sven Sauleau Committed by Commit Bot

[wasm] remove [[HasProperty]] in memory/constructor when threads

Remove the call to [[HasProperty]] for the shared property when threads
feature is enabled.

Bug: v8:8782
Change-Id: I492ed3726ea846a1a52dc3a0e0a183d9ee506e96
Reviewed-on: https://chromium-review.googlesource.com/c/1451826Reviewed-by: 's avatarBen Smith <binji@chromium.org>
Commit-Queue: Sven Sauleau <ssauleau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#59352}
parent ddf72e4b
......@@ -1092,14 +1092,12 @@ void WebAssemblyMemory(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (enabled_features.threads) {
// Shared property of descriptor
Local<String> shared_key = v8_str(isolate, "shared");
Maybe<bool> has_shared = descriptor->Has(context, shared_key);
if (!has_shared.IsNothing() && has_shared.FromJust()) {
v8::MaybeLocal<v8::Value> maybe = descriptor->Get(context, shared_key);
v8::MaybeLocal<v8::Value> maybe_value =
descriptor->Get(context, shared_key);
v8::Local<v8::Value> value;
if (maybe.ToLocal(&value)) {
if (maybe_value.ToLocal(&value)) {
is_shared_memory = value->BooleanValue(isolate);
}
}
// Throw TypeError if shared is true, and the descriptor has no "maximum"
if (is_shared_memory && maximum == -1) {
thrower.TypeError(
......
......@@ -129,3 +129,17 @@ function assertMemoryIsValid(memory, shared) {
assertEquals(0, instance.exports.main(0, 0x11111111));
assertEquals(0x11111111, instance.exports.main(0, 0x11111111));
})();
(function TestMemoryConstructorShouldCallHasProperty() {
print("TestMemoryConstructorShouldCallHasProperty");
// from test/wasm-js/data/test/js-api/memory/constructor.any.js
const proxy = new Proxy({}, {
has(o, x) {
throw new Error(`Should not call [[HasProperty]] with ${x}`);
},
get(o, x) {
return 0;
},
});
new WebAssembly.Memory(proxy);
})();
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