Commit 67b6af7c authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[api] Rename instance check for WasmModuleObject

Both the API wrapper as well as the internal object are named
"WasmModuleObject". This CL renames the object type check from
"IsWebAssemblyCompiledModule" to "IsWasmModuleObject" to be consistent.

R=adamk@chromium.org

Bug: v8:10021
Change-Id: I6d5814421f38bc5f5bd73a492ff4a36f552ff763
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2013109Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65930}
parent 30f94ea4
......@@ -2804,6 +2804,12 @@ class V8_EXPORT Value : public Data {
*/
bool IsProxy() const;
/**
* Returns true if this value is a WasmModuleObject.
*/
bool IsWasmModuleObject() const;
V8_DEPRECATE_SOON("Use IsWasmModuleObject")
bool IsWebAssemblyCompiledModule() const;
/**
......
......@@ -3463,6 +3463,7 @@ VALUE_IS_SPECIFIC_TYPE(SymbolObject, SymbolWrapper)
VALUE_IS_SPECIFIC_TYPE(Date, JSDate)
VALUE_IS_SPECIFIC_TYPE(Map, JSMap)
VALUE_IS_SPECIFIC_TYPE(Set, JSSet)
VALUE_IS_SPECIFIC_TYPE(WasmModuleObject, WasmModuleObject)
VALUE_IS_SPECIFIC_TYPE(WeakMap, JSWeakMap)
VALUE_IS_SPECIFIC_TYPE(WeakSet, JSWeakSet)
VALUE_IS_SPECIFIC_TYPE(WebAssemblyCompiledModule, WasmModuleObject)
......@@ -3760,8 +3761,7 @@ void v8::Proxy::CheckCast(Value* that) {
}
void v8::WasmModuleObject::CheckCast(Value* that) {
Utils::ApiCheck(that->IsWebAssemblyCompiledModule(),
"v8::WasmModuleObject::Cast",
Utils::ApiCheck(that->IsWasmModuleObject(), "v8::WasmModuleObject::Cast",
"Value is not a WasmModuleObject");
}
......
......@@ -77,7 +77,7 @@ bool IsWasmInstantiateAllowed(v8::Isolate* isolate,
DCHECK_GT(GetPerIsolateWasmControls()->count(isolate), 0);
const WasmCompileControls& ctrls = GetPerIsolateWasmControls()->at(isolate);
if (is_async && ctrls.AllowAnySizeForAsync) return true;
if (!module_or_bytes->IsWebAssemblyCompiledModule()) {
if (!module_or_bytes->IsWasmModuleObject()) {
return IsWasmCompileAllowed(isolate, module_or_bytes, is_async);
}
v8::Local<v8::WasmModuleObject> module =
......
......@@ -143,7 +143,7 @@ class WasmSerializationTest {
v8::Local<v8::Object> v8_module_obj =
v8::Utils::ToLocal(Handle<JSObject>::cast(module_object));
CHECK(v8_module_obj->IsWebAssemblyCompiledModule());
CHECK(v8_module_obj->IsWasmModuleObject());
v8::Local<v8::WasmModuleObject> v8_module_object =
v8_module_obj.As<v8::WasmModuleObject>();
......
......@@ -2573,7 +2573,7 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest {
void ExpectPass() {
Local<Value> value = RoundTripTest(MakeWasm());
Context::Scope scope(deserialization_context());
ASSERT_TRUE(value->IsWebAssemblyCompiledModule());
ASSERT_TRUE(value->IsWasmModuleObject());
ExpectScriptTrue(
"new WebAssembly.Instance(result).exports.increment(8) === 9");
}
......@@ -2771,7 +2771,7 @@ TEST_F(ValueSerializerTestWithWasm, DecodeWasmModule) {
kSerializedIncrementerWasm,
kSerializedIncrementerWasm + sizeof(kSerializedIncrementerWasm));
Local<Value> value = DecodeTest(raw);
ASSERT_TRUE(value->IsWebAssemblyCompiledModule());
ASSERT_TRUE(value->IsWasmModuleObject());
ExpectScriptTrue(
"new WebAssembly.Instance(result).exports.increment(8) === 9");
}
......@@ -2792,7 +2792,7 @@ TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidCompiledData) {
kSerializedIncrementerWasmWithInvalidCompiledData +
sizeof(kSerializedIncrementerWasmWithInvalidCompiledData));
Local<Value> value = DecodeTest(raw);
ASSERT_TRUE(value->IsWebAssemblyCompiledModule());
ASSERT_TRUE(value->IsWasmModuleObject());
ExpectScriptTrue(
"new WebAssembly.Instance(result).exports.increment(8) === 9");
}
......
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