Bug 1270977 - Replace a bunch of CallReceiver uses with CallArgs. r=efaust
authorJeff Walden <jwalden@mit.edu>
Thu, 26 May 2016 12:52:36 -0700
changeset 338448 870bdb6e2b8f3dca4324639ddef2029005b10e51
parent 338447 daf0dcb26912c67498d49e67d7bc3425c96870d5
child 338449 b4938a38f3c0c840b81f6988d53dc25f30acf6c7
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersefaust
bugs1270977
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1270977 - Replace a bunch of CallReceiver uses with CallArgs. r=efaust
js/src/builtin/MapObject.cpp
js/src/builtin/MapObject.h
js/src/jsfun.cpp
js/src/jsfun.h
js/src/proxy/ScriptedProxyHandler.cpp
--- a/js/src/builtin/MapObject.cpp
+++ b/js/src/builtin/MapObject.cpp
@@ -581,21 +581,21 @@ MapObject::is(HandleObject o)
 ValueMap&
 MapObject::extract(HandleObject o)
 {
     MOZ_ASSERT(o->hasClass(&MapObject::class_));
     return *o->as<MapObject>().getData();
 }
 
 ValueMap&
-MapObject::extract(CallReceiver call)
+MapObject::extract(const CallArgs& args)
 {
-    MOZ_ASSERT(call.thisv().isObject());
-    MOZ_ASSERT(call.thisv().toObject().hasClass(&MapObject::class_));
-    return *call.thisv().toObject().as<MapObject>().getData();
+    MOZ_ASSERT(args.thisv().isObject());
+    MOZ_ASSERT(args.thisv().toObject().hasClass(&MapObject::class_));
+    return *args.thisv().toObject().as<MapObject>().getData();
 }
 
 uint32_t
 MapObject::size(JSContext* cx, HandleObject obj)
 {
     ValueMap& map = extract(obj);
     static_assert(sizeof(map.count()) <= sizeof(uint32_t),
                   "map count must be precisely representable as a JS number");
@@ -1203,21 +1203,21 @@ SetObject::is(HandleObject o)
 ValueSet &
 SetObject::extract(HandleObject o)
 {
     MOZ_ASSERT(o->hasClass(&SetObject::class_));
     return *o->as<SetObject>().getData();
 }
 
 ValueSet &
-SetObject::extract(CallReceiver call)
+SetObject::extract(const CallArgs& args)
 {
-    MOZ_ASSERT(call.thisv().isObject());
-    MOZ_ASSERT(call.thisv().toObject().hasClass(&SetObject::class_));
-    return *static_cast<SetObject&>(call.thisv().toObject()).getData();
+    MOZ_ASSERT(args.thisv().isObject());
+    MOZ_ASSERT(args.thisv().toObject().hasClass(&SetObject::class_));
+    return *static_cast<SetObject&>(args.thisv().toObject()).getData();
 }
 
 uint32_t
 SetObject::size(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(SetObject::is(obj));
     ValueSet &set = extract(obj);
     static_assert(sizeof(set.count()) <= sizeof(uint32_t),
--- a/js/src/builtin/MapObject.h
+++ b/js/src/builtin/MapObject.h
@@ -112,18 +112,18 @@ class MapObject : public NativeObject {
 
   private:
     static const ClassOps classOps_;
 
     static const JSPropertySpec properties[];
     static const JSFunctionSpec methods[];
     static const JSPropertySpec staticProperties[];
     ValueMap* getData() { return static_cast<ValueMap*>(getPrivate()); }
-    static ValueMap & extract(HandleObject o);
-    static ValueMap & extract(CallReceiver call);
+    static ValueMap& extract(HandleObject o);
+    static ValueMap& extract(const CallArgs& args);
     static void mark(JSTracer* trc, JSObject* obj);
     static void finalize(FreeOp* fop, JSObject* obj);
     static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
 
     static bool is(HandleValue v);
     static bool is(HandleObject o);
 
     static MOZ_MUST_USE bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
@@ -199,18 +199,18 @@ class SetObject : public NativeObject {
   private:
     static const ClassOps classOps_;
 
     static const JSPropertySpec properties[];
     static const JSFunctionSpec methods[];
     static const JSPropertySpec staticProperties[];
 
     ValueSet* getData() { return static_cast<ValueSet*>(getPrivate()); }
-    static ValueSet & extract(HandleObject o);
-    static ValueSet & extract(CallReceiver call);
+    static ValueSet& extract(HandleObject o);
+    static ValueSet& extract(const CallArgs& args);
     static void mark(JSTracer* trc, JSObject* obj);
     static void finalize(FreeOp* fop, JSObject* obj);
     static bool construct(JSContext* cx, unsigned argc, Value* vp);
 
     static bool is(HandleValue v);
     static bool is(HandleObject o);
 
     static MOZ_MUST_USE bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -2336,19 +2336,19 @@ js::DefineFunction(JSContext* cx, Handle
     RootedValue funVal(cx, ObjectValue(*fun));
     if (!DefineProperty(cx, obj, id, funVal, gop, sop, flags & ~JSFUN_FLAGS_MASK))
         return nullptr;
 
     return fun;
 }
 
 void
-js::ReportIncompatibleMethod(JSContext* cx, CallReceiver call, const Class* clasp)
+js::ReportIncompatibleMethod(JSContext* cx, const CallArgs& args, const Class* clasp)
 {
-    RootedValue thisv(cx, call.thisv());
+    RootedValue thisv(cx, args.thisv());
 
 #ifdef DEBUG
     if (thisv.isObject()) {
         MOZ_ASSERT(thisv.toObject().getClass() != clasp ||
                    !thisv.toObject().isNative() ||
                    !thisv.toObject().staticPrototype() ||
                    thisv.toObject().staticPrototype()->getClass() != clasp);
     } else if (thisv.isString()) {
@@ -2359,33 +2359,33 @@ js::ReportIncompatibleMethod(JSContext* 
         MOZ_ASSERT(clasp != &BooleanObject::class_);
     } else if (thisv.isSymbol()) {
         MOZ_ASSERT(clasp != &SymbolObject::class_);
     } else {
         MOZ_ASSERT(thisv.isUndefined() || thisv.isNull());
     }
 #endif
 
-    if (JSFunction* fun = ReportIfNotFunction(cx, call.calleev())) {
+    if (JSFunction* fun = ReportIfNotFunction(cx, args.calleev())) {
         JSAutoByteString funNameBytes;
         if (const char* funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
             JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
                                  clasp->name, funName, InformalValueTypeName(thisv));
         }
     }
 }
 
 void
-js::ReportIncompatible(JSContext* cx, CallReceiver call)
+js::ReportIncompatible(JSContext* cx, const CallArgs& args)
 {
-    if (JSFunction* fun = ReportIfNotFunction(cx, call.calleev())) {
+    if (JSFunction* fun = ReportIfNotFunction(cx, args.calleev())) {
         JSAutoByteString funNameBytes;
         if (const char* funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
             JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
-                                 funName, "method", InformalValueTypeName(call.thisv()));
+                                 funName, "method", InformalValueTypeName(args.thisv()));
         }
     }
 }
 
 namespace JS {
 namespace detail {
 
 JS_PUBLIC_API(void)
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -796,24 +796,24 @@ XDRInterpretedFunction(XDRState<mode>* x
                        HandleScript enclosingScript, MutableHandleFunction objp);
 
 /*
  * Report an error that call.thisv is not compatible with the specified class,
  * assuming that the method (clasp->name).prototype.<name of callee function>
  * is what was called.
  */
 extern void
-ReportIncompatibleMethod(JSContext* cx, CallReceiver call, const Class* clasp);
+ReportIncompatibleMethod(JSContext* cx, const CallArgs& args, const Class* clasp);
 
 /*
  * Report an error that call.thisv is not an acceptable this for the callee
  * function.
  */
 extern void
-ReportIncompatible(JSContext* cx, CallReceiver call);
+ReportIncompatible(JSContext* cx, const CallArgs& args);
 
 extern const JSFunctionSpec function_methods[];
 extern const JSFunctionSpec function_selfhosted_methods[];
 
 extern bool
 fun_apply(JSContext* cx, unsigned argc, Value* vp);
 
 extern bool
--- a/js/src/proxy/ScriptedProxyHandler.cpp
+++ b/js/src/proxy/ScriptedProxyHandler.cpp
@@ -1385,31 +1385,31 @@ js::proxy(JSContext* cx, unsigned argc, 
         return false;
 
     return ProxyCreate(cx, args, "Proxy");
 }
 
 static bool
 RevokeProxy(JSContext* cx, unsigned argc, Value* vp)
 {
-    CallReceiver rec = CallReceiverFromVp(vp);
+    CallArgs args = CallArgsFromVp(argc, vp);
 
-    RootedFunction func(cx, &rec.callee().as<JSFunction>());
+    RootedFunction func(cx, &args.callee().as<JSFunction>());
     RootedObject p(cx, func->getExtendedSlot(ScriptedProxyHandler::REVOKE_SLOT).toObjectOrNull());
 
     if (p) {
         func->setExtendedSlot(ScriptedProxyHandler::REVOKE_SLOT, NullValue());
 
         MOZ_ASSERT(p->is<ProxyObject>());
 
         p->as<ProxyObject>().setSameCompartmentPrivate(NullValue());
         p->as<ProxyObject>().setExtra(ScriptedProxyHandler::HANDLER_EXTRA, NullValue());
     }
 
-    rec.rval().setUndefined();
+    args.rval().setUndefined();
     return true;
 }
 
 bool
 js::proxy_revocable(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);