NAME
JSPL::SM::Opcode - Class that encapsulates SpiderMonkey's jsopcodes.
SYNOPSYS
use JSPL::SM::Opcode qw(:opcodes @Opcodes);
my $oppush = $Opcodes[JSOP_PUSH];
print $oppush->name; # 'push'
DESCRIPTION
Provides access to SM's jsopcodes. Useful if you ever need to work with SpiderMonkey bytecode. See jsopcode.tbl is SM sources for details.
EXPORT TAGS
INTERFACE
@Opcodes
This array hold the jsopcodes defined in SM. Every value is an JSPL::SM::Opcode
object. You can use the JSOP_*
constants for indexing @Opcodes
.
INSTANCE METHODS
- id
-
Returns the id of the jsopcode. For example "JSOP_PUSH"
- val
-
Returns the number of the jsopcode, that is its index in
@Opcodes
. - name
-
Returns the name of the jsopcode. For example "push".
- len
-
Returns the length of the jsopcode in bytes including any immediate operands, or -1 for jsopcodes with variable len.
- uses
-
Returns the number of stack elements consumed by the jsopcode, -1 if variadic.
- defs
-
Returns the number of stack elements produced by the jsopcode.
- prec
-
Returns the operator precedence, zero if not an operator.
- format
-
Returns the encoding format of the jsopcode.