Commit 3fc2985c authored by oliver@apple.com's avatar oliver@apple.com

Remove opcode definition autogen for now

https://bugs.webkit.org/show_bug.cgi?id=95148

Reviewed by Mark Hahnenberg.

This isn't worth doing at the moment.

* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/Opcode.h:
(JSC):
(JSC::padOpcodeName):
* bytecode/OpcodeDefinitions.h: Removed.
* bytecode/opcodes: Removed.
* opcode_definition_generator.py: Removed.
* opcode_generator.py: Removed.
* opcode_parser.py: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e171c076
2012-08-27 Oliver Hunt <oliver@apple.com>
Remove opcode definition autogen for now
https://bugs.webkit.org/show_bug.cgi?id=95148
Reviewed by Mark Hahnenberg.
This isn't worth doing at the moment.
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/Opcode.h:
(JSC):
(JSC::padOpcodeName):
* bytecode/OpcodeDefinitions.h: Removed.
* bytecode/opcodes: Removed.
* opcode_definition_generator.py: Removed.
* opcode_generator.py: Removed.
* opcode_parser.py: Removed.
2012-08-27 Mark Hahnenberg <mhahnenberg@apple.com>
Remove uses of TypedArray ClassInfo from SpeculativeJIT::checkArgumentTypes
......
......@@ -80,13 +80,6 @@ RegExpJitTables.h: create_regex_tables
KeywordLookup.h: KeywordLookupGenerator.py Keywords.table
python $^ > $@
# Don't autogenerate these yet, as there are some dependency problems
# interacting with the LLIntOffsetsExtractor
# opcode_generator.py: opcode_definition_generator.py opcode_parser.py
#
# OpcodeDefinitions.h: opcode_generator.py | bytecode/opcodes
# python $< -i $| -m definition -o $@
# udis86 instruction tables
udis86_itab.h: $(JavaScriptCore)/disassembler/udis86/itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
......
......@@ -140,9 +140,9 @@
0F63944015C75F1D006A597C /* DFGStructureCheckHoistingPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F63943C15C75F14006A597C /* DFGStructureCheckHoistingPhase.cpp */; };
0F63945415D07055006A597C /* ArrayProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F63945115D07051006A597C /* ArrayProfile.cpp */; };
0F63945515D07057006A597C /* ArrayProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F63945215D07051006A597C /* ArrayProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F63947815DCE34B006A597C /* DFGStructureAbstractValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F63947615DCE347006A597C /* DFGStructureAbstractValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F63948415E48118006A597C /* DFGArrayMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F63948115E48114006A597C /* DFGArrayMode.cpp */; };
0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F63948215E48114006A597C /* DFGArrayMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F63947815DCE34B006A597C /* DFGStructureAbstractValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F63947615DCE347006A597C /* DFGStructureAbstractValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F66E16B14DF3F1600B7B2E4 /* DFGAdjacencyList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66E16814DF3F1300B7B2E4 /* DFGAdjacencyList.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F66E16C14DF3F1600B7B2E4 /* DFGEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66E16914DF3F1300B7B2E4 /* DFGEdge.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F766D2815A8CC1E008F363E /* JITStubRoutine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F766D2615A8CC1B008F363E /* JITStubRoutine.cpp */; };
......@@ -573,7 +573,6 @@
A7DCB97312E5193F00911940 /* WriteBarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DCB77912E3D90500911940 /* WriteBarrier.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E2EA690FB460CF00601F06 /* LiteralParser.h */; };
A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */; };
A7EC8C7A15E6E9500051E9A9 /* OpcodeDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = A758FB5C15E6C91B00AC9895 /* OpcodeDefinitions.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9935D0FD7325100A0B2D0 /* JSONObject.h */; };
A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */; };
A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */; };
......@@ -898,9 +897,9 @@
0F63943D15C75F14006A597C /* DFGStructureCheckHoistingPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStructureCheckHoistingPhase.h; path = dfg/DFGStructureCheckHoistingPhase.h; sourceTree = "<group>"; };
0F63945115D07051006A597C /* ArrayProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayProfile.cpp; sourceTree = "<group>"; };
0F63945215D07051006A597C /* ArrayProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayProfile.h; sourceTree = "<group>"; };
0F63947615DCE347006A597C /* DFGStructureAbstractValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStructureAbstractValue.h; path = dfg/DFGStructureAbstractValue.h; sourceTree = "<group>"; };
0F63948115E48114006A597C /* DFGArrayMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGArrayMode.cpp; path = dfg/DFGArrayMode.cpp; sourceTree = "<group>"; };
0F63948215E48114006A597C /* DFGArrayMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGArrayMode.h; path = dfg/DFGArrayMode.h; sourceTree = "<group>"; };
0F63947615DCE347006A597C /* DFGStructureAbstractValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStructureAbstractValue.h; path = dfg/DFGStructureAbstractValue.h; sourceTree = "<group>"; };
0F66E16814DF3F1300B7B2E4 /* DFGAdjacencyList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAdjacencyList.h; path = dfg/DFGAdjacencyList.h; sourceTree = "<group>"; };
0F66E16914DF3F1300B7B2E4 /* DFGEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGEdge.h; path = dfg/DFGEdge.h; sourceTree = "<group>"; };
0F766D1C15A5028D008F363E /* JITStubRoutine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubRoutine.h; sourceTree = "<group>"; };
......@@ -1333,11 +1332,6 @@
A74DE1CB120B86D600D40D5B /* ARMv7Assembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ARMv7Assembler.cpp; sourceTree = "<group>"; };
A7521E121429169A003C8D0C /* CardSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardSet.h; sourceTree = "<group>"; };
A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITArithmetic32_64.cpp; sourceTree = "<group>"; };
A758FB5815E6C89400AC9895 /* opcode_definition_generator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = opcode_definition_generator.py; sourceTree = "<group>"; };
A758FB5915E6C89400AC9895 /* opcode_generator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = opcode_generator.py; sourceTree = "<group>"; };
A758FB5A15E6C89400AC9895 /* opcode_parser.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = opcode_parser.py; sourceTree = "<group>"; };
A758FB5C15E6C91B00AC9895 /* OpcodeDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpcodeDefinitions.h; sourceTree = "<group>"; };
A758FB5D15E6C91B00AC9895 /* opcodes */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = opcodes; sourceTree = "<group>"; };
A767FF9F14F4502900789059 /* JSCTypedArrayStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCTypedArrayStubs.h; sourceTree = "<group>"; };
A76C51741182748D00715B05 /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = "<group>"; };
A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITWriteBarrier.h; sourceTree = "<group>"; };
......@@ -1599,9 +1593,6 @@
0867D691FE84028FC02AAC07 /* JavaScriptCore */ = {
isa = PBXGroup;
children = (
A758FB5815E6C89400AC9895 /* opcode_definition_generator.py */,
A758FB5915E6C89400AC9895 /* opcode_generator.py */,
A758FB5A15E6C89400AC9895 /* opcode_parser.py */,
8604F4F2143A6C4400B295F5 /* ChangeLog */,
A718F8211178EB4B002465A7 /* create_regex_tables */,
937B63CC09E766D200A671DD /* DerivedSources.make */,
......@@ -2486,8 +2477,6 @@
BCFD8C910EEB2EE700283848 /* JumpTable.h */,
969A07940ED1D3AE00F1F681 /* Opcode.cpp */,
969A07950ED1D3AE00F1F681 /* Opcode.h */,
A758FB5C15E6C91B00AC9895 /* OpcodeDefinitions.h */,
A758FB5D15E6C91B00AC9895 /* opcodes */,
0FD82E84141F3FDA00179C94 /* SpeculatedType.cpp */,
0FD82E4F141DAEA100179C94 /* SpeculatedType.h */,
1429D8830ED21C3D00B89619 /* SamplingTool.cpp */,
......@@ -2907,7 +2896,6 @@
0F63945515D07057006A597C /* ArrayProfile.h in Headers */,
0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */,
0F63947815DCE34B006A597C /* DFGStructureAbstractValue.h in Headers */,
A7EC8C7A15E6E9500051E9A9 /* OpcodeDefinitions.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -30,8 +30,6 @@
#ifndef Opcode_h
#define Opcode_h
#include "OpcodeDefinitions.h"
#include <algorithm>
#include <string.h>
......@@ -39,10 +37,174 @@
namespace JSC {
#define FOR_EACH_OPCODE_ID(macro) \
macro(op_enter, 1) \
macro(op_create_activation, 2) \
macro(op_init_lazy_reg, 2) \
macro(op_create_arguments, 2) \
macro(op_create_this, 2) \
macro(op_convert_this, 3) \
\
macro(op_new_object, 2) \
macro(op_new_array, 4) \
macro(op_new_array_buffer, 4) \
macro(op_new_regexp, 3) \
macro(op_mov, 3) \
\
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_greater, 4) \
macro(op_greatereq, 4) \
\
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, 5) \
macro(op_mod, 4) \
macro(op_sub, 5) \
\
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_check_has_instance, 2) \
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, 4) /* has value profiling */ \
macro(op_resolve_skip, 5) /* has value profiling */ \
macro(op_resolve_global, 6) /* has value profiling */ \
macro(op_resolve_global_dynamic, 7) /* has value profiling */ \
macro(op_get_scoped_var, 5) /* has value profiling */ \
macro(op_put_scoped_var, 4) \
macro(op_get_global_var, 4) /* has value profiling */ \
macro(op_get_global_var_watchable, 5) /* has value profiling */ \
macro(op_put_global_var, 3) \
macro(op_put_global_var_check, 5) \
macro(op_resolve_base, 5) /* has value profiling */ \
macro(op_ensure_property_exists, 3) \
macro(op_resolve_with_base, 5) /* has value profiling */ \
macro(op_resolve_with_this, 5) /* has value profiling */ \
macro(op_get_by_id, 9) /* has value profiling */ \
macro(op_get_by_id_out_of_line, 9) /* has value profiling */ \
macro(op_get_by_id_self, 9) /* has value profiling */ \
macro(op_get_by_id_proto, 9) /* has value profiling */ \
macro(op_get_by_id_chain, 9) /* has value profiling */ \
macro(op_get_by_id_getter_self, 9) /* has value profiling */ \
macro(op_get_by_id_getter_proto, 9) /* has value profiling */ \
macro(op_get_by_id_getter_chain, 9) /* has value profiling */ \
macro(op_get_by_id_custom_self, 9) /* has value profiling */ \
macro(op_get_by_id_custom_proto, 9) /* has value profiling */ \
macro(op_get_by_id_custom_chain, 9) /* has value profiling */ \
macro(op_get_by_id_generic, 9) /* has value profiling */ \
macro(op_get_array_length, 9) /* has value profiling */ \
macro(op_get_string_length, 9) /* has value profiling */ \
macro(op_get_arguments_length, 4) \
macro(op_put_by_id, 9) \
macro(op_put_by_id_out_of_line, 9) \
macro(op_put_by_id_transition, 9) \
macro(op_put_by_id_transition_direct, 9) \
macro(op_put_by_id_transition_direct_out_of_line, 9) \
macro(op_put_by_id_transition_normal, 9) \
macro(op_put_by_id_transition_normal_out_of_line, 9) \
macro(op_put_by_id_replace, 9) \
macro(op_put_by_id_generic, 9) \
macro(op_del_by_id, 4) \
macro(op_get_by_val, 6) /* has value profiling */ \
macro(op_get_argument_by_val, 6) /* must be the same size as op_get_by_val */ \
macro(op_get_by_pname, 7) \
macro(op_put_by_val, 5) \
macro(op_del_by_val, 4) \
macro(op_put_by_index, 4) \
macro(op_put_getter_setter, 5) \
\
macro(op_jmp, 2) \
macro(op_jtrue, 3) \
macro(op_jfalse, 3) \
macro(op_jeq_null, 3) \
macro(op_jneq_null, 3) \
macro(op_jneq_ptr, 4) \
macro(op_jless, 4) \
macro(op_jlesseq, 4) \
macro(op_jgreater, 4) \
macro(op_jgreatereq, 4) \
macro(op_jnless, 4) \
macro(op_jnlesseq, 4) \
macro(op_jngreater, 4) \
macro(op_jngreatereq, 4) \
macro(op_jmp_scopes, 3) \
macro(op_loop, 2) \
macro(op_loop_if_true, 3) \
macro(op_loop_if_false, 3) \
macro(op_loop_if_less, 4) \
macro(op_loop_if_lesseq, 4) \
macro(op_loop_if_greater, 4) \
macro(op_loop_if_greatereq, 4) \
macro(op_loop_hint, 1) \
macro(op_switch_imm, 4) \
macro(op_switch_char, 4) \
macro(op_switch_string, 4) \
\
macro(op_new_func, 4) \
macro(op_new_func_exp, 3) \
macro(op_call, 6) \
macro(op_call_eval, 6) \
macro(op_call_varargs, 5) \
macro(op_tear_off_activation, 3) \
macro(op_tear_off_arguments, 2) \
macro(op_ret, 2) \
macro(op_call_put_result, 3) /* has value profiling */ \
macro(op_ret_object_or_this, 3) \
macro(op_method_check, 1) \
\
macro(op_construct, 6) \
macro(op_strcat, 4) \
macro(op_to_primitive, 3) \
\
macro(op_get_pnames, 6) \
macro(op_next_pname, 7) \
\
macro(op_push_scope, 2) \
macro(op_pop_scope, 1) \
macro(op_push_new_scope, 4) \
\
macro(op_catch, 2) \
macro(op_throw, 2) \
macro(op_throw_reference_error, 2) \
\
macro(op_debug, 5) \
macro(op_profile_will_call, 2) \
macro(op_profile_did_call, 2) \
\
macro(op_end, 2) // end must be the last opcode in the list
#define OPCODE_ID_ENUM(opcode, length) opcode,
typedef enum { FOR_EACH_OPCODE_ID(OPCODE_ID_ENUM) } OpcodeID;
#undef OPCODE_ID_ENUM
const int maxOpcodeLength = 9;
const int numOpcodeIDs = op_end + 1;
#define OPCODE_ID_LENGTHS(id, length) const int id##_length = length;
......
// Automatically generated by opcode_generator.py -i bytecode/opcodes -o bytecode/OpcodeDefinitions.h -m definition. Do not edit.
namespace JSC {
#define FOR_EACH_OPCODE_ID(macro) \
macro(op_enter, 1) \
macro(op_create_activation, 2) \
macro(op_init_lazy_reg, 2) \
macro(op_create_arguments, 2) \
macro(op_create_this, 2) \
macro(op_convert_this, 3) \
macro(op_new_object, 2) \
macro(op_new_array, 4) \
macro(op_new_array_buffer, 4) \
macro(op_new_regexp, 3) \
macro(op_mov, 3) \
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_greater, 4) \
macro(op_greatereq, 4) \
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, 5) \
macro(op_mod, 4) \
macro(op_sub, 5) \
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_check_has_instance, 2) \
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, 4) \
macro(op_resolve_skip, 5) \
macro(op_resolve_global, 6) \
macro(op_resolve_global_dynamic, 7) \
macro(op_get_scoped_var, 5) \
macro(op_put_scoped_var, 4) \
macro(op_get_global_var, 4) \
macro(op_get_global_var_watchable, 5) \
macro(op_put_global_var, 3) \
macro(op_put_global_var_check, 5) \
macro(op_resolve_base, 5) \
macro(op_ensure_property_exists, 3) \
macro(op_resolve_with_base, 5) \
macro(op_resolve_with_this, 5) \
macro(op_get_by_id, 9) \
macro(op_get_by_id_out_of_line, 9) \
macro(op_get_by_id_self, 9) \
macro(op_get_by_id_proto, 9) \
macro(op_get_by_id_chain, 9) \
macro(op_get_by_id_getter_self, 9) \
macro(op_get_by_id_getter_proto, 9) \
macro(op_get_by_id_getter_chain, 9) \
macro(op_get_by_id_custom_self, 9) \
macro(op_get_by_id_custom_proto, 9) \
macro(op_get_by_id_custom_chain, 9) \
macro(op_get_by_id_generic, 9) \
macro(op_get_array_length, 9) \
macro(op_get_string_length, 9) \
macro(op_get_arguments_length, 4) \
macro(op_put_by_id, 9) \
macro(op_put_by_id_out_of_line, 9) \
macro(op_put_by_id_transition, 9) \
macro(op_put_by_id_transition_direct, 9) \
macro(op_put_by_id_transition_direct_out_of_line, 9) \
macro(op_put_by_id_transition_normal, 9) \
macro(op_put_by_id_transition_normal_out_of_line, 9) \
macro(op_put_by_id_replace, 9) \
macro(op_put_by_id_generic, 9) \
macro(op_del_by_id, 4) \
macro(op_get_by_val, 6) \
macro(op_get_argument_by_val, 6) \
macro(op_get_by_pname, 7) \
macro(op_put_by_val, 5) \
macro(op_del_by_val, 4) \
macro(op_put_by_index, 4) \
macro(op_put_getter_setter, 5) \
macro(op_jmp, 2) \
macro(op_jtrue, 3) \
macro(op_jfalse, 3) \
macro(op_jeq_null, 3) \
macro(op_jneq_null, 3) \
macro(op_jneq_ptr, 4) \
macro(op_jless, 4) \
macro(op_jlesseq, 4) \
macro(op_jgreater, 4) \
macro(op_jgreatereq, 4) \
macro(op_jnless, 4) \
macro(op_jnlesseq, 4) \
macro(op_jngreater, 4) \
macro(op_jngreatereq, 4) \
macro(op_jmp_scopes, 3) \
macro(op_loop, 2) \
macro(op_loop_if_true, 3) \
macro(op_loop_if_false, 3) \
macro(op_loop_if_less, 4) \
macro(op_loop_if_lesseq, 4) \
macro(op_loop_if_greater, 4) \
macro(op_loop_if_greatereq, 4) \
macro(op_loop_hint, 1) \
macro(op_switch_imm, 4) \
macro(op_switch_char, 4) \
macro(op_switch_string, 4) \
macro(op_new_func, 4) \
macro(op_new_func_exp, 3) \
macro(op_call, 6) \
macro(op_call_eval, 6) \
macro(op_call_varargs, 5) \
macro(op_tear_off_activation, 3) \
macro(op_tear_off_arguments, 2) \
macro(op_ret, 2) \
macro(op_call_put_result, 3) \
macro(op_ret_object_or_this, 3) \
macro(op_method_check, 1) \
macro(op_construct, 6) \
macro(op_strcat, 4) \
macro(op_to_primitive, 3) \
macro(op_get_pnames, 6) \
macro(op_next_pname, 7) \
macro(op_push_scope, 2) \
macro(op_pop_scope, 1) \
macro(op_push_new_scope, 4) \
macro(op_catch, 2) \
macro(op_throw, 2) \
macro(op_throw_reference_error, 2) \
macro(op_debug, 5) \
macro(op_profile_will_call, 2) \
macro(op_profile_did_call, 2) \
macro(op_end, 2)
const int maxOpcodeLength = 9;
}
This diff is collapsed.
# Copyright (C) 2012 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms(with or without
# modification(are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice(this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice(this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES(INCLUDING(BUT NOT LIMITED TO(THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT(INDIRECT(INCIDENTAL(SPECIAL,
# EXEMPLARY(OR CONSEQUENTIAL DAMAGES (INCLUDING(BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE(DATA(OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY(WHETHER IN CONTRACT(STRICT LIABILITY(OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE(EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import operator
import sys
def generateOpcodeDefinition(opcode):
_, name, parameters = opcode
return " macro(op_%s, %d)" % (name, len(parameters) + 1)
def generate(outfile, opcodes):
outfile.write("// Automatically generated by %s. Do not edit.\n\n" % " ".join(sys.argv))
outfile.write("namespace JSC {\n\n")
outfile.write("#define FOR_EACH_OPCODE_ID(macro) \\\n")
lines = [generateOpcodeDefinition(opcode) for opcode in opcodes]
outfile.write(" \\\n".join(lines))
outfile.write("\n\n")
outfile.write("const int maxOpcodeLength = %d;\n" % (1 + reduce(lambda l, opcode: max(l, len(opcode[2])), opcodes, 0)))
outfile.write("\n}\n")
outfile.flush()
#!/usr/bin/python
# Copyright (C) 2012 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms(with or without
# modification(are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice(this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice(this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES(INCLUDING(BUT NOT LIMITED TO(THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT(INDIRECT(INCIDENTAL(SPECIAL,
# EXEMPLARY(OR CONSEQUENTIAL DAMAGES (INCLUDING(BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE(DATA(OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY(WHETHER IN CONTRACT(STRICT LIABILITY(OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE(EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import sys
import getopt
import re
import opcode_parser
import opcode_definition_generator
def printUsage():
print("Usage: %s -m [definition] [-i input] [-o output]" % (sys.argv[0]))
def main(argv):
opts, args = getopt.getopt(argv, "ho:i:m:")
if len(args) != 0:
print(args)
printUsage()
sys.exit(1)
infilename = None
outfilename = None
mode = None
for opt, value in opts:
if opt == "-o":
if outfilename != None:
print("Multiple output files specified")
printUsage()
sys.exit(1)
outfilename = value
if opt == "-i":
if infilename != None:
print("Multiple output files specified")
printUsage()
sys.exit(1)
infilename = value
if opt == "-m":
if mode != None:
print("Multiple output modes specified")
printUsage()
sys.exit(1)
mode = value
if opt == "-h":
printUsage()
sys.exit()
if mode == None:
print("No output mode specified")
printUsage()
sys.exit(1)
infile = sys.stdin
outfile = sys.stdout
if infilename != None:
infile = file(infilename, "r", True)
if outfilename != None:
outfile = file(outfilename, "w", True)
input = [l for l in infile]
infile.close()
opcodes = opcode_parser.parseOpcodes(input)
if mode == "definition":
opcode_definition_generator.generate(outfile, opcodes)
else:
print("Invalid mode specified")
printUsage()
sys.exit(1)
outfile.close()
if __name__ == "__main__":
main(sys.argv[1:])
# Copyright (C) 2012 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms(with or without
# modification(are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice(this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice(this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES(INCLUDING(BUT NOT LIMITED TO(THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT(INDIRECT(INCIDENTAL(SPECIAL,
# EXEMPLARY(OR CONSEQUENTIAL DAMAGES (INCLUDING(BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE(DATA(OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY(WHETHER IN CONTRACT(STRICT LIABILITY(OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE(EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import re
class PrimitiveType:
def __init__(self, name, unlinkedType, linkedType):
self.name = name
self.unlinkedType = unlinkedType
self.linkedType = linkedType
def __repr__(self):
return self.name
class RegisterType(PrimitiveType):
def __init__(self, name):
PrimitiveType.__init__(self, name, "int", "RegisterID")
def specialise(self, specialisation):
return PrimitiveType("%s<%s>" % (self.name, specialisation), "int", "RegisterID")
types = {
"int": PrimitiveType("int", "int", "int"),
"unsigned": PrimitiveType("unsigned", "unsigned", "unsigned"),
"bool": PrimitiveType("bool", "bool", "bool"),
"void": PrimitiveType("void", None, "void*"),
"Register": RegisterType("Register"),
"OperandTypes": PrimitiveType("OperandTypes", "short", "OperandTypes"),
"Identifier": PrimitiveType("Identifier", "int", "int"),
"ValueProfile": PrimitiveType("ValueProfile", None, "ValueProfile*"),
"Structure": PrimitiveType("Structure", None, "Structure*"),
"StructureChain": PrimitiveType("Structure", None, "StructureChain*"),
"ValuePointer": PrimitiveType("ValuePointer", None, "WriteBarrier<Unknown>*"),
"WatchPointer": PrimitiveType("WatchPointer", None, "bool*"),
"ArrayProfile": PrimitiveType("ArrayProfile", None, "ArrayProfile*"),
"Label": PrimitiveType("Label", "int", "int"),
"JSFunction": PrimitiveType("JSFunction", "UnlinkedFunctionReference", "JSFunction*"),
"JumpTable": PrimitiveType("JumpTable", "int", "int"),
"Function": PrimitiveType("Function", "int", "int"),
"FunctionExpression": PrimitiveType("FunctionExpression", "int", "int"),
"LLIntCallLinkInfo": PrimitiveType("LLIntCallLinkInfo", None, "LLIntCallLinkInfo*"),
}
parameterString = r"((void)|((?!void\s*<)\w+(\s*<\w+>)?))(\s+\w+)?"
parameterString = parameterString + r"(\s*,\s*" + parameterString + ")*"
opcodeRegex = re.compile