Commit c8af3ef3 authored by cwzwarich@webkit.org's avatar cwzwarich@webkit.org

2008-12-08 Judit Jasz <jasy@inf.u-szeged.hu>

        Reviewed and tweaked by Cameron Zwarich.

        Bug 22352: Annotate opcodes with their length
        <https://bugs.webkit.org/show_bug.cgi?id=22352>

        * bytecode/Opcode.cpp:
        * bytecode/Opcode.h:
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::privateExecute):
        * jit/JIT.cpp:
        (JSC::JIT::privateCompileMainPass):
        (JSC::JIT::privateCompileSlowCases):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5a018f32
2008-12-08 Judit Jasz <jasy@inf.u-szeged.hu>
Reviewed and tweaked by Cameron Zwarich.
Bug 22352: Annotate opcodes with their length
<https://bugs.webkit.org/show_bug.cgi?id=22352>
* bytecode/Opcode.cpp:
* bytecode/Opcode.h:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
2008-12-08 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
......
......@@ -37,7 +37,7 @@ namespace JSC {
#if ENABLE(OPCODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(OPCODE_STATS)
const char* const opcodeNames[] = {
#define OPCODE_NAME_ENTRY(opcode) #opcode,
#define OPCODE_NAME_ENTRY(opcode, size) #opcode,
FOR_EACH_OPCODE_ID(OPCODE_NAME_ENTRY)
#undef OPCODE_NAME_ENTRY
};
......
......@@ -38,141 +38,147 @@
namespace JSC {
#define FOR_EACH_OPCODE_ID(macro) \
macro(op_enter) \
macro(op_enter_with_activation) \
macro(op_create_arguments) \
macro(op_convert_this) \
macro(op_enter, 1) \
macro(op_enter_with_activation, 2) \
macro(op_create_arguments, 1) \
macro(op_convert_this, 2) \
\
macro(op_unexpected_load) \
macro(op_new_object) \
macro(op_new_array) \
macro(op_new_regexp) \
macro(op_mov) \
macro(op_unexpected_load, 3) \
macro(op_new_object, 2) \
macro(op_new_array, 4) \
macro(op_new_regexp, 3) \
macro(op_mov, 3) \
\
macro(op_not) \
macro(op_eq) \
macro(op_eq_null) \
macro(op_neq) \
macro(op_neq_null) \
macro(op_stricteq) \
macro(op_nstricteq) \
macro(op_less) \
macro(op_lesseq) \
macro(op_not, 3) \
macro(op_eq, 4) \
macro(op_eq_null, 3) \
macro(op_neq, 4) \
macro(op_neq_null, 3) \
macro(op_stricteq, 4) \
macro(op_nstricteq, 4) \
macro(op_less, 4) \
macro(op_lesseq, 4) \
\
macro(op_pre_inc) \
macro(op_pre_dec) \
macro(op_post_inc) \
macro(op_post_dec) \
macro(op_to_jsnumber) \
macro(op_negate) \
macro(op_add) \
macro(op_mul) \
macro(op_div) \
macro(op_mod) \
macro(op_sub) \
macro(op_pre_inc, 2) \
macro(op_pre_dec, 2) \
macro(op_post_inc, 3) \
macro(op_post_dec, 3) \
macro(op_to_jsnumber, 3) \
macro(op_negate, 3) \
macro(op_add, 5) \
macro(op_mul, 5) \
macro(op_div, 4) \
macro(op_mod, 4) \
macro(op_sub, 5) \
\
macro(op_lshift) \
macro(op_rshift) \
macro(op_urshift) \
macro(op_bitand) \
macro(op_bitxor) \
macro(op_bitor) \
macro(op_bitnot) \
macro(op_lshift, 4) \
macro(op_rshift, 4) \
macro(op_urshift, 4) \
macro(op_bitand, 5) \
macro(op_bitxor, 5) \
macro(op_bitor, 5) \
macro(op_bitnot, 3) \
\
macro(op_instanceof) \
macro(op_typeof) \
macro(op_is_undefined) \
macro(op_is_boolean) \
macro(op_is_number) \
macro(op_is_string) \
macro(op_is_object) \
macro(op_is_function) \
macro(op_in) \
macro(op_instanceof, 5) \
macro(op_typeof, 3) \
macro(op_is_undefined, 3) \
macro(op_is_boolean, 3) \
macro(op_is_number, 3) \
macro(op_is_string, 3) \
macro(op_is_object, 3) \
macro(op_is_function, 3) \
macro(op_in, 4) \
\
macro(op_resolve) \
macro(op_resolve_skip) \
macro(op_resolve_global) \
macro(op_get_scoped_var) \
macro(op_put_scoped_var) \
macro(op_get_global_var) \
macro(op_put_global_var) \
macro(op_resolve_base) \
macro(op_resolve_with_base) \
macro(op_resolve_func) \
macro(op_get_by_id) \
macro(op_get_by_id_self) \
macro(op_get_by_id_self_list) \
macro(op_get_by_id_proto) \
macro(op_get_by_id_proto_list) \
macro(op_get_by_id_chain) \
macro(op_get_by_id_generic) \
macro(op_get_array_length) \
macro(op_get_string_length) \
macro(op_put_by_id) \
macro(op_put_by_id_transition) \
macro(op_put_by_id_replace) \
macro(op_put_by_id_generic) \
macro(op_del_by_id) \
macro(op_get_by_val) \
macro(op_put_by_val) \
macro(op_del_by_val) \
macro(op_put_by_index) \
macro(op_put_getter) \
macro(op_put_setter) \
macro(op_resolve, 3) \
macro(op_resolve_skip, 4) \
macro(op_resolve_global, 6) \
macro(op_get_scoped_var, 4) \
macro(op_put_scoped_var, 4) \
macro(op_get_global_var, 4) \
macro(op_put_global_var, 4) \
macro(op_resolve_base, 3) \
macro(op_resolve_with_base, 4) \
macro(op_resolve_func, 4) \
macro(op_get_by_id, 8) \
macro(op_get_by_id_self, 8) \
macro(op_get_by_id_self_list, 8) \
macro(op_get_by_id_proto, 8) \
macro(op_get_by_id_proto_list, 8) \
macro(op_get_by_id_chain, 8) \
macro(op_get_by_id_generic, 8) \
macro(op_get_array_length, 8) \
macro(op_get_string_length, 8) \
macro(op_put_by_id, 8) \
macro(op_put_by_id_transition, 8) \
macro(op_put_by_id_replace, 8) \
macro(op_put_by_id_generic, 8) \
macro(op_del_by_id, 4) \
macro(op_get_by_val, 4) \
macro(op_put_by_val, 4) \
macro(op_del_by_val, 4) \
macro(op_put_by_index, 4) \
macro(op_put_getter, 4) \
macro(op_put_setter, 4) \
\
macro(op_jmp) \
macro(op_jtrue) \
macro(op_jfalse) \
macro(op_jeq_null) \
macro(op_jneq_null) \
macro(op_jnless) \
macro(op_jmp_scopes) \
macro(op_loop) \
macro(op_loop_if_true) \
macro(op_loop_if_less) \
macro(op_loop_if_lesseq) \
macro(op_switch_imm) \
macro(op_switch_char) \
macro(op_switch_string) \
macro(op_jmp, 2) \
macro(op_jtrue, 3) \
macro(op_jfalse, 3) \
macro(op_jeq_null, 3) \
macro(op_jneq_null, 3) \
macro(op_jnless, 4) \
macro(op_jmp_scopes, 3) \
macro(op_loop, 2) \
macro(op_loop_if_true, 3) \
macro(op_loop_if_less, 4) \
macro(op_loop_if_lesseq, 4) \
macro(op_switch_imm, 4) \
macro(op_switch_char, 4) \
macro(op_switch_string, 4) \
\
macro(op_new_func) \
macro(op_new_func_exp) \
macro(op_call) \
macro(op_call_eval) \
macro(op_tear_off_activation) \
macro(op_tear_off_arguments) \
macro(op_ret) \
macro(op_new_func, 3) \
macro(op_new_func_exp, 3) \
macro(op_call, 5) \
macro(op_call_eval, 5) \
macro(op_tear_off_activation, 2) \
macro(op_tear_off_arguments, 1) \
macro(op_ret, 2) \
\
macro(op_construct) \
macro(op_construct_verify) \
macro(op_construct, 7) \
macro(op_construct_verify, 3) \
\
macro(op_get_pnames) \
macro(op_next_pname) \
macro(op_get_pnames, 3) \
macro(op_next_pname, 4) \
\
macro(op_push_scope) \
macro(op_pop_scope) \
macro(op_push_new_scope) \
macro(op_push_scope, 2) \
macro(op_pop_scope, 1) \
macro(op_push_new_scope, 4) \
\
macro(op_catch) \
macro(op_throw) \
macro(op_new_error) \
macro(op_catch, 2) \
macro(op_throw, 2) \
macro(op_new_error, 4) \
\
macro(op_jsr) \
macro(op_sret) \
macro(op_jsr, 3) \
macro(op_sret, 2) \
\
macro(op_debug) \
macro(op_profile_will_call) \
macro(op_profile_did_call) \
macro(op_debug, 4) \
macro(op_profile_will_call, 2) \
macro(op_profile_did_call, 2) \
\
macro(op_end) // end must be the last opcode in the list
macro(op_end, 2) // end must be the last opcode in the list
#define OPCODE_ID_ENUM(opcode) opcode,
#define OPCODE_ID_ENUM(opcode, length) opcode,
typedef enum { FOR_EACH_OPCODE_ID(OPCODE_ID_ENUM) } OpcodeID;
#undef OPCODE_ID_ENUM
const int numOpcodeIDs = op_end + 1;
#define VERIFY_OPCODE_ID(id) COMPILE_ASSERT(id <= op_end, ASSERT_THAT_JS_OPCODE_IDS_ARE_VALID);
#define OPCODE_ID_LENGTHS(id, length) const int id##_length = length;
FOR_EACH_OPCODE_ID(OPCODE_ID_LENGTHS);
#undef OPCODE_ID_SIZES
#define OPCODE_LENGTH(opcode) opcode##_length
#define VERIFY_OPCODE_ID(id, size) COMPILE_ASSERT(id <= op_end, ASSERT_THAT_JS_OPCODE_IDS_ARE_VALID);
FOR_EACH_OPCODE_ID(VERIFY_OPCODE_ID);
#undef VERIFY_OPCODE_ID
......
......@@ -1461,11 +1461,11 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
// here because our labels are only in scope inside this function.
if (flag == InitializeAndReturn) {
#if HAVE(COMPUTED_GOTO)
#define ADD_BYTECODE(id) m_opcodeTable[id] = &&id;
#define ADD_BYTECODE(id, length) m_opcodeTable[id] = &&id;
FOR_EACH_OPCODE_ID(ADD_BYTECODE);
#undef ADD_BYTECODE
#define ADD_OPCODE_ID(id) m_opcodeIDTable.add(&&id, id);
#define ADD_OPCODE_ID(id, length) m_opcodeIDTable.add(&&id, id);
FOR_EACH_OPCODE_ID(ADD_OPCODE_ID);
#undef ADD_OPCODE_ID
ASSERT(m_opcodeIDTable.size() == numOpcodeIDs);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment