Skip to content

Commit 91c495f

Browse files
bmeurerCommit bot
authored andcommitted
[runtime] Remove obsolete Object::IsSpecFunction.
We don't need Object::IsSpecFunction anymore, since it only checks for JSFunction and JSFunctionProxy, but what you actually want to check for (in case of accessors) is whether the target has a [[Call]] internal method, which is exactly what Object::IsCallable does. CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_layout_dbg,v8_linux_nosnap_dbg R=rossberg@chromium.org BUG=v8:4413 LOG=n Review URL: https://codereview.chromium.org/1358403002 Cr-Commit-Position: refs/heads/master@{#30875}
1 parent 634d1d8 commit 91c495f

4 files changed

Lines changed: 6 additions & 16 deletions

File tree

src/objects-inl.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,6 @@ bool Object::IsSpecObject() const {
198198
}
199199

200200

201-
// TODO(rossberg): Remove this and use the spec compliant IsCallable instead.
202-
bool Object::IsSpecFunction() const {
203-
if (!Object::IsHeapObject()) return false;
204-
InstanceType type = HeapObject::cast(this)->map()->instance_type();
205-
return type == JS_FUNCTION_TYPE || type == JS_FUNCTION_PROXY_TYPE;
206-
}
207-
208-
209201
bool Object::IsTemplateInfo() const {
210202
return IsObjectTemplateInfo() || IsFunctionTemplateInfo();
211203
}
@@ -7359,7 +7351,7 @@ bool AccessorPair::ContainsAccessor() {
73597351

73607352

73617353
bool AccessorPair::IsJSAccessor(Object* obj) {
7362-
return obj->IsSpecFunction() || obj->IsUndefined();
7354+
return obj->IsCallable() || obj->IsUndefined();
73637355
}
73647356

73657357

src/objects.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(
798798

799799
// Regular accessor.
800800
Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
801-
if (getter->IsSpecFunction()) {
801+
if (getter->IsCallable()) {
802802
// TODO(rossberg): nicer would be to cast to some JSCallable here...
803803
return Object::GetPropertyWithDefinedGetter(
804804
receiver, Handle<JSReceiver>::cast(getter));
@@ -854,7 +854,7 @@ MaybeHandle<Object> Object::SetPropertyWithAccessor(
854854

855855
// Regular accessor.
856856
Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
857-
if (setter->IsSpecFunction()) {
857+
if (setter->IsCallable()) {
858858
// TODO(rossberg): nicer would be to cast to some JSCallable here...
859859
return SetPropertyWithDefinedSetter(
860860
receiver, Handle<JSReceiver>::cast(setter), value);
@@ -6918,8 +6918,8 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object,
69186918
}
69196919
}
69206920

6921-
DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || getter->IsNull());
6922-
DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || setter->IsNull());
6921+
DCHECK(getter->IsCallable() || getter->IsUndefined() || getter->IsNull());
6922+
DCHECK(setter->IsCallable() || setter->IsUndefined() || setter->IsNull());
69236923
// At least one of the accessors needs to be a new value.
69246924
DCHECK(!getter->IsNull() || !setter->IsNull());
69256925
if (!getter->IsNull()) {

src/objects.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,6 @@ class Object {
10341034
INLINE(bool IsCallable() const);
10351035

10361036
INLINE(bool IsSpecObject()) const;
1037-
// TODO(rossberg): IsSpecFunction should be removed in favor of IsCallable.
1038-
INLINE(bool IsSpecFunction()) const;
10391037
INLINE(bool IsTemplateInfo()) const;
10401038
INLINE(bool IsNameDictionary() const);
10411039
INLINE(bool IsGlobalDictionary() const);

src/runtime/runtime-object.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ RUNTIME_FUNCTION(Runtime_IsJSGlobalProxy) {
12041204

12051205

12061206
static bool IsValidAccessor(Handle<Object> obj) {
1207-
return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull();
1207+
return obj->IsUndefined() || obj->IsCallable() || obj->IsNull();
12081208
}
12091209

12101210

0 commit comments

Comments
 (0)