Changeset 38440 in webkit for trunk/JavaScriptCore/VM/CodeBlock.cpp
- Timestamp:
- Nov 15, 2008, 8:40:06 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/CodeBlock.cpp
r38428 r38440 174 174 } 175 175 176 void CodeBlock::printStructure ID(const char* name, const Instruction* vPC, int operand) const176 void CodeBlock::printStructure(const char* name, const Instruction* vPC, int operand) const 177 177 { 178 178 unsigned instructionOffset = vPC - instructions.begin(); 179 printf(" [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure ID).UTF8String().c_str());180 } 181 182 void CodeBlock::printStructure IDs(const Instruction* vPC) const179 printf(" [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure).UTF8String().c_str()); 180 } 181 182 void CodeBlock::printStructures(const Instruction* vPC) const 183 183 { 184 184 BytecodeInterpreter* interpreter = globalData->interpreter; … … 186 186 187 187 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id)) { 188 printStructure ID("get_by_id", vPC, 4);188 printStructure("get_by_id", vPC, 4); 189 189 return; 190 190 } 191 191 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { 192 printStructure ID("get_by_id_self", vPC, 4);192 printStructure("get_by_id_self", vPC, 4); 193 193 return; 194 194 } 195 195 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { 196 printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(vPC[4].u.structure ID).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureID).UTF8String().c_str());196 printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(vPC[4].u.structure).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structure).UTF8String().c_str()); 197 197 return; 198 198 } 199 199 if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) { 200 printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_new", pointerToSourceString(vPC[4].u.structure ID).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureID).UTF8String().c_str(), pointerToSourceString(vPC[6].u.structureIDChain).UTF8String().c_str());200 printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_new", pointerToSourceString(vPC[4].u.structure).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structure).UTF8String().c_str(), pointerToSourceString(vPC[6].u.structureChain).UTF8String().c_str()); 201 201 return; 202 202 } 203 203 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { 204 printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(vPC[4].u.structure ID).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureIDChain).UTF8String().c_str());204 printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(vPC[4].u.structure).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureChain).UTF8String().c_str()); 205 205 return; 206 206 } 207 207 if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id)) { 208 printStructure ID("put_by_id", vPC, 4);208 printStructure("put_by_id", vPC, 4); 209 209 return; 210 210 } 211 211 if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) { 212 printStructure ID("put_by_id_replace", vPC, 4);212 printStructure("put_by_id_replace", vPC, 4); 213 213 return; 214 214 } 215 215 if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global)) { 216 printStructure ID("resolve_global", vPC, 4);217 return; 218 } 219 220 // These instructions doesn't ref Structure IDs.216 printStructure("resolve_global", vPC, 4); 217 return; 218 } 219 220 // These instructions doesn't ref Structures. 221 221 ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_call) || vPC[0].u.opcode == interpreter->getOpcode(op_call_eval) || vPC[0].u.opcode == interpreter->getOpcode(op_construct)); 222 222 } … … 279 279 280 280 if (globalResolveInstructions.size() || propertyAccessInstructions.size()) 281 printf("\nStructure IDs:\n");281 printf("\nStructures:\n"); 282 282 283 283 if (globalResolveInstructions.size()) { 284 284 size_t i = 0; 285 285 do { 286 printStructure IDs(&instructions[globalResolveInstructions[i]]);286 printStructures(&instructions[globalResolveInstructions[i]]); 287 287 ++i; 288 288 } while (i < globalResolveInstructions.size()); … … 291 291 size_t i = 0; 292 292 do { 293 printStructure IDs(&instructions[propertyAccessInstructions[i].bytecodeIndex]);293 printStructures(&instructions[propertyAccessInstructions[i].bytecodeIndex]); 294 294 ++i; 295 295 } while (i < propertyAccessInstructions.size()); … … 951 951 { 952 952 for (size_t size = globalResolveInstructions.size(), i = 0; i < size; ++i) { 953 derefStructure IDs(&instructions[globalResolveInstructions[i]]);953 derefStructures(&instructions[globalResolveInstructions[i]]); 954 954 } 955 955 956 956 for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) { 957 derefStructure IDs(&instructions[propertyAccessInstructions[i].bytecodeIndex]);957 derefStructures(&instructions[propertyAccessInstructions[i].bytecodeIndex]); 958 958 if (propertyAccessInstructions[i].stubRoutine) 959 959 WTF::fastFreeExecutable(propertyAccessInstructions[i].stubRoutine); … … 987 987 #endif 988 988 989 void CodeBlock::derefStructure IDs(Instruction* vPC) const989 void CodeBlock::derefStructures(Instruction* vPC) const 990 990 { 991 991 BytecodeInterpreter* interpreter = globalData->interpreter; 992 992 993 993 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { 994 vPC[4].u.structure ID->deref();994 vPC[4].u.structure->deref(); 995 995 return; 996 996 } 997 997 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { 998 vPC[4].u.structure ID->deref();999 vPC[5].u.structure ID->deref();998 vPC[4].u.structure->deref(); 999 vPC[5].u.structure->deref(); 1000 1000 return; 1001 1001 } 1002 1002 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { 1003 vPC[4].u.structure ID->deref();1004 vPC[5].u.structure IDChain->deref();1003 vPC[4].u.structure->deref(); 1004 vPC[5].u.structureChain->deref(); 1005 1005 return; 1006 1006 } 1007 1007 if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) { 1008 vPC[4].u.structure ID->deref();1009 vPC[5].u.structure ID->deref();1010 vPC[6].u.structure IDChain->deref();1008 vPC[4].u.structure->deref(); 1009 vPC[5].u.structure->deref(); 1010 vPC[6].u.structureChain->deref(); 1011 1011 return; 1012 1012 } 1013 1013 if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) { 1014 vPC[4].u.structure ID->deref();1014 vPC[4].u.structure->deref(); 1015 1015 return; 1016 1016 } 1017 1017 if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global)) { 1018 if(vPC[4].u.structure ID)1019 vPC[4].u.structure ID->deref();1018 if(vPC[4].u.structure) 1019 vPC[4].u.structure->deref(); 1020 1020 return; 1021 1021 } 1022 1022 1023 // These instructions don't ref their Structure IDs.1023 // These instructions don't ref their Structures. 1024 1024 ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_get_array_length) || vPC[0].u.opcode == interpreter->getOpcode(op_get_string_length)); 1025 1025 } 1026 1026 1027 void CodeBlock::refStructure IDs(Instruction* vPC) const1027 void CodeBlock::refStructures(Instruction* vPC) const 1028 1028 { 1029 1029 BytecodeInterpreter* interpreter = globalData->interpreter; 1030 1030 1031 1031 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { 1032 vPC[4].u.structure ID->ref();1032 vPC[4].u.structure->ref(); 1033 1033 return; 1034 1034 } 1035 1035 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { 1036 vPC[4].u.structure ID->ref();1037 vPC[5].u.structure ID->ref();1036 vPC[4].u.structure->ref(); 1037 vPC[5].u.structure->ref(); 1038 1038 return; 1039 1039 } 1040 1040 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { 1041 vPC[4].u.structure ID->ref();1042 vPC[5].u.structure IDChain->ref();1041 vPC[4].u.structure->ref(); 1042 vPC[5].u.structureChain->ref(); 1043 1043 return; 1044 1044 } 1045 1045 if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) { 1046 vPC[4].u.structure ID->ref();1047 vPC[5].u.structure ID->ref();1048 vPC[6].u.structure IDChain->ref();1046 vPC[4].u.structure->ref(); 1047 vPC[5].u.structure->ref(); 1048 vPC[6].u.structureChain->ref(); 1049 1049 return; 1050 1050 } 1051 1051 if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) { 1052 vPC[4].u.structure ID->ref();1052 vPC[4].u.structure->ref(); 1053 1053 return; 1054 1054 } 1055 1055 1056 // These instructions don't ref their Structure IDs.1056 // These instructions don't ref their Structures. 1057 1057 ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic)); 1058 1058 }
Note:
See TracChangeset
for help on using the changeset viewer.