Commit 979b1374 authored by Matthias Liedtke's avatar Matthias Liedtke Committed by V8 LUCI CQ

[wasm-gc] Add dummy IsWasmObject() for wasm disabled builds

On x64.release for linux this didn't affect binary size at all but
should improve readability of usages.

Bug: v8:7748
Change-Id: I46ecc9c2b4814244f6b5114f9ea199cd4d0220cd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3904602Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83337}
parent bfcaecf3
......@@ -870,11 +870,8 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
if (!map_prototype_map.object()->IsJSObjectMap()) {
// Don't allow proxies on the prototype chain.
if (!prototype.IsNull()) {
DCHECK(prototype.object()->IsJSProxy()
#if V8_ENABLE_WEBASSEMBLY
|| prototype.object()->IsWasmObject()
#endif
); // NOLINT
DCHECK(prototype.object()->IsJSProxy() ||
prototype.object()->IsWasmObject());
return Invalid();
}
......
......@@ -1197,11 +1197,8 @@ void KeyedLoadIC::UpdateLoadElement(Handle<HeapObject> receiver,
if ((receiver->IsJSObject() &&
IsMoreGeneralElementsKindTransition(
target_receiver_maps.at(0)->elements_kind(),
Handle<JSObject>::cast(receiver)->GetElementsKind()))
#ifdef V8_ENABLE_WEBASSEMBLY
|| receiver->IsWasmObject()
#endif
) {
Handle<JSObject>::cast(receiver)->GetElementsKind())) ||
receiver->IsWasmObject()) {
Handle<Object> handler = LoadElementHandler(receiver_map, load_mode);
return ConfigureVectorState(Handle<Name>(), receiver_map, handler);
}
......
......@@ -100,13 +100,11 @@ MaybeHandle<HeapObject> JSReceiver::GetPrototype(Isolate* isolate,
// We don't expect access checks to be needed on JSProxy objects.
DCHECK(!receiver->IsAccessCheckNeeded() || receiver->IsJSObject());
#if V8_ENABLE_WEBASSEMBLY
if (receiver->IsWasmObject()) {
THROW_NEW_ERROR(isolate,
NewTypeError(MessageTemplate::kWasmObjectsAreOpaque),
HeapObject);
}
#endif
PrototypeIterator iter(isolate, receiver, kStartAtReceiver,
PrototypeIterator::END_AT_NON_HIDDEN);
......
......@@ -1168,12 +1168,10 @@ Maybe<bool> JSReceiver::DefineOwnProperty(Isolate* isolate,
isolate, Handle<JSModuleNamespace>::cast(object), key, desc,
should_throw);
}
#if V8_ENABLE_WEBASSEMBLY
if (object->IsWasmObject()) {
RETURN_FAILURE(isolate, kThrowOnError,
NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
}
#endif
// OrdinaryDefineOwnProperty, by virtue of calling
// DefineOwnPropertyIgnoreAttributes, can handle arguments
......@@ -2052,12 +2050,10 @@ Maybe<bool> JSReceiver::PreventExtensions(Handle<JSReceiver> object,
return JSProxy::PreventExtensions(Handle<JSProxy>::cast(object),
should_throw);
}
#if V8_ENABLE_WEBASSEMBLY
if (object->IsWasmObject()) {
RETURN_FAILURE(object->GetIsolate(), kThrowOnError,
NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
}
#endif
DCHECK(object->IsJSObject());
return JSObject::PreventExtensions(Handle<JSObject>::cast(object),
should_throw);
......@@ -2067,11 +2063,9 @@ Maybe<bool> JSReceiver::IsExtensible(Handle<JSReceiver> object) {
if (object->IsJSProxy()) {
return JSProxy::IsExtensible(Handle<JSProxy>::cast(object));
}
#if V8_ENABLE_WEBASSEMBLY
if (object->IsWasmObject()) {
return Just(false);
}
#endif
return Just(JSObject::IsExtensible(Handle<JSObject>::cast(object)));
}
......@@ -2312,12 +2306,10 @@ Maybe<bool> JSReceiver::SetPrototype(Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> value, bool from_javascript,
ShouldThrow should_throw) {
#if V8_ENABLE_WEBASSEMBLY
if (object->IsWasmObject()) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
}
#endif
if (object->IsJSProxy()) {
return JSProxy::SetPrototype(isolate, Handle<JSProxy>::cast(object), value,
......
......@@ -253,7 +253,6 @@ Maybe<bool> KeyAccumulator::CollectKeys(Handle<JSReceiver> receiver,
Maybe<bool> result = Just(false); // Dummy initialization.
if (current->IsJSProxy()) {
result = CollectOwnJSProxyKeys(receiver, Handle<JSProxy>::cast(current));
#if V8_ENABLE_WEBASSEMBLY
} else if (current->IsWasmObject()) {
if (mode_ == KeyCollectionMode::kIncludePrototypes) {
RETURN_FAILURE(isolate_, kThrowOnError,
......@@ -262,7 +261,6 @@ Maybe<bool> KeyAccumulator::CollectKeys(Handle<JSReceiver> receiver,
DCHECK_EQ(KeyCollectionMode::kOwnOnly, mode_);
DCHECK_EQ(result, Just(false)); // Stop iterating.
}
#endif
} else {
DCHECK(current->IsJSObject());
result = CollectOwnKeys(receiver, Handle<JSObject>::cast(current));
......
......@@ -330,9 +330,7 @@ void LookupIterator::InternalUpdateProtector(Isolate* isolate,
void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
DCHECK(state_ == DATA || state_ == ACCESSOR);
DCHECK(HolderIsReceiverOrHiddenPrototype());
#if V8_ENABLE_WEBASSEMBLY
DCHECK(!receiver_->IsWasmObject(isolate_));
#endif // V8_ENABLE_WEBASSEMBLY
Handle<JSReceiver> holder = GetHolder<JSReceiver>();
// We are not interested in tracking constness of a JSProxy's direct
......@@ -460,9 +458,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
DCHECK(HolderIsReceiverOrHiddenPrototype());
Handle<JSReceiver> holder = GetHolder<JSReceiver>();
#if V8_ENABLE_WEBASSEMBLY
if (V8_UNLIKELY(holder->IsWasmObject())) UNREACHABLE();
#endif // V8_ENABLE_WEBASSEMBLY
// Property details can never change for private properties.
if (holder->IsJSProxy(isolate_)) {
......@@ -870,9 +866,7 @@ bool LookupIterator::HolderIsReceiverOrHiddenPrototype() const {
Handle<Object> LookupIterator::FetchValue(
AllocationPolicy allocation_policy) const {
Object result;
#if V8_ENABLE_WEBASSEMBLY
DCHECK(!holder_->IsWasmObject());
#endif
if (IsElement(*holder_)) {
Handle<JSObject> holder = GetHolder<JSObject>();
ElementsAccessor* accessor = holder->GetElementsAccessor(isolate_);
......@@ -1048,11 +1042,9 @@ Handle<Object> LookupIterator::GetDataValue(SeqCstAccessTag tag) const {
void LookupIterator::WriteDataValue(Handle<Object> value,
bool initializing_store) {
DCHECK_EQ(DATA, state_);
#if V8_ENABLE_WEBASSEMBLY
// WriteDataValueToWasmObject() must be used instead for writing to
// WasmObjects.
DCHECK(!holder_->IsWasmObject(isolate_));
#endif // V8_ENABLE_WEBASSEMBLY
DCHECK_IMPLIES(holder_->IsJSSharedStruct(), value->IsShared());
Handle<JSReceiver> holder = GetHolder<JSReceiver>();
......@@ -1268,9 +1260,7 @@ LookupIterator::State LookupIterator::LookupInRegularHolder(
if (interceptor_state_ == InterceptorState::kProcessNonMasking) {
return NOT_FOUND;
}
#if V8_ENABLE_WEBASSEMBLY
DCHECK(!holder.IsWasmObject(isolate_));
#endif
if (is_element && IsElement(holder)) {
JSObject js_object = JSObject::cast(holder);
ElementsAccessor* accessor = js_object.GetElementsAccessor(isolate_);
......
......@@ -53,9 +53,7 @@ RELEASE_ACQUIRE_WEAK_ACCESSORS(Map, raw_transitions,
ACCESSORS_CHECKED2(Map, prototype, HeapObject, kPrototypeOffset, true,
value.IsNull() || value.IsJSProxy() ||
#if V8_ENABLE_WEBASSEMBLY
value.IsWasmObject() ||
#endif
(value.IsJSObject() && value.map().is_prototype_map()))
DEF_GETTER(Map, prototype_info, Object) {
......
......@@ -2296,11 +2296,8 @@ void Map::SetPrototype(Isolate* isolate, Handle<Map> map,
Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype);
JSObject::OptimizeAsPrototype(prototype_jsobj, enable_prototype_setup_mode);
} else {
DCHECK(prototype->IsNull(isolate) || prototype->IsJSProxy()
#if V8_ENABLE_WEBASSEMBLY
|| prototype->IsWasmObject()
#endif
);
DCHECK(prototype->IsNull(isolate) || prototype->IsJSProxy() ||
prototype->IsWasmObject());
}
WriteBarrierMode wb_mode =
......
......@@ -2820,9 +2820,7 @@ Maybe<bool> Object::SetDataProperty(LookupIterator* it, Handle<Object> value) {
}
}
#if V8_ENABLE_WEBASSEMBLY
DCHECK(!receiver->IsWasmObject(isolate));
#endif // V8_ENABLE_WEBASSEMBLY
if (V8_UNLIKELY(receiver->IsJSSharedStruct(isolate) ||
receiver->IsJSSharedArray(isolate))) {
// Shared structs can only point to primitives or shared values.
......
......@@ -335,6 +335,11 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> {
V8_INLINE bool IsPrivateSymbol() const;
V8_INLINE bool IsPublicSymbol() const;
#if !V8_ENABLE_WEBASSEMBLY
// Dummy implementation on builds without WebAssembly.
bool IsWasmObject(Isolate* = nullptr) const { return false; }
#endif
enum class Conversion { kToNumber, kToNumeric };
#define DECL_STRUCT_PREDICATE(NAME, Name, 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