From 4035bd2c91e4a41b40e1c02afb68f8225f5c6000 Mon Sep 17 00:00:00 2001 From: "igor%mir2.org" Date: Thu, 1 Jul 2004 16:40:44 +0000 Subject: [PATCH] Removal of Tiken.UNDEFINED: it was not used outside Interpreter --- js/rhino/src/org/mozilla/javascript/IRFactory.java | 1 - js/rhino/src/org/mozilla/javascript/Interpreter.java | 12 +++++++----- js/rhino/src/org/mozilla/javascript/Token.java | 3 +-- .../org/mozilla/javascript/optimizer/Codegen.java | 4 ---- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/js/rhino/src/org/mozilla/javascript/IRFactory.java b/js/rhino/src/org/mozilla/javascript/IRFactory.java index 27fc391f0171..908094adf70a 100644 --- a/js/rhino/src/org/mozilla/javascript/IRFactory.java +++ b/js/rhino/src/org/mozilla/javascript/IRFactory.java @@ -1072,7 +1072,6 @@ final class IRFactory switch (node.getType()) { case Token.FALSE: case Token.NULL: - case Token.UNDEFINED: return ALWAYS_FALSE_BOOLEAN; case Token.TRUE: return ALWAYS_TRUE_BOOLEAN; diff --git a/js/rhino/src/org/mozilla/javascript/Interpreter.java b/js/rhino/src/org/mozilla/javascript/Interpreter.java index 5871b73bae9c..1ed39bd7ff93 100644 --- a/js/rhino/src/org/mozilla/javascript/Interpreter.java +++ b/js/rhino/src/org/mozilla/javascript/Interpreter.java @@ -129,8 +129,10 @@ public class Interpreter Icode_GETVAR1 = -43, Icode_SETVAR1 = -44, + Icode_UNDEF = -45, + // Last icode - MIN_ICODE = -44; + MIN_ICODE = -45; static { // Checks for byte code consistencies, good compiler can eliminate them @@ -727,7 +729,7 @@ public class Interpreter iCodeTop = generateICode(child, iCodeTop); if (type == Token.VOID) { iCodeTop = addToken(Token.POP, iCodeTop); - iCodeTop = addToken(Token.UNDEFINED, iCodeTop); + iCodeTop = addIcode(Icode_UNDEF, iCodeTop); } else { iCodeTop = addToken(type, iCodeTop); } @@ -1008,7 +1010,6 @@ public class Interpreter case Token.THISFN: case Token.FALSE: case Token.TRUE: - case Token.UNDEFINED: stackDelta = 1; iCodeTop = addToken(type, iCodeTop); itsStackDepth++; @@ -1640,6 +1641,7 @@ public class Interpreter case Icode_REG_STR4: return "LOAD_STR4"; case Icode_GETVAR1: return "GETVAR1"; case Icode_SETVAR1: return "SETVAR1"; + case Icode_UNDEF: return "UNDEF"; } // icode without name @@ -2776,8 +2778,8 @@ switch (op) { case Token.TRUE : stack[++stackTop] = Boolean.TRUE; continue Loop; - case Token.UNDEFINED : - stack[++stackTop] = Undefined.instance; + case Icode_UNDEF : + stack[++stackTop] = undefined; continue Loop; case Token.ENTERWITH : { Object lhs = stack[stackTop]; diff --git a/js/rhino/src/org/mozilla/javascript/Token.java b/js/rhino/src/org/mozilla/javascript/Token.java index b4054bdc6fe8..9d7f23a85c4e 100644 --- a/js/rhino/src/org/mozilla/javascript/Token.java +++ b/js/rhino/src/org/mozilla/javascript/Token.java @@ -131,7 +131,7 @@ public class Token LOCAL_LOAD = 57, GETVAR = 58, SETVAR = 59, - UNDEFINED = 60, +// XXX removed unused UNDEFINED CATCH_SCOPE = 61, ENUM_INIT = 62, ENUM_NEXT = 63, @@ -282,7 +282,6 @@ public class Token case LOCAL_LOAD: return "LOCAL_LOAD"; case GETVAR: return "GETVAR"; case SETVAR: return "SETVAR"; - case UNDEFINED: return "UNDEFINED"; case CATCH_SCOPE: return "CATCH_SCOPE"; case ENUM_INIT: return "ENUM_INIT"; case ENUM_NEXT: return "ENUM_NEXT"; diff --git a/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java b/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java index 13cefe10a2b8..95e3dc131c7c 100644 --- a/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java +++ b/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java @@ -1449,10 +1449,6 @@ class BodyCodegen "FALSE", "Ljava/lang/Boolean;"); break; - case Token.UNDEFINED: - Codegen.pushUndefined(cfw); - break; - case Token.REGEXP: visitRegexp(node); break;