Changeset 34527 in webkit for trunk/JavaScriptCore/VM/Opcode.cpp
- Timestamp:
- Jun 13, 2008, 9:12:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Opcode.cpp
r34497 r34527 46 46 47 47 static const char* opcodeNames[] = { 48 "load ",49 "new_object ",50 "new_array ",51 "new_regexp ",52 "mov ",53 54 "not ",55 "eq ",56 "neq ",57 "stricteq ",58 "nstricteq ",59 "less ",60 "lesseq ",61 62 "pre_inc ",63 "pre_dec ",64 "post_inc ",65 "post_dec ",66 "to_jsnumber ",67 "negate ",68 "add ",69 "mul ",70 "div ",71 "mod ",72 "sub ",73 74 "lshift ",75 "rshift ",76 "urshift ",77 "bitand ",78 "bitxor ",79 "bitor ",80 "bitnot ",81 82 "instanceof ",83 "typeof ",84 "in ",85 86 "resolve ",48 "load ", 49 "new_object ", 50 "new_array ", 51 "new_regexp ", 52 "mov ", 53 54 "not ", 55 "eq ", 56 "neq ", 57 "stricteq ", 58 "nstricteq ", 59 "less ", 60 "lesseq ", 61 62 "pre_inc ", 63 "pre_dec ", 64 "post_inc ", 65 "post_dec ", 66 "to_jsnumber ", 67 "negate ", 68 "add ", 69 "mul ", 70 "div ", 71 "mod ", 72 "sub ", 73 74 "lshift ", 75 "rshift ", 76 "urshift ", 77 "bitand ", 78 "bitxor ", 79 "bitor ", 80 "bitnot ", 81 82 "instanceof ", 83 "typeof ", 84 "in ", 85 86 "resolve ", 87 87 "resolve_skip", 88 88 "get_scoped_var", … … 91 91 "resolve_with_base", 92 92 "resolve_func", 93 "get_by_id ",94 "put_by_id ",95 "del_by_id ",96 "get_by_val ",97 "put_by_val ",98 "del_by_val ",93 "get_by_id ", 94 "put_by_id ", 95 "del_by_id ", 96 "get_by_val ", 97 "put_by_val ", 98 "del_by_val ", 99 99 "put_by_index", 100 "put_getter ",101 "put_setter ",102 103 "jmp ",104 "jtrue ",105 "jfalse ",106 "jless ",107 "jmp_scopes ",108 109 "new_func ",100 "put_getter ", 101 "put_setter ", 102 103 "jmp ", 104 "jtrue ", 105 "jfalse ", 106 "jless ", 107 "jmp_scopes ", 108 109 "new_func ", 110 110 "new_func_exp", 111 "call ",112 "call_eval ",113 "ret ",114 115 "construct ",116 117 "get_pnames ",118 "next_pname ",119 120 "push_scope ",121 "pop_scope ",122 123 "catch ",124 "throw ",125 "new_error ",126 127 "jsr ",128 "sret ",129 130 "debug ",131 132 "end "111 "call ", 112 "call_eval ", 113 "ret ", 114 115 "construct ", 116 117 "get_pnames ", 118 "next_pname ", 119 120 "push_scope ", 121 "pop_scope ", 122 123 "catch ", 124 "throw ", 125 "new_error ", 126 127 "jsr ", 128 "sret ", 129 130 "debug ", 131 132 "end " 133 133 }; 134 134 … … 194 194 mergesort(sortedPairIndices, numOpcodeIDs * numOpcodeIDs, sizeof(pair<int, int>), compareOpcodePairIndices); 195 195 196 printf("\nExecuted opcode statistics :\n\n");196 printf("\nExecuted opcode statistics\n"); 197 197 198 198 printf("Total instructions executed: %lld\n\n", totalInstructions); 199 199 200 printf("All opcodes by frequency:\n\n"); 201 200 202 for (int i = 0; i < numOpcodeIDs; ++i) { 201 203 int index = sortedIndices[i]; 202 printf("%s: % .2f%%\n", opcodeNames[index], ((double) opcodeCounts[index]) / ((double) totalInstructions) * 100.0);204 printf("%s: %lld - %.2f%%\n", opcodeNames[index], opcodeCounts[index], ((double) opcodeCounts[index]) / ((double) totalInstructions) * 100.0); 203 205 } 204 206 205 207 printf("\n"); 208 printf("2-opcode sequences by frequency: %lld\n\n", totalInstructions); 206 209 207 210 for (int i = 0; i < numOpcodeIDs * numOpcodeIDs; ++i) { … … 212 215 break; 213 216 214 printf(" (%s, %s): %.2f%%\n", opcodeNames[indexPair.first], opcodeNames[indexPair.second], ((double) count) / ((double) totalInstructionPairs) * 100.0);217 printf("%s %s: %lld %.2f%%\n", opcodeNames[indexPair.first], opcodeNames[indexPair.second], count, ((double) count) / ((double) totalInstructionPairs) * 100.0); 215 218 } 216 219 220 printf("\n"); 221 printf("Most common opcodes and sequences:\n"); 222 223 for (int i = 0; i < numOpcodeIDs; ++i) { 224 int index = sortedIndices[i]; 225 long long opcodeCount = opcodeCounts[index]; 226 double opcodeProportion = ((double) opcodeCount) / ((double) totalInstructions); 227 if (opcodeProportion < 0.0001) 228 break; 229 printf("\n%s: %lld - %.2f%%\n", opcodeNames[index], opcodeCount, opcodeProportion * 100.0); 230 231 for (int j = 0; j < numOpcodeIDs * numOpcodeIDs; ++j) { 232 pair<int, int> indexPair = sortedPairIndices[j]; 233 long long pairCount = opcodePairCounts[indexPair.first][indexPair.second]; 234 double pairProportion = ((double) pairCount) / ((double) totalInstructionPairs); 235 236 if (!pairCount || pairProportion < 0.0001 || pairProportion < opcodeProportion / 100) 237 break; 238 239 if (indexPair.first != index && indexPair.second != index) 240 continue; 241 242 printf(" %s %s: %lld - %.2f%%\n", opcodeNames[indexPair.first], opcodeNames[indexPair.second], pairCount, pairProportion * 100.0); 243 } 244 245 } 217 246 printf("\n"); 218 247 }
Note:
See TracChangeset
for help on using the changeset viewer.