Changeset 38428 in webkit for trunk/JavaScriptCore/VM/Opcode.h
- Timestamp:
- Nov 15, 2008, 1:37:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Opcode.h
r38425 r38428 28 28 */ 29 29 30 #ifndef Bytecodes_h31 #define Bytecodes_h30 #ifndef Opcode_h 31 #define Opcode_h 32 32 33 33 #include <algorithm> … … 38 38 namespace JSC { 39 39 40 #define FOR_EACH_ BYTECODE_ID(macro) \40 #define FOR_EACH_OPCODE_ID(macro) \ 41 41 macro(op_enter) \ 42 42 macro(op_enter_with_activation) \ … … 163 163 macro(op_profile_did_call) \ 164 164 \ 165 macro(op_end) // end must be the last bytecode in the list166 167 #define BYTECODE_ID_ENUM(bytecode) bytecode,168 typedef enum { FOR_EACH_ BYTECODE_ID(BYTECODE_ID_ENUM) } BytecodeID;169 #undef BYTECODE_ID_ENUM170 171 const int num BytecodeIDs = op_end + 1;172 173 #define VERIFY_ BYTECODE_ID(id) COMPILE_ASSERT(id <= op_end, ASSERT_THAT_JS_BYTECODE_IDS_ARE_VALID);174 FOR_EACH_ BYTECODE_ID(VERIFY_BYTECODE_ID);175 #undef VERIFY_ BYTECODE_ID165 macro(op_end) // end must be the last opcode in the list 166 167 #define OPCODE_ID_ENUM(opcode) opcode, 168 typedef enum { FOR_EACH_OPCODE_ID(OPCODE_ID_ENUM) } OpcodeID; 169 #undef OPCODE_ID_ENUM 170 171 const int numOpcodeIDs = op_end + 1; 172 173 #define VERIFY_OPCODE_ID(id) COMPILE_ASSERT(id <= op_end, ASSERT_THAT_JS_OPCODE_IDS_ARE_VALID); 174 FOR_EACH_OPCODE_ID(VERIFY_OPCODE_ID); 175 #undef VERIFY_OPCODE_ID 176 176 177 177 #if HAVE(COMPUTED_GOTO) 178 typedef void* Bytecode;178 typedef void* Opcode; 179 179 #else 180 typedef BytecodeID Bytecode;180 typedef OpcodeID Opcode; 181 181 #endif 182 182 183 #if ENABLE( BYTECODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(BYTECODE_STATS)183 #if ENABLE(OPCODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(OPCODE_STATS) 184 184 185 185 #define PADDING_STRING " " 186 186 #define PADDING_STRING_LENGTH static_cast<unsigned>(strlen(PADDING_STRING)) 187 187 188 extern const char* const bytecodeNames[];189 190 inline const char* pad BytecodeName(BytecodeID op, unsigned width)188 extern const char* const opcodeNames[]; 189 190 inline const char* padOpcodeName(OpcodeID op, unsigned width) 191 191 { 192 unsigned pad = width - strlen( bytecodeNames[op]);192 unsigned pad = width - strlen(opcodeNames[op]); 193 193 pad = std::min(pad, PADDING_STRING_LENGTH); 194 194 return PADDING_STRING + PADDING_STRING_LENGTH - pad; … … 200 200 #endif 201 201 202 #if ENABLE( BYTECODE_STATS)203 204 struct BytecodeStats {205 BytecodeStats();206 ~ BytecodeStats();207 static long long bytecodeCounts[numBytecodeIDs];208 static long long bytecodePairCounts[numBytecodeIDs][numBytecodeIDs];209 static int last Bytecode;210 211 static void recordInstruction(int bytecode);202 #if ENABLE(OPCODE_STATS) 203 204 struct OpcodeStats { 205 OpcodeStats(); 206 ~OpcodeStats(); 207 static long long opcodeCounts[numOpcodeIDs]; 208 static long long opcodePairCounts[numOpcodeIDs][numOpcodeIDs]; 209 static int lastOpcode; 210 211 static void recordInstruction(int opcode); 212 212 static void resetLastInstruction(); 213 213 }; … … 217 217 } // namespace JSC 218 218 219 #endif // Bytecodes_h219 #endif // Opcode_h
Note:
See TracChangeset
for help on using the changeset viewer.