Bug 921548 - Remove js_ValueToNonNullObject, which was entirely equivalent to ToObject. r=jorendorff
☠☠ backed out by 225dc58d80c3 ☠ ☠
authorJeff Walden <jwalden@mit.edu>
Fri, 27 Sep 2013 11:19:47 -0700
changeset 149446 28eab6ee74256dba0dc5f47c36c20f872ad2013a
parent 149445 e8764878be4425442715a38d20af88f51e7e4fcf
child 149447 0a76209b85d2015bb94ae1a0d541b2ac4da0b96d
push id25389
push userryanvm@gmail.com
push dateTue, 01 Oct 2013 20:35:30 +0000
treeherdermozilla-central@4364824a4cab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs921548
milestone27.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 921548 - Remove js_ValueToNonNullObject, which was entirely equivalent to ToObject. r=jorendorff
js/src/builtin/MapObject.cpp
js/src/jsiter.cpp
js/src/jsobj.cpp
js/src/jsobj.h
js/src/vm/Interpreter.cpp
--- a/js/src/builtin/MapObject.cpp
+++ b/js/src/builtin/MapObject.cpp
@@ -1170,17 +1170,17 @@ MapObject::construct(JSContext *cx, unsi
         return false;
     }
     obj->setPrivate(map);
 
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.hasDefined(0)) {
         ForOfIterator iter(cx, args[0]);
         while (iter.next()) {
-            RootedObject pairobj(cx, js_ValueToNonNullObject(cx, iter.value()));
+            RootedObject pairobj(cx, ToObject(cx, iter.value()));
             if (!pairobj)
                 return false;
 
             RootedValue key(cx);
             if (!JSObject::getElement(cx, pairobj, pairobj, 0, &key))
                 return false;
 
             AutoHashableValueRooter hkey(cx);
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -980,17 +980,17 @@ js::ValueToIterator(JSContext *cx, unsig
          * but it's "web JS" compatible. ES5 fixed for-in to match this de-facto
          * standard.
          */
         if (flags & JSITER_ENUMERATE) {
             if (!js_ValueToObjectOrNull(cx, vp, &obj))
                 return false;
             /* fall through */
         } else {
-            obj = js_ValueToNonNullObject(cx, vp);
+            obj = ToObject(cx, vp);
             if (!obj)
                 return false;
         }
     }
 
     return GetIterator(cx, obj, flags, vp);
 }
 
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -5180,30 +5180,16 @@ js::ToObjectSlow(JSContext *cx, HandleVa
                                  val.isNull() ? "null" : "undefined", "object");
         }
         return NULL;
     }
 
     return PrimitiveToObject(cx, val);
 }
 
-JSObject *
-js_ValueToNonNullObject(JSContext *cx, const Value &v)
-{
-    RootedObject obj(cx);
-
-    if (!js_ValueToObjectOrNull(cx, v, &obj))
-        return NULL;
-    if (!obj) {
-        RootedValue val(cx, v);
-        js_ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, NullPtr());
-    }
-    return obj;
-}
-
 void
 js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
 {
     JS_ASSERT(trc->debugPrinter == js_GetObjectSlotName);
 
     JSObject *obj = (JSObject *)trc->debugPrintArg;
     uint32_t slot = uint32_t(trc->debugPrintIndex);
 
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1463,20 +1463,16 @@ GetObjectElementOperationPure(ThreadSafe
 extern JSObject *
 PrimitiveToObject(JSContext *cx, const Value &v);
 
 } /* namespace js */
 
 extern bool
 js_ValueToObjectOrNull(JSContext *cx, const js::Value &v, JS::MutableHandleObject objp);
 
-/* Throws if v could not be converted to an object. */
-extern JSObject *
-js_ValueToNonNullObject(JSContext *cx, const js::Value &v);
-
 namespace js {
 
 /*
  * Invokes the ES5 ToObject algorithm on vp, returning the result. If vp might
  * already be an object, use ToObject. reportCantConvert controls how null and
  * undefined errors are reported.
  */
 extern JSObject *
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -814,17 +814,17 @@ js::TypeOfValue(const Value &v)
  */
 static bool
 EnterWith(JSContext *cx, AbstractFramePtr frame, HandleValue val, uint32_t stackDepth)
 {
     RootedObject obj(cx);
     if (val.isObject()) {
         obj = &val.toObject();
     } else {
-        obj = js_ValueToNonNullObject(cx, val);
+        obj = ToObject(cx, val);
         if (!obj)
             return false;
     }
 
     RootedObject scopeChain(cx, frame.scopeChain());
     WithObject *withobj = WithObject::create(cx, obj, scopeChain, stackDepth);
     if (!withobj)
         return false;