Bug 720316 - Remove the entirely-unused JOF_SLOTATOM. r=luke
authorJeff Walden <jwalden@mit.edu>
Wed, 18 Jan 2012 16:55:59 -0800
changeset 87975 6a2a7edff3c554a1db08794ffe771a93a91526c2
parent 87974 271838a8bc5ea69c8f1634072973fd2cfa676b8e
child 87976 f8d4887aae8df037b0c8a45b3349601c21f958b5
push idunknown
push userunknown
push dateunknown
reviewersluke
bugs720316
milestone12.0a1
Bug 720316 - Remove the entirely-unused JOF_SLOTATOM. r=luke
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/jsopcode.cpp
js/src/jsopcode.h
js/src/jsopcodeinlines.h
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -329,21 +329,17 @@ frontend::CompileScript(JSContext *cx, J
         code = bce.base();
         for (end = code + bce.offset(); code != end; code += len) {
             JS_ASSERT(code < end);
             op = (JSOp) *code;
             cs = &js_CodeSpec[op];
             len = (cs->length > 0)
                   ? (uintN) cs->length
                   : js_GetVariableBytecodeLength(code);
-            if ((cs->format & JOF_SHARPSLOT) ||
-                JOF_TYPE(cs->format) == JOF_LOCAL ||
-                (JOF_TYPE(cs->format) == JOF_SLOTATOM)) {
-                JS_ASSERT_IF(!(cs->format & JOF_SHARPSLOT),
-                             JOF_TYPE(cs->format) != JOF_SLOTATOM);
+            if ((cs->format & JOF_SHARPSLOT) || JOF_TYPE(cs->format) == JOF_LOCAL) {
                 slot = GET_SLOTNO(code);
                 if (!(cs->format & JOF_SHARPSLOT))
                     slot += bce.sharpSlots();
                 if (slot >= SLOTNO_LIMIT)
                     goto too_many_slots;
                 SET_SLOTNO(code, slot);
             }
         }
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -1027,18 +1027,17 @@ JS_STATIC_ASSERT(SLOTNO_LEN == 2);
 
 static JSBool
 EmitSlotIndexOp(JSContext *cx, JSOp op, uintN slot, uintN index, BytecodeEmitter *bce)
 {
     JSOp bigSuffix;
     ptrdiff_t off;
     jsbytecode *pc;
 
-    JS_ASSERT(JOF_OPTYPE(op) == JOF_SLOTATOM ||
-              JOF_OPTYPE(op) == JOF_SLOTOBJECT);
+    JS_ASSERT(JOF_OPTYPE(op) == JOF_SLOTOBJECT);
     bigSuffix = EmitBigIndexPrefix(cx, bce, index);
     if (bigSuffix == JSOP_FALSE)
         return JS_FALSE;
 
     /* Emit [op, slot, index]. */
     off = EmitN(cx, bce, op, 2 + INDEX_LEN);
     if (off < 0)
         return JS_FALSE;
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -652,28 +652,20 @@ js_Disassemble1(JSContext *cx, JSScript 
       case JOF_QARG:
         Sprint(sp, " %u", GET_ARGNO(pc));
         break;
 
       case JOF_LOCAL:
         Sprint(sp, " %u", GET_SLOTNO(pc));
         break;
 
-      case JOF_SLOTATOM:
       case JOF_SLOTOBJECT: {
         Sprint(sp, " %u", GET_SLOTNO(pc));
         uintN index = js_GetIndexFromBytecode(script, pc, SLOTNO_LEN);
-        jsval v;
-        if (type == JOF_SLOTATOM) {
-            JSAtom *atom = script->getAtom(index);
-            v = STRING_TO_JSVAL(atom);
-        } else {
-            v = OBJECT_TO_JSVAL(script->getObject(index));
-        }
-
+        jsval v = OBJECT_TO_JSVAL(script->getObject(index));
         JSAutoByteString bytes;
         if (!ToDisassemblySource(cx, v, &bytes))
             return 0;
         Sprint(sp, " %s", bytes.ptr());
         break;
       }
 
       {
--- a/js/src/jsopcode.h
+++ b/js/src/jsopcode.h
@@ -77,17 +77,17 @@ typedef enum JSOp {
 #define JOF_BYTE          0       /* single bytecode, no immediates */
 #define JOF_JUMP          1       /* signed 16-bit jump offset immediate */
 #define JOF_ATOM          2       /* unsigned 16-bit constant index */
 #define JOF_UINT16        3       /* unsigned 16-bit immediate operand */
 #define JOF_TABLESWITCH   4       /* table switch */
 #define JOF_LOOKUPSWITCH  5       /* lookup switch */
 #define JOF_QARG          6       /* quickened get/set function argument ops */
 #define JOF_LOCAL         7       /* var or block-local variable */
-#define JOF_SLOTATOM      8       /* uint16_t slot + constant index */
+/* 8 is unused */
 #define JOF_UINT24        12      /* extended unsigned 24-bit literal (index) */
 #define JOF_UINT8         13      /* uint8_t immediate, e.g. top 8 bits of 24-bit
                                      atom index */
 #define JOF_INT32         14      /* int32_t immediate operand */
 #define JOF_OBJECT        15      /* unsigned 16-bit object index */
 #define JOF_SLOTOBJECT    16      /* uint16_t slot index + object index */
 #define JOF_REGEXP        17      /* unsigned 16-bit regexp index */
 #define JOF_INT8          18      /* int8_t immediate operand */
--- a/js/src/jsopcodeinlines.h
+++ b/js/src/jsopcodeinlines.h
@@ -49,19 +49,18 @@ GetNameFromBytecode(JSContext *cx, jsbyt
         return cx->runtime->atomState.lengthAtom;
 
     // The method JIT's implementation of instanceof contains an internal lookup
     // of the prototype property.
     if (op == JSOP_INSTANCEOF)
         return cx->runtime->atomState.classPrototypeAtom;
 
     JSScript *script = cx->stack.currentScript();
-    ptrdiff_t pcoff = (JOF_TYPE(cs.format) == JOF_SLOTATOM) ? SLOTNO_LEN : 0;
     PropertyName *name;
-    GET_NAME_FROM_BYTECODE(script, pc, pcoff, name);
+    GET_NAME_FROM_BYTECODE(script, pc, 0, name);
     return name;
 }
 
 class BytecodeRange {
   public:
     BytecodeRange(JSScript *script)
       : script(script), pc(script->code), end(pc + script->length) {}
     bool empty() const { return pc == end; }