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