Commit 91c495ff authored by bmeurer's avatar bmeurer Committed by Commit bot

[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}
parent 634d1d86
...@@ -198,14 +198,6 @@ bool Object::IsSpecObject() const { ...@@ -198,14 +198,6 @@ bool Object::IsSpecObject() const {
} }
// TODO(rossberg): Remove this and use the spec compliant IsCallable instead.
bool Object::IsSpecFunction() const {
if (!Object::IsHeapObject()) return false;
InstanceType type = HeapObject::cast(this)->map()->instance_type();
return type == JS_FUNCTION_TYPE || type == JS_FUNCTION_PROXY_TYPE;
}
bool Object::IsTemplateInfo() const { bool Object::IsTemplateInfo() const {
return IsObjectTemplateInfo() || IsFunctionTemplateInfo(); return IsObjectTemplateInfo() || IsFunctionTemplateInfo();
} }
...@@ -7359,7 +7351,7 @@ bool AccessorPair::ContainsAccessor() { ...@@ -7359,7 +7351,7 @@ bool AccessorPair::ContainsAccessor() {
bool AccessorPair::IsJSAccessor(Object* obj) { bool AccessorPair::IsJSAccessor(Object* obj) {
return obj->IsSpecFunction() || obj->IsUndefined(); return obj->IsCallable() || obj->IsUndefined();
} }
......
...@@ -798,7 +798,7 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor( ...@@ -798,7 +798,7 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(
// Regular accessor. // Regular accessor.
Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
if (getter->IsSpecFunction()) { if (getter->IsCallable()) {
// TODO(rossberg): nicer would be to cast to some JSCallable here... // TODO(rossberg): nicer would be to cast to some JSCallable here...
return Object::GetPropertyWithDefinedGetter( return Object::GetPropertyWithDefinedGetter(
receiver, Handle<JSReceiver>::cast(getter)); receiver, Handle<JSReceiver>::cast(getter));
...@@ -854,7 +854,7 @@ MaybeHandle<Object> Object::SetPropertyWithAccessor( ...@@ -854,7 +854,7 @@ MaybeHandle<Object> Object::SetPropertyWithAccessor(
// Regular accessor. // Regular accessor.
Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
if (setter->IsSpecFunction()) { if (setter->IsCallable()) {
// TODO(rossberg): nicer would be to cast to some JSCallable here... // TODO(rossberg): nicer would be to cast to some JSCallable here...
return SetPropertyWithDefinedSetter( return SetPropertyWithDefinedSetter(
receiver, Handle<JSReceiver>::cast(setter), value); receiver, Handle<JSReceiver>::cast(setter), value);
...@@ -6918,8 +6918,8 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object, ...@@ -6918,8 +6918,8 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object,
} }
} }
DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || getter->IsNull()); DCHECK(getter->IsCallable() || getter->IsUndefined() || getter->IsNull());
DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || setter->IsNull()); DCHECK(setter->IsCallable() || setter->IsUndefined() || setter->IsNull());
// At least one of the accessors needs to be a new value. // At least one of the accessors needs to be a new value.
DCHECK(!getter->IsNull() || !setter->IsNull()); DCHECK(!getter->IsNull() || !setter->IsNull());
if (!getter->IsNull()) { if (!getter->IsNull()) {
......
...@@ -1034,8 +1034,6 @@ class Object { ...@@ -1034,8 +1034,6 @@ class Object {
INLINE(bool IsCallable() const); INLINE(bool IsCallable() const);
INLINE(bool IsSpecObject()) const; INLINE(bool IsSpecObject()) const;
// TODO(rossberg): IsSpecFunction should be removed in favor of IsCallable.
INLINE(bool IsSpecFunction()) const;
INLINE(bool IsTemplateInfo()) const; INLINE(bool IsTemplateInfo()) const;
INLINE(bool IsNameDictionary() const); INLINE(bool IsNameDictionary() const);
INLINE(bool IsGlobalDictionary() const); INLINE(bool IsGlobalDictionary() const);
......
...@@ -1204,7 +1204,7 @@ RUNTIME_FUNCTION(Runtime_IsJSGlobalProxy) { ...@@ -1204,7 +1204,7 @@ RUNTIME_FUNCTION(Runtime_IsJSGlobalProxy) {
static bool IsValidAccessor(Handle<Object> obj) { static bool IsValidAccessor(Handle<Object> obj) {
return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull(); return obj->IsUndefined() || obj->IsCallable() || obj->IsNull();
} }
......
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