/[jscoverage]/trunk/js/jsopcode.h
ViewVC logotype

Diff of /trunk/js/jsopcode.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 459 by siliconforks, Tue Dec 9 03:37:47 2008 UTC revision 460 by siliconforks, Sat Sep 26 23:15:22 2009 UTC
# Line 65  Line 65 
65   */   */
66  #define JOF_BYTE          0       /* single bytecode, no immediates */  #define JOF_BYTE          0       /* single bytecode, no immediates */
67  #define JOF_JUMP          1       /* signed 16-bit jump offset immediate */  #define JOF_JUMP          1       /* signed 16-bit jump offset immediate */
68  #define JOF_ATOM          2       /* unsigned 16-bit constant pool index */  #define JOF_ATOM          2       /* unsigned 16-bit constant index */
69  #define JOF_UINT16        3       /* unsigned 16-bit immediate operand */  #define JOF_UINT16        3       /* unsigned 16-bit immediate operand */
70  #define JOF_TABLESWITCH   4       /* table switch */  #define JOF_TABLESWITCH   4       /* table switch */
71  #define JOF_LOOKUPSWITCH  5       /* lookup switch */  #define JOF_LOOKUPSWITCH  5       /* lookup switch */
72  #define JOF_QARG          6       /* quickened get/set function argument ops */  #define JOF_QARG          6       /* quickened get/set function argument ops */
73  #define JOF_LOCAL         7       /* var or block-local variable */  #define JOF_LOCAL         7       /* var or block-local variable */
74  #define JOF_SLOTATOM      8       /* uint16 slot index + constant pool index */  #define JOF_SLOTATOM      8       /* uint16 slot + constant index */
75  #define JOF_JUMPX         9       /* signed 32-bit jump offset immediate */  #define JOF_JUMPX         9       /* signed 32-bit jump offset immediate */
76  #define JOF_TABLESWITCHX  10      /* extended (32-bit offset) table switch */  #define JOF_TABLESWITCHX  10      /* extended (32-bit offset) table switch */
77  #define JOF_LOOKUPSWITCHX 11      /* extended (32-bit offset) lookup switch */  #define JOF_LOOKUPSWITCHX 11      /* extended (32-bit offset) lookup switch */
# Line 79  Line 79 
79  #define JOF_UINT8         13      /* uint8 immediate, e.g. top 8 bits of 24-bit  #define JOF_UINT8         13      /* uint8 immediate, e.g. top 8 bits of 24-bit
80                                       atom index */                                       atom index */
81  #define JOF_INT32         14      /* int32 immediate operand */  #define JOF_INT32         14      /* int32 immediate operand */
82  #define JOF_OBJECT        15      /* unsigned 16-bit object pool index */  #define JOF_OBJECT        15      /* unsigned 16-bit object index */
83  #define JOF_SLOTOBJECT    16      /* uint16 slot index + object pool index */  #define JOF_SLOTOBJECT    16      /* uint16 slot index + object index */
84  #define JOF_REGEXP        17      /* unsigned 16-bit regexp pool index */  #define JOF_REGEXP        17      /* unsigned 16-bit regexp index */
85  #define JOF_INT8          18      /* int8 immediate operand */  #define JOF_INT8          18      /* int8 immediate operand */
86    #define JOF_ATOMOBJECT    19      /* uint16 constant index + object index */
87  #define JOF_TYPEMASK      0x001f  /* mask for above immediate types */  #define JOF_TYPEMASK      0x001f  /* mask for above immediate types */
88    
89  #define JOF_NAME          (1U<<5) /* name operation */  #define JOF_NAME          (1U<<5) /* name operation */
# Line 225  Line 226 
226  #define INDEX_LIMIT_LOG2        23  #define INDEX_LIMIT_LOG2        23
227  #define INDEX_LIMIT             ((uint32)1 << INDEX_LIMIT_LOG2)  #define INDEX_LIMIT             ((uint32)1 << INDEX_LIMIT_LOG2)
228    
 JS_STATIC_ASSERT(sizeof(uint32) * JS_BITS_PER_BYTE >= INDEX_LIMIT_LOG2 + 1);  
   
229  /* Actual argument count operand format helpers. */  /* Actual argument count operand format helpers. */
230  #define ARGC_HI(argc)           UINT16_HI(argc)  #define ARGC_HI(argc)           UINT16_HI(argc)
231  #define ARGC_LO(argc)           UINT16_LO(argc)  #define ARGC_LO(argc)           UINT16_LO(argc)
# Line 345  Line 344 
344   * or JSOP_NEWARRAY (for such ops, JSCodeSpec.nuses is -1).   * or JSOP_NEWARRAY (for such ops, JSCodeSpec.nuses is -1).
345   */   */
346  extern uintN  extern uintN
347  js_GetVariableStackUseLength(JSOp op, jsbytecode *pc);  js_GetVariableStackUses(JSOp op, jsbytecode *pc);
348    
349    /*
350     * Find the number of stack slots defined by JSOP_ENTERBLOCK (for this op,
351     * JSCodeSpec.ndefs is -1).
352     */
353    extern uintN
354    js_GetEnterBlockStackDefs(JSContext *cx, JSScript *script, jsbytecode *pc);
355    
356    #ifdef __cplusplus /* Aargh, libgjs, bug 492720. */
357    static JS_INLINE uintN
358    js_GetStackUses(const JSCodeSpec *cs, JSOp op, jsbytecode *pc)
359    {
360        JS_ASSERT(cs == &js_CodeSpec[op]);
361        if (cs->nuses >= 0)
362            return cs->nuses;
363        return js_GetVariableStackUses(op, pc);
364    }
365    
366    static JS_INLINE uintN
367    js_GetStackDefs(JSContext *cx, const JSCodeSpec *cs, JSOp op, JSScript *script,
368                    jsbytecode *pc)
369    {
370        JS_ASSERT(cs == &js_CodeSpec[op]);
371        if (cs->ndefs >= 0)
372            return cs->ndefs;
373    
374        /* Only JSOP_ENTERBLOCK has a variable number of stack defs. */
375        JS_ASSERT(op == JSOP_ENTERBLOCK);
376        return js_GetEnterBlockStackDefs(cx, script, pc);
377    }
378    #endif
379    
380  #ifdef DEBUG  #ifdef DEBUG
381  /*  /*

Legend:
Removed from v.459  
changed lines
  Added in v.460

  ViewVC Help
Powered by ViewVC 1.1.24