Changeset 39116 in webkit for trunk/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Dec 8, 2008, 5:06:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecode/CodeBlock.cpp
r39113 r39116 262 262 } 263 263 264 if ( !m_unexpectedConstants.isEmpty()) {264 if (m_rareData && !m_rareData->m_unexpectedConstants.isEmpty()) { 265 265 printf("\nUnexpected Constants:\n"); 266 266 size_t i = 0; 267 267 do { 268 printf(" k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, m_ unexpectedConstants[i]).ascii());268 printf(" k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, m_rareData->m_unexpectedConstants[i]).ascii()); 269 269 ++i; 270 } while (i < m_ unexpectedConstants.size());270 } while (i < m_rareData->m_unexpectedConstants.size()); 271 271 } 272 272 273 if ( !m_regexps.isEmpty()) {273 if (m_rareData && !m_rareData->m_regexps.isEmpty()) { 274 274 printf("\nm_regexps:\n"); 275 275 size_t i = 0; 276 276 do { 277 printf(" re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_r egexps[i].get()).ascii());277 printf(" re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_rareData->m_regexps[i].get()).ascii()); 278 278 ++i; 279 } while (i < m_r egexps.size());279 } while (i < m_rareData->m_regexps.size()); 280 280 } 281 281 … … 298 298 } 299 299 300 if ( !m_exceptionHandlers.isEmpty()) {300 if (m_rareData && !m_rareData->m_exceptionHandlers.isEmpty()) { 301 301 printf("\nException Handlers:\n"); 302 302 unsigned i = 0; 303 303 do { 304 printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, m_ exceptionHandlers[i].start, m_exceptionHandlers[i].end,m_exceptionHandlers[i].target);304 printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, m_rareData->m_exceptionHandlers[i].start, m_rareData->m_exceptionHandlers[i].end, m_rareData->m_exceptionHandlers[i].target); 305 305 ++i; 306 } while (i < m_ exceptionHandlers.size());306 } while (i < m_rareData->m_exceptionHandlers.size()); 307 307 } 308 308 309 if ( !m_immediateSwitchJumpTables.isEmpty()) {309 if (m_rareData && !m_rareData->m_immediateSwitchJumpTables.isEmpty()) { 310 310 printf("Immediate Switch Jump Tables:\n"); 311 311 unsigned i = 0; … … 313 313 printf(" %1d = {\n", i); 314 314 int entry = 0; 315 Vector<int32_t>::const_iterator end = m_ immediateSwitchJumpTables[i].branchOffsets.end();316 for (Vector<int32_t>::const_iterator iter = m_ immediateSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) {315 Vector<int32_t>::const_iterator end = m_rareData->m_immediateSwitchJumpTables[i].branchOffsets.end(); 316 for (Vector<int32_t>::const_iterator iter = m_rareData->m_immediateSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) { 317 317 if (!*iter) 318 318 continue; 319 printf("\t\t%4d => %04d\n", entry + m_ immediateSwitchJumpTables[i].min, *iter);319 printf("\t\t%4d => %04d\n", entry + m_rareData->m_immediateSwitchJumpTables[i].min, *iter); 320 320 } 321 321 printf(" }\n"); 322 322 ++i; 323 } while (i < m_ immediateSwitchJumpTables.size());323 } while (i < m_rareData->m_immediateSwitchJumpTables.size()); 324 324 } 325 325 326 if ( !m_characterSwitchJumpTables.isEmpty()) {326 if (m_rareData && !m_rareData->m_characterSwitchJumpTables.isEmpty()) { 327 327 printf("\nCharacter Switch Jump Tables:\n"); 328 328 unsigned i = 0; … … 330 330 printf(" %1d = {\n", i); 331 331 int entry = 0; 332 Vector<int32_t>::const_iterator end = m_ characterSwitchJumpTables[i].branchOffsets.end();333 for (Vector<int32_t>::const_iterator iter = m_ characterSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) {332 Vector<int32_t>::const_iterator end = m_rareData->m_characterSwitchJumpTables[i].branchOffsets.end(); 333 for (Vector<int32_t>::const_iterator iter = m_rareData->m_characterSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) { 334 334 if (!*iter) 335 335 continue; 336 ASSERT(!((i + m_ characterSwitchJumpTables[i].min) & ~0xFFFF));337 UChar ch = static_cast<UChar>(entry + m_ characterSwitchJumpTables[i].min);336 ASSERT(!((i + m_rareData->m_characterSwitchJumpTables[i].min) & ~0xFFFF)); 337 UChar ch = static_cast<UChar>(entry + m_rareData->m_characterSwitchJumpTables[i].min); 338 338 printf("\t\t\"%s\" => %04d\n", UString(&ch, 1).ascii(), *iter); 339 339 } 340 340 printf(" }\n"); 341 341 ++i; 342 } while (i < m_ characterSwitchJumpTables.size());342 } while (i < m_rareData->m_characterSwitchJumpTables.size()); 343 343 } 344 344 345 if ( !m_stringSwitchJumpTables.isEmpty()) {345 if (m_rareData && !m_rareData->m_stringSwitchJumpTables.isEmpty()) { 346 346 printf("\nString Switch Jump Tables:\n"); 347 347 unsigned i = 0; 348 348 do { 349 349 printf(" %1d = {\n", i); 350 StringJumpTable::StringOffsetTable::const_iterator end = m_ stringSwitchJumpTables[i].offsetTable.end();351 for (StringJumpTable::StringOffsetTable::const_iterator iter = m_ stringSwitchJumpTables[i].offsetTable.begin(); iter != end; ++iter)350 StringJumpTable::StringOffsetTable::const_iterator end = m_rareData->m_stringSwitchJumpTables[i].offsetTable.end(); 351 for (StringJumpTable::StringOffsetTable::const_iterator iter = m_rareData->m_stringSwitchJumpTables[i].offsetTable.begin(); iter != end; ++iter) 352 352 printf("\t\t\"%s\" => %04d\n", UString(iter->first).ascii(), iter->second.branchOffset); 353 353 printf(" }\n"); 354 354 ++i; 355 } while (i < m_ stringSwitchJumpTables.size());355 } while (i < m_rareData->m_stringSwitchJumpTables.size()); 356 356 } 357 357 … … 384 384 int r0 = (++it)->u.operand; 385 385 int k0 = (++it)->u.operand; 386 printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, m_unexpectedConstants[k0]).c_str());386 printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, unexpectedConstant(k0)).c_str()); 387 387 break; 388 388 } … … 402 402 int r0 = (++it)->u.operand; 403 403 int re0 = (++it)->u.operand; 404 printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, m_regexps[re0].get()).c_str());404 printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexp(re0)).c_str()); 405 405 break; 406 406 } … … 916 916 int errorType = (++it)->u.operand; 917 917 int k0 = (++it)->u.operand; 918 printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, m_unexpectedConstants[k0]).c_str());918 printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, unexpectedConstant(k0)).c_str()); 919 919 break; 920 920 } … … 972 972 macro(expressionInfo) \ 973 973 macro(lineInfo) \ 974 975 #define FOR_EACH_MEMBER_VECTOR_RARE_DATA(macro) \ 974 976 macro(regexps) \ 975 977 macro(functions) \ … … 986 988 #define DEFINE_VARS(name) size_t name##IsNotEmpty = 0; 987 989 FOR_EACH_MEMBER_VECTOR(DEFINE_VARS) 990 FOR_EACH_MEMBER_VECTOR_RARE_DATA(DEFINE_VARS); 988 991 #undef DEFINE_VARS 989 992 … … 992 995 size_t evalCodeCacheIsNotEmpty = 0; 993 996 997 size_t hasRareData = 0; 998 994 999 HashSet<CodeBlock*>::const_iterator end = liveCodeBlockSet.end(); 995 1000 for (HashSet<CodeBlock*>::const_iterator it = liveCodeBlockSet.begin(); it != end; ++it) { … … 1002 1007 if (!codeBlock->m_jitReturnAddressVPCMap.isEmpty()) 1003 1008 jitReturnAddressVPCMapIsNotEmpty++; 1004 if (!codeBlock->m_evalCodeCache.isEmpty()) 1005 evalCodeCacheIsNotEmpty++; 1009 1010 if (codeBlock->m_rareData) { 1011 hasRareData++; 1012 #define GET_STATS(name) if (!codeBlock->m_rareData->m_##name.isEmpty()) { name##IsNotEmpty++; } 1013 FOR_EACH_MEMBER_VECTOR_RARE_DATA(GET_STATS) 1014 #undef GET_STATS 1015 1016 if (!codeBlock->m_rareData->m_evalCodeCache.isEmpty()) 1017 evalCodeCacheIsNotEmpty++; 1018 } 1006 1019 } 1007 1020 … … 1009 1022 printf("Size of a single CodeBlock [sizeof(CodeBlock)]: %zu\n", sizeof(CodeBlock)); 1010 1023 1024 printf("Number of CodeBlocks with rare data: %zu\n", hasRareData); 1025 1011 1026 #define PRINT_STATS(name) printf("Number of CodeBlocks with " #name ": %zu\n", name##IsNotEmpty); 1012 1027 FOR_EACH_MEMBER_VECTOR(PRINT_STATS) 1028 FOR_EACH_MEMBER_VECTOR_RARE_DATA(PRINT_STATS) 1013 1029 #undef PRINT_STATS 1030 1014 1031 printf("Number of CodeBlocks with jitReturnAddressVPCMap: %zu\n", jitReturnAddressVPCMapIsNotEmpty); 1015 1032 printf("Number of CodeBlocks with evalCodeCache: %zu\n", evalCodeCacheIsNotEmpty); … … 1164 1181 m_constantRegisters[i].mark(); 1165 1182 1166 for (size_t i = 0; i < m_unexpectedConstants.size(); ++i)1167 if (!m_unexpectedConstants[i]->marked())1168 m_unexpectedConstants[i]->mark();1169 1170 for (size_t i = 0; i < m_functions.size(); ++i)1171 m_functions[i]->body()->mark();1172 1173 1183 for (size_t i = 0; i < m_functionExpressions.size(); ++i) 1174 1184 m_functionExpressions[i]->body()->mark(); 1185 1186 if (m_rareData) { 1187 for (size_t i = 0; i < m_rareData->m_functions.size(); ++i) 1188 m_rareData->m_functions[i]->body()->mark(); 1189 1190 for (size_t i = 0; i < m_rareData->m_unexpectedConstants.size(); ++i) { 1191 if (!m_rareData->m_unexpectedConstants[i]->marked()) 1192 m_rareData->m_unexpectedConstants[i]->mark(); 1193 } 1194 } 1175 1195 } 1176 1196 1177 1197 bool CodeBlock::getHandlerForVPC(const Instruction* vPC, Instruction*& target, int& scopeDepth) 1178 1198 { 1179 Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin(); 1180 Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end(); 1199 if (!m_rareData) 1200 return false; 1201 1202 Vector<HandlerInfo>::iterator ptr = m_rareData->m_exceptionHandlers.begin(); 1203 Vector<HandlerInfo>::iterator end = m_rareData->m_exceptionHandlers.end(); 1181 1204 unsigned addressOffset = vPC - m_instructions.begin(); 1182 1205 ASSERT(addressOffset < m_instructions.size()); … … 1196 1219 void* CodeBlock::nativeExceptionCodeForHandlerVPC(const Instruction* handlerVPC) 1197 1220 { 1198 Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin(); 1199 Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end(); 1221 if (!m_rareData) 1222 return 0; 1223 1224 Vector<HandlerInfo>::iterator ptr = m_rareData->m_exceptionHandlers.begin(); 1225 Vector<HandlerInfo>::iterator end = m_rareData->m_exceptionHandlers.end(); 1200 1226 1201 1227 for (; ptr != end; ++ptr) { … … 1276 1302 m_callLinkInfos.shrinkToFit(); 1277 1303 m_linkedCallerList.shrinkToFit(); 1278 1279 m_exceptionHandlers.shrinkToFit();1280 1304 m_expressionInfo.shrinkToFit(); 1281 1305 m_lineInfo.shrinkToFit(); 1282 1283 1306 m_identifiers.shrinkToFit(); 1284 m_functions.shrinkToFit();1285 1307 m_functionExpressions.shrinkToFit(); 1286 1308 m_constantRegisters.shrinkToFit(); 1287 m_unexpectedConstants.shrinkToFit(); 1288 m_regexps.shrinkToFit(); 1289 1290 m_immediateSwitchJumpTables.shrinkToFit(); 1291 m_characterSwitchJumpTables.shrinkToFit(); 1292 m_stringSwitchJumpTables.shrinkToFit(); 1309 1310 if (m_rareData) { 1311 m_rareData->m_exceptionHandlers.shrinkToFit(); 1312 m_rareData->m_functions.shrinkToFit(); 1313 m_rareData->m_unexpectedConstants.shrinkToFit(); 1314 m_rareData->m_regexps.shrinkToFit(); 1315 m_rareData->m_immediateSwitchJumpTables.shrinkToFit(); 1316 m_rareData->m_characterSwitchJumpTables.shrinkToFit(); 1317 m_rareData->m_stringSwitchJumpTables.shrinkToFit(); 1318 } 1293 1319 } 1294 1320
Note:
See TracChangeset
for help on using the changeset viewer.