From: bmeurer Date: Wed, 23 Sep 2015 05:53:23 +0000 (-0700) Subject: [runtime] Remove obsolete Object::IsSpecFunction. X-Git-Tag: upstream/4.7.83~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91c495ff446363b480aee3a980dcb5006dca5692;p=platform%2Fupstream%2Fv8.git [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} --- diff --git a/src/objects-inl.h b/src/objects-inl.h index 1e0b683..4aa0ea1 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -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 { return IsObjectTemplateInfo() || IsFunctionTemplateInfo(); } @@ -7359,7 +7351,7 @@ bool AccessorPair::ContainsAccessor() { bool AccessorPair::IsJSAccessor(Object* obj) { - return obj->IsSpecFunction() || obj->IsUndefined(); + return obj->IsCallable() || obj->IsUndefined(); } diff --git a/src/objects.cc b/src/objects.cc index eddb21e..89ae2a6 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -798,7 +798,7 @@ MaybeHandle Object::GetPropertyWithAccessor( // Regular accessor. Handle getter(AccessorPair::cast(*structure)->getter(), isolate); - if (getter->IsSpecFunction()) { + if (getter->IsCallable()) { // TODO(rossberg): nicer would be to cast to some JSCallable here... return Object::GetPropertyWithDefinedGetter( receiver, Handle::cast(getter)); @@ -854,7 +854,7 @@ MaybeHandle Object::SetPropertyWithAccessor( // Regular accessor. Handle setter(AccessorPair::cast(*structure)->setter(), isolate); - if (setter->IsSpecFunction()) { + if (setter->IsCallable()) { // TODO(rossberg): nicer would be to cast to some JSCallable here... return SetPropertyWithDefinedSetter( receiver, Handle::cast(setter), value); @@ -6918,8 +6918,8 @@ MaybeHandle JSObject::DefineAccessor(Handle object, } } - DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || getter->IsNull()); - DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || setter->IsNull()); + DCHECK(getter->IsCallable() || getter->IsUndefined() || getter->IsNull()); + DCHECK(setter->IsCallable() || setter->IsUndefined() || setter->IsNull()); // At least one of the accessors needs to be a new value. DCHECK(!getter->IsNull() || !setter->IsNull()); if (!getter->IsNull()) { diff --git a/src/objects.h b/src/objects.h index b35d9ba..af07727 100644 --- a/src/objects.h +++ b/src/objects.h @@ -1034,8 +1034,6 @@ class Object { INLINE(bool IsCallable() 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 IsNameDictionary() const); INLINE(bool IsGlobalDictionary() const); diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc index d2f1ee8..d00ce52 100644 --- a/src/runtime/runtime-object.cc +++ b/src/runtime/runtime-object.cc @@ -1204,7 +1204,7 @@ RUNTIME_FUNCTION(Runtime_IsJSGlobalProxy) { static bool IsValidAccessor(Handle obj) { - return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull(); + return obj->IsUndefined() || obj->IsCallable() || obj->IsNull(); }