Backout a17bb92b2d52 for bustage, CLOSED TREE.
authorKannan Vijayan <kvijayan@mozilla.com>
Mon, 27 May 2013 11:40:51 -0400
changeset 133047 f1992b1f5c42a74b101f3a9285b3345f23c8ddbd
parent 133046 291792974254b70a3029c476aaeb6d39921b71c0
child 133048 1ab5cdb9d252075df4f965fd0cd7a1a4a95cd7bc
push id24738
push userphilringnalda@gmail.com
push dateTue, 28 May 2013 01:51:52 +0000
treeherdermozilla-central@1d6a04be8c0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone24.0a1
backs outa17bb92b2d528a06029ac0af3b552b046929be00
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
Backout a17bb92b2d52 for bustage, CLOSED TREE.
js/src/jsinterp.cpp
js/src/vm/Stack-inl.h
js/src/vm/Stack.cpp
js/src/vm/Stack.h
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -2463,16 +2463,22 @@ END_CASE(JSOP_ARGUMENTS)
 
 BEGIN_CASE(JSOP_REST)
 {
     RootedObject &rest = rootObject0;
     rest = regs.fp()->createRestParameter(cx);
     if (!rest)
         goto error;
     PUSH_COPY(ObjectValue(*rest));
+    if (!SetInitializerObjectType(cx, script, regs.pc, rest, GenericObject))
+        goto error;
+    rootType0 = GetTypeCallerInitObject(cx, JSProto_Array);
+    if (!rootType0)
+        goto error;
+    rest->setType(rootType0);
 }
 END_CASE(JSOP_REST)
 
 BEGIN_CASE(JSOP_CALLALIASEDVAR)
 BEGIN_CASE(JSOP_GETALIASEDVAR)
 {
     ScopeCoordinate sc = ScopeCoordinate(regs.pc);
     PUSH_COPY(regs.fp()->aliasedVarScope(sc).aliasedVar(sc));
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -116,16 +116,25 @@ StackFrame::initCallFrame(JSContext *cx,
 }
 
 inline void
 StackFrame::initVarsToUndefined()
 {
     SetValueRangeToUndefined(slots(), script()->nfixed);
 }
 
+inline JSObject *
+StackFrame::createRestParameter(JSContext *cx)
+{
+    JS_ASSERT(fun()->hasRest());
+    unsigned nformal = fun()->nargs - 1, nactual = numActualArgs();
+    unsigned nrest = (nactual > nformal) ? nactual - nformal : 0;
+    return NewDenseCopiedArray(cx, nrest, argv() + nformal, NULL);
+}
+
 inline Value &
 StackFrame::unaliasedVar(unsigned i, MaybeCheckAliasing checkAliasing)
 {
     JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i));
     JS_ASSERT(i < script()->nfixed);
     return slots()[i];
 }
 
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -221,39 +221,16 @@ StackFrame::copyRawFrameSlots(AutoValueV
 {
     if (!vec->resize(numFormalArgs() + script()->nfixed))
         return false;
     PodCopy(vec->begin(), argv(), numFormalArgs());
     PodCopy(vec->begin() + numFormalArgs(), slots(), script()->nfixed);
     return true;
 }
 
-JSObject *
-StackFrame::createRestParameter(JSContext *cx)
-{
-    JS_ASSERT(fun()->hasRest());
-    unsigned nformal = fun()->nargs - 1, nactual = numActualArgs();
-    unsigned nrest = (nactual > nformal) ? nactual - nformal : 0;
-    Value *restvp = actuals() + nformal;
-    RootedObject obj(cx, NewDenseCopiedArray(cx, nrest, restvp, NULL));
-    if (!obj)
-        return NULL;
-
-    RootedTypeObject type(cx, types::GetTypeCallerInitObject(cx, JSProto_Array));
-    if (!type)
-        return NULL;
-    obj->setType(type);
-
-    /* Ensure that values in the rest array are represented in the type of the array. */
-    for (unsigned i = 0; i < nrest; i++)
-        types::AddTypePropertyId(cx, obj, JSID_VOID, restvp[i]);
-
-    return obj;
-}
-
 static inline void
 AssertDynamicScopeMatchesStaticScope(JSContext *cx, JSScript *script, JSObject *scope)
 {
 #ifdef DEBUG
     RootedObject enclosingScope(cx, script->enclosingStaticScope());
     for (StaticScopeIter i(cx, enclosingScope); !i.done(); i++) {
         if (i.hasDynamicScopeObject()) {
             /*
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -539,17 +539,17 @@ class StackFrame
      * mutable, the arguments object can be overwritten and we can "lose" the
      * arguments object. Thus, StackFrame keeps an explicit argsObj_ field so
      * that the original arguments object is always available.
      */
 
     ArgumentsObject &argsObj() const;
     void initArgsObj(ArgumentsObject &argsobj);
 
-    JSObject *createRestParameter(JSContext *cx);
+    inline JSObject *createRestParameter(JSContext *cx);
 
     /*
      * Scope chain
      *
      * In theory, the scope chain would contain an object for every lexical
      * scope. However, only objects that are required for dynamic lookup are
      * actually created.
      *