Small narcissus formatting fixes. (rs=brendan)
authorShu-yu Guo <shu@rfrn.org>
Fri, 24 Sep 2010 14:01:52 -0700
changeset 54708 372b3810f7f0ce35c4ed2043067614b44e5c9bef
parent 54707 1c913526c597640d9da597d180b0fe1e2fe2d2ad
child 54709 17ef96fe00951df2492527e170afa553ec05edce
push id16011
push userrsayre@mozilla.com
push dateWed, 29 Sep 2010 06:01:57 +0000
treeherdermozilla-central@d7e659b4f80c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbrendan
milestone2.0b7pre
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
Small narcissus formatting fixes. (rs=brendan)
js/narcissus/jsexec.js
js/narcissus/jsparse.js
js/narcissus/jsssa.js
--- a/js/narcissus/jsexec.js
+++ b/js/narcissus/jsexec.js
@@ -302,29 +302,29 @@ Narcissus.interpreter = (function() {
             if (v !== null)
                 return v;
         }
         var message = r + " (type " + (typeof v) + ") has no properties";
         throw rn ? new TypeError(message, rn.filename, rn.lineno)
                  : new TypeError(message);
     }
 
-    function valuatePhis(n, v) {
+    function evaluatePhis(n, v) {
         var ps = n.phiUses;
         if (!ps)
             return;
 
         for (var i = 0, j = ps.length; i < j; i++) {
             // If the thing we're valuating is already equal to the thing we want
             // to valuate it to, we have fully saturated (and have a cycle), and
             // thus we should break.
             if (ps[i].v === v)
                 break;
             ps[i].v = v;
-            valuatePhis(ps[i], v);
+            evaluatePhis(ps[i], v);
         }
     }
 
     function execute(n, x) {
         var a, f, i, j, r, s, t, u, v;
 
         switch (n.type) {
           case FUNCTION:
@@ -864,17 +864,17 @@ Narcissus.interpreter = (function() {
 
           default:
             throw "PANIC: unknown operation " + n.type + ": " + uneval(n);
         }
 
         if (n.backwards) {
             n.v = v;
         }
-        valuatePhis(n, v);
+        evaluatePhis(n, v);
 
         return v;
     }
 
     function Activation(f, a) {
         for (var i = 0, j = f.params.length; i < j; i++)
             definitions.defineProperty(this, f.params[i], a[i], true);
         definitions.defineProperty(this, "arguments", a, true);
--- a/js/narcissus/jsparse.js
+++ b/js/narcissus/jsparse.js
@@ -81,20 +81,18 @@ Narcissus.parser = (function() {
 
     function bindSubBuilders(builder, proto) {
         for (var ns in proto) {
             var unbound = proto[ns];
             // We do not want to bind functions like setHoists.
             if (typeof unbound !== "object")
                 continue;
 
-            /*
-             * We store the bound sub-builder as builder's own property
-             * so that we can have multiple builders at the same time.
-             */
+            // We store the bound sub-builder as builder's own property
+            // so that we can have multiple builders at the same time.
             var bound = builder[ns] = {};
             for (var m in unbound) {
                 bound[m] = bindMethod(unbound[m], builder);
             }
         }
     }
 
     /*
--- a/js/narcissus/jsssa.js
+++ b/js/narcissus/jsssa.js
@@ -1063,31 +1063,28 @@
      */
 
     function extendBuilder(child, super) {
         var childProto = child.prototype,
             superProto = super.prototype;
         for (var ns in super.prototype) {
             var childNS = childProto[ns];
             var superNS = superProto[ns];
-            var childNSType = typeof childNS;
-            if (childNSType === "undefined") {
+            if (childNS === undefined) {
                 childProto[ns] = superNS;
-            } else if (childNSType === "object") {
+            } else {
                 for (var m in superNS) {
                     let childMethod = childNS[m];
                     let superMethod = superNS[m];
-                    if (typeof childMethod === "undefined") {
+                    if (childMethod === undefined) {
                         childNS[m] = superMethod;
                     } else {
                         childNS[m] = function() {
-                            if (this.binds)
-                                return childMethod.apply(this, arguments);
-                            else
-                                return superMethod.apply(this, arguments);
+                            return (this.binds ? childMethod : superMethod)
+                                   .apply(this, arguments);
                         };
                     }
                 }
             }
         }
     }
 
     function SSABuilder() {