Bug 1066238 - Part 2: Emitter support for static class methods. (r=jorendorff)
authorEric Faust <efaustbmo@gmail.com>
Thu, 26 Feb 2015 15:05:24 -0800
changeset 231108 4ca8f8762fd9bbecd4f89534d54b7b0ac05a746a
parent 231107 5bda72dc35cb196b5b0d0027d6b37a2c9beb211d
child 231109 682921d1eb3bf65e84003b45e7d9ce3ce4774420
push id28344
push userryanvm@gmail.com
push dateFri, 27 Feb 2015 18:20:08 +0000
treeherdermozilla-central@9dd9d1e5b43c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1066238
milestone39.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 1066238 - Part 2: Emitter support for static class methods. (r=jorendorff)
js/src/frontend/BytecodeEmitter.cpp
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -6574,16 +6574,25 @@ EmitPropertyList(ExclusiveContext *cx, B
             if (!EmitTree(cx, bce, propdef->pn_kid))
                 return false;
             objp.set(nullptr);
             if (!Emit1(cx, bce, JSOP_MUTATEPROTO))
                 return false;
             continue;
         }
 
+        bool extraPop = false;
+        if (type == ClassBody && propdef->as<ClassMethod>().isStatic()) {
+            extraPop = true;
+            if (Emit1(cx, bce, JSOP_DUP2) < 0)
+                return false;
+            if (Emit1(cx, bce, JSOP_POP) < 0)
+                return false;
+        }
+
         /* Emit an index for t[2] for later consumption by JSOP_INITELEM. */
         ParseNode *key = propdef->pn_left;
         bool isIndex = false;
         if (key->isKind(PNK_NUMBER)) {
             if (!EmitNumberOp(cx, key->pn_dval, bce))
                 return false;
             isIndex = true;
         } else if (key->isKind(PNK_OBJECT_PROPERTY_NAME) || key->isKind(PNK_STRING)) {
@@ -6647,16 +6656,21 @@ EmitPropertyList(ExclusiveContext *cx, B
                 }
                 if (objp->inDictionaryMode())
                     objp.set(nullptr);
             }
 
             if (!EmitIndex32(cx, op, index, bce))
                 return false;
         }
+
+        if (extraPop) {
+            if (Emit1(cx, bce, JSOP_POP) < 0)
+                return false;
+        }
     }
     return true;
 }
 
 /*
  * Using MOZ_NEVER_INLINE in here is a workaround for llvm.org/pr14047. See
  * the comment on EmitSwitch.
  */