Bug 1259877 - Rename Invoke[GS]etter to Call[GS]etter, more in line with the spec's calling nomenclature. r=jorendorff
authorJeff Walden <jwalden@mit.edu>
Thu, 10 Mar 2016 21:46:10 -0800
changeset 290948 52cf294fc0d5597fab5501f7fc4bbc2cd09416a6
parent 290947 6a930fcdf2851da9aee3e042b29f85225eea6535
child 290949 77b2b963de2c9e8172cb5896d938416d30867e8b
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1259877
milestone48.0a1
Bug 1259877 - Rename Invoke[GS]etter to Call[GS]etter, more in line with the spec's calling nomenclature. r=jorendorff
js/src/proxy/BaseProxyHandler.cpp
js/src/vm/Interpreter.cpp
js/src/vm/Interpreter.h
js/src/vm/NativeObject.cpp
--- a/js/src/proxy/BaseProxyHandler.cpp
+++ b/js/src/proxy/BaseProxyHandler.cpp
@@ -134,17 +134,18 @@ BaseProxyHandler::get(JSContext* cx, Han
 
     // Step 6.
     if (!getter) {
         vp.setUndefined();
         return true;
     }
 
     // Step 7.
-    return InvokeGetter(cx, receiver, ObjectValue(*getter), vp);
+    RootedValue getterFunc(cx, ObjectValue(*getter));
+    return CallGetter(cx, receiver, getterFunc, vp);
 }
 
 bool
 BaseProxyHandler::set(JSContext* cx, HandleObject proxy, HandleId id, HandleValue v,
                       HandleValue receiver, ObjectOpResult& result) const
 {
     assertEnteredPolicy(cx, proxy, id, SET);
 
@@ -236,17 +237,17 @@ js::SetPropertyIgnoringNamedGetter(JSCon
     // Step 6.
     MOZ_ASSERT(ownDesc.isAccessorDescriptor());
     RootedObject setter(cx);
     if (ownDesc.hasSetterObject())
         setter = ownDesc.setterObject();
     if (!setter)
         return result.fail(JSMSG_GETTER_ONLY);
     RootedValue setterValue(cx, ObjectValue(*setter));
-    if (!InvokeSetter(cx, receiver, setterValue, v))
+    if (!CallSetter(cx, receiver, setterValue, v))
         return false;
     return result.succeed();
 }
 
 bool
 BaseProxyHandler::getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy,
                                                AutoIdVector& props) const
 {
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -624,34 +624,32 @@ js::InternalConstructWithProvidedThis(JS
     if (!InternalConstruct(cx, args))
         return false;
 
     rval.set(args.CallArgs::rval());
     return true;
 }
 
 bool
-js::InvokeGetter(JSContext* cx, const Value& thisv, Value fval, MutableHandleValue rval)
-{
-    /*
-     * Invoke could result in another try to get or set the same id again, see
-     * bug 355497.
-     */
+js::CallGetter(JSContext* cx, HandleValue thisv, HandleValue getter, MutableHandleValue rval)
+{
+    // Invoke could result in another try to get or set the same id again, see
+    // bug 355497.
     JS_CHECK_RECURSION(cx, return false);
 
-    return Invoke(cx, thisv, fval, 0, nullptr, rval);
+    return Invoke(cx, thisv, getter, 0, nullptr, rval);
 }
 
 bool
-js::InvokeSetter(JSContext* cx, const Value& thisv, Value fval, HandleValue v)
+js::CallSetter(JSContext* cx, HandleValue thisv, HandleValue setter, HandleValue v)
 {
     JS_CHECK_RECURSION(cx, return false);
 
     RootedValue ignored(cx);
-    return Invoke(cx, thisv, fval, 1, v.address(), &ignored);
+    return Invoke(cx, thisv, setter, 1, v.address(), &ignored);
 }
 
 bool
 js::ExecuteKernel(JSContext* cx, HandleScript script, JSObject& scopeChainArg,
                   const Value& newTargetValue, AbstractFramePtr evalInFrame,
                   Value* result)
 {
     MOZ_ASSERT_IF(script->isGlobalCode(),
--- a/js/src/vm/Interpreter.h
+++ b/js/src/vm/Interpreter.h
@@ -69,20 +69,20 @@ extern bool
 Invoke(JSContext* cx, const Value& thisv, const Value& fval, unsigned argc, const Value* argv,
        MutableHandleValue rval);
 
 /*
  * These helpers take care of the infinite-recursion check necessary for
  * getter/setter calls.
  */
 extern bool
-InvokeGetter(JSContext* cx, const Value& thisv, Value fval, MutableHandleValue rval);
+CallGetter(JSContext* cx, HandleValue thisv, HandleValue getter, MutableHandleValue rval);
 
 extern bool
-InvokeSetter(JSContext* cx, const Value& thisv, Value fval, HandleValue v);
+CallSetter(JSContext* cx, HandleValue thisv, HandleValue setter, HandleValue rval);
 
 // ES6 7.3.13 Construct(F, argumentsList, newTarget).  All parameters are
 // required, hopefully forcing callers to be careful not to (say) blindly pass
 // callee as |newTarget| when a different value should have been passed.
 //
 // NOTE: As with the ES6 spec operation, it's the caller's responsibility to
 //       ensure |fval| and |newTarget| are both |IsConstructor|.
 extern bool
--- a/js/src/vm/NativeObject.cpp
+++ b/js/src/vm/NativeObject.cpp
@@ -1726,18 +1726,18 @@ js::NativeGetOwnPropertyDescriptor(JSCon
 
 static inline bool
 CallGetter(JSContext* cx, HandleObject obj, HandleValue receiver, HandleShape shape,
            MutableHandleValue vp)
 {
     MOZ_ASSERT(!shape->hasDefaultGetter());
 
     if (shape->hasGetterValue()) {
-        Value fval = shape->getterValue();
-        return InvokeGetter(cx, receiver, fval, vp);
+        RootedValue getter(cx, shape->getterValue());
+        return js::CallGetter(cx, receiver, getter, vp);
     }
 
     // In contrast to normal getters JSGetterOps always want the holder.
     RootedId id(cx, shape->propid());
     return CallJSGetterOp(cx, shape->getterOp(), obj, id, vp);
 }
 
 template <AllowGC allowGC>
@@ -2343,19 +2343,21 @@ SetExistingProperty(JSContext* cx, Handl
         return SetPropertyByDefining(cx, id, v, receiver, result);
     }
 
     // Steps 6-11.
     MOZ_ASSERT(shape->isAccessorDescriptor());
     MOZ_ASSERT_IF(!shape->hasSetterObject(), shape->hasDefaultSetter());
     if (shape->hasDefaultSetter())
         return result.fail(JSMSG_GETTER_ONLY);
-    Value setter = ObjectValue(*shape->setterObject());
-    if (!InvokeSetter(cx, receiver, setter, v))
+
+    RootedValue setter(cx, ObjectValue(*shape->setterObject()));
+    if (!js::CallSetter(cx, receiver, setter, v))
         return false;
+
     return result.succeed();
 }
 
 bool
 js::NativeSetProperty(JSContext* cx, HandleNativeObject obj, HandleId id, HandleValue value,
                       HandleValue receiver, QualifiedBool qualified, ObjectOpResult& result)
 {
     // Fire watchpoints, if any.