Bug 1320408 - Part 3: Remove JSContext* parameter from JSFunction::getBoundFunctionArgument. r=jandem
authorTooru Fujisawa <arai_a@mac.com>
Mon, 28 Nov 2016 12:29:17 +0900
changeset 324418 b509be16fc198e36e326f7fead273c273e3cd207
parent 324417 6b4e659892cee5ac0d89931f79bdf367807bf3c2
child 324419 71e72406179d7eade596031badf3aa679da75cfc
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjandem
bugs1320408
milestone53.0a1
Bug 1320408 - Part 3: Remove JSContext* parameter from JSFunction::getBoundFunctionArgument. r=jandem
js/src/jsfun.cpp
js/src/jsfun.h
js/src/vm/Debugger.cpp
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1348,23 +1348,20 @@ JSFunction::getBoundFunctionThis() const
 static ArrayObject*
 GetBoundFunctionArguments(const JSFunction* boundFun)
 {
     js::Value argsVal = BoundFunctionEnvironmentSlotValue(boundFun, JSSLOT_BOUND_FUNCTION_ARGS);
     return &argsVal.toObject().as<ArrayObject>();
 }
 
 const js::Value&
-JSFunction::getBoundFunctionArgument(JSContext* cx, unsigned which) const
+JSFunction::getBoundFunctionArgument(unsigned which) const
 {
     MOZ_ASSERT(which < getBoundFunctionArgumentCount());
-
-    RootedArrayObject boundArgs(cx, GetBoundFunctionArguments(this));
-    RootedValue res(cx);
-    return boundArgs->getDenseElement(which);
+    return GetBoundFunctionArguments(this)->getDenseElement(which);
 }
 
 size_t
 JSFunction::getBoundFunctionArgumentCount() const
 {
     return GetBoundFunctionArguments(this)->length();
 }
 
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -565,17 +565,17 @@ class JSFunction : public js::NativeObje
     }
 
     inline void trace(JSTracer* trc);
 
     /* Bound function accessors. */
 
     JSObject* getBoundFunctionTarget() const;
     const js::Value& getBoundFunctionThis() const;
-    const js::Value& getBoundFunctionArgument(JSContext* cx, unsigned which) const;
+    const js::Value& getBoundFunctionArgument(unsigned which) const;
     size_t getBoundFunctionArgumentCount() const;
 
   private:
     js::GCPtrScript& mutableScript() {
         MOZ_ASSERT(hasScript());
         return *(js::GCPtrScript*)&u.i.s.script_;
     }
 
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -9690,17 +9690,17 @@ DebuggerObject::getBoundArguments(JSCont
 
     RootedFunction referent(cx, &object->referent()->as<JSFunction>());
     Debugger* dbg = object->owner();
 
     size_t length = referent->getBoundFunctionArgumentCount();
     if (!result.resize(length))
         return false;
     for (size_t i = 0; i < length; i++) {
-        result[i].set(referent->getBoundFunctionArgument(cx, i));
+        result[i].set(referent->getBoundFunctionArgument(i));
         if (!dbg->wrapDebuggeeValue(cx, result[i]))
             return false;
     }
     return true;
 }
 
 /* static */ SavedFrame*
 Debugger::getObjectAllocationSite(JSObject& obj)