Changeset 34157 in webkit for trunk/JavaScriptCore/VM/CodeBlock.cpp
- Timestamp:
- May 27, 2008, 4:25:09 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/CodeBlock.cpp
r34156 r34157 113 113 } 114 114 115 static void printInstruction(const char* name, int location, const char* argumentsFormat = 0, ...)116 {117 printf("[%4d] %-20s ", location, name);118 119 if (argumentsFormat) {120 va_list arguments;121 va_start(arguments, argumentsFormat);122 vprintf(argumentsFormat, arguments);123 va_end(arguments);124 }125 126 printf("\n");127 }128 129 115 static void printUnaryOp(int location, Vector<Instruction>::const_iterator& it, const char* op) 130 116 { … … 132 118 int r1 = (++it)->u.operand; 133 119 134 print Instruction(op, location, "%s, %s", registerName(r0).c_str(), registerName(r1).c_str());120 printf("[%4d] %s\t\t %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str()); 135 121 } 136 122 … … 140 126 int r1 = (++it)->u.operand; 141 127 int r2 = (++it)->u.operand; 142 print Instruction(op, location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());128 printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); 143 129 } 144 130 … … 147 133 int r0 = (++it)->u.operand; 148 134 int offset = (++it)->u.operand; 149 print Instruction(op, location, "%s, %d(->%d)", registerName(r0).c_str(), offset, jumpTarget(begin, it, offset));135 printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, jumpTarget(begin, it, offset)); 150 136 } 151 137 … … 211 197 int r0 = (++it)->u.operand; 212 198 int k0 = (++it)->u.operand; 213 print Instruction("load", location, "%s, %s", registerName(r0).c_str(), constantName(exec, k0, jsValues[k0]).c_str());199 printf("[%4d] load\t\t %s, %s\t\t\n", location, registerName(r0).c_str(), constantName(exec, k0, jsValues[k0]).c_str()); 214 200 break; 215 201 } 216 202 case op_new_object: { 217 203 int r0 = (++it)->u.operand; 218 print Instruction("new_object", location, "%s", registerName(r0).c_str());204 printf("[%4d] new_object\t %s\n", location, registerName(r0).c_str()); 219 205 break; 220 206 } 221 207 case op_new_array: { 222 208 int r0 = (++it)->u.operand; 223 print Instruction("new_array", location, "%s", registerName(r0).c_str());209 printf("[%4d] new_array\t %s\n", location, registerName(r0).c_str()); 224 210 break; 225 211 } … … 227 213 int r0 = (++it)->u.operand; 228 214 int re0 = (++it)->u.operand; 229 print Instruction("new_regexp", location, "%s, %s", registerName(r0).c_str(), regexpName(re0, regexps[re0].get()).c_str());215 printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexps[re0].get()).c_str()); 230 216 break; 231 217 } … … 233 219 int r0 = (++it)->u.operand; 234 220 int r1 = (++it)->u.operand; 235 print Instruction("mov", location, "%s, %s", registerName(r0).c_str(), registerName(r1).c_str());221 printf("[%4d] mov\t\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); 236 222 break; 237 223 } … … 266 252 case op_pre_inc: { 267 253 int r0 = (++it)->u.operand; 268 print Instruction("pre_inc", location, "%s", registerName(r0).c_str());254 printf("[%4d] pre_inc\t\t %s\n", location, registerName(r0).c_str()); 269 255 break; 270 256 } 271 257 case op_pre_dec: { 272 258 int r0 = (++it)->u.operand; 273 print Instruction("pre_dec", location, "%s", registerName(r0).c_str());259 printf("[%4d] pre_dec\t\t %s\n", location, registerName(r0).c_str()); 274 260 break; 275 261 } … … 353 339 int r0 = (++it)->u.operand; 354 340 int id0 = (++it)->u.operand; 355 print Instruction("resolve", location, "%s, %s", registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());341 printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str()); 356 342 break; 357 343 } … … 360 346 int id0 = (++it)->u.operand; 361 347 int skipLevels = (++it)->u.operand; 362 print Instruction("resolve_skip", location, "%s, %s, %d", registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), skipLevels);348 printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), skipLevels); 363 349 break; 364 350 } … … 367 353 int index = (++it)->u.operand; 368 354 int skipLevels = (++it)->u.operand; 369 print Instruction("get_scoped_var", location, "%s, %d, %d", registerName(r0).c_str(), index, skipLevels);355 printf("[%4d] get_scoped_var\t\t %s, %d, %d\n", location, registerName(r0).c_str(), index, skipLevels); 370 356 break; 371 357 } … … 374 360 int skipLevels = (++it)->u.operand; 375 361 int r0 = (++it)->u.operand; 376 print Instruction("put_scoped_var", location, "%d, %d, %s", index, skipLevels, registerName(r0).c_str());362 printf("[%4d] put_scoped_var\t\t %d, %d, %s\n", location, index, skipLevels, registerName(r0).c_str()); 377 363 break; 378 364 } … … 380 366 int r0 = (++it)->u.operand; 381 367 int id0 = (++it)->u.operand; 382 print Instruction("resolve_base", location, "%s, %s", registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());368 printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str()); 383 369 break; 384 370 } … … 387 373 int r1 = (++it)->u.operand; 388 374 int id0 = (++it)->u.operand; 389 print Instruction("resolve_with_base", location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());375 printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str()); 390 376 break; 391 377 } … … 394 380 int r1 = (++it)->u.operand; 395 381 int id0 = (++it)->u.operand; 396 print Instruction("resolve_func", location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());382 printf("[%4d] resolve_func\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str()); 397 383 break; 398 384 } … … 401 387 int r1 = (++it)->u.operand; 402 388 int id0 = (++it)->u.operand; 403 print Instruction("get_by_id", location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());389 printf("[%4d] get_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str()); 404 390 break; 405 391 } … … 408 394 int id0 = (++it)->u.operand; 409 395 int r1 = (++it)->u.operand; 410 print Instruction("put_by_id", location, "%s, %s, %s", registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());396 printf("[%4d] put_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str()); 411 397 break; 412 398 } … … 415 401 int id0 = (++it)->u.operand; 416 402 int r1 = (++it)->u.operand; 417 print Instruction("put_getter", location, "%s, %s, %s", registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());403 printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str()); 418 404 break; 419 405 } … … 422 408 int id0 = (++it)->u.operand; 423 409 int r1 = (++it)->u.operand; 424 print Instruction("put_setter", location, "%s, %s, %s", registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());410 printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str()); 425 411 break; 426 412 } … … 429 415 int r1 = (++it)->u.operand; 430 416 int id0 = (++it)->u.operand; 431 print Instruction("del_by_id", location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());417 printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str()); 432 418 break; 433 419 } … … 436 422 int r1 = (++it)->u.operand; 437 423 int r2 = (++it)->u.operand; 438 print Instruction("get_by_val", location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());424 printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); 439 425 break; 440 426 } … … 443 429 int r1 = (++it)->u.operand; 444 430 int r2 = (++it)->u.operand; 445 print Instruction("put_by_val", location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());431 printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); 446 432 break; 447 433 } … … 450 436 int r1 = (++it)->u.operand; 451 437 int r2 = (++it)->u.operand; 452 print Instruction("del_by_val", location, "%s, %s, %s", registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());438 printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); 453 439 break; 454 440 } … … 457 443 unsigned n0 = (++it)->u.operand; 458 444 int r1 = (++it)->u.operand; 459 print Instruction("put_by_index", location, "%s, %u, %s", registerName(r0).c_str(), n0, registerName(r1).c_str());445 printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(r0).c_str(), n0, registerName(r1).c_str()); 460 446 break; 461 447 } 462 448 case op_jmp: { 463 449 int offset = (++it)->u.operand; 464 print Instruction("jmp", location, "%d(->%d)", offset, jumpTarget(begin, it, offset));450 printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, jumpTarget(begin, it, offset)); 465 451 break; 466 452 } … … 476 462 int r0 = (++it)->u.operand; 477 463 int f0 = (++it)->u.operand; 478 print Instruction("new_func", location, "%s, f%d", registerName(r0).c_str(), f0);464 printf("[%4d] new_func\t\t %s, f%d\n", location, registerName(r0).c_str(), f0); 479 465 break; 480 466 } … … 482 468 int r0 = (++it)->u.operand; 483 469 int f0 = (++it)->u.operand; 484 print Instruction("new_func_exp", location, "%s, f%d", registerName(r0).c_str(), f0);470 printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName(r0).c_str(), f0); 485 471 break; 486 472 } … … 491 477 int tempCount = (++it)->u.operand; 492 478 int argCount = (++it)->u.operand; 493 print Instruction("call", location, "%s, %s, %s, %d, %d", registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), tempCount, argCount);479 printf("[%4d] call\t\t %s, %s, %s, %d, %d\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), tempCount, argCount); 494 480 break; 495 481 } … … 500 486 int tempCount = (++it)->u.operand; 501 487 int argCount = (++it)->u.operand; 502 print Instruction("call_eval", location, "%s, %s, %s, %d, %d", registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), tempCount, argCount);488 printf("[%4d] call_eval\t\t %s, %s, %s, %d, %d\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), tempCount, argCount); 503 489 break; 504 490 } 505 491 case op_ret: { 506 492 int r0 = (++it)->u.operand; 507 print Instruction("ret", location, "%s", registerName(r0).c_str());493 printf("[%4d] ret\t\t %s\n", location, registerName(r0).c_str()); 508 494 break; 509 495 } … … 513 499 int tempCount = (++it)->u.operand; 514 500 int argCount = (++it)->u.operand; 515 print Instruction("construct", location, "%s, %s, %d, %d", registerName(r0).c_str(), registerName(r1).c_str(), tempCount, argCount);501 printf("[%4d] construct\t %s, %s, %d, %d\n", location, registerName(r0).c_str(), registerName(r1).c_str(), tempCount, argCount); 516 502 break; 517 503 } … … 519 505 int r0 = (++it)->u.operand; 520 506 int r1 = (++it)->u.operand; 521 print Instruction("get_pnames", location, "%s, %s", registerName(r0).c_str(), registerName(r1).c_str());507 printf("[%4d] get_pnames\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); 522 508 break; 523 509 } … … 526 512 int iter = (++it)->u.operand; 527 513 int offset = (++it)->u.operand; 528 print Instruction("next_pname", location, "%s, %s, %d(->%d)", registerName(dest).c_str(), registerName(iter).c_str(), offset, jumpTarget(begin, it, offset));514 printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, jumpTarget(begin, it, offset)); 529 515 break; 530 516 } 531 517 case op_push_scope: { 532 518 int r0 = (++it)->u.operand; 533 print Instruction("push_scope", location, "%s", registerName(r0).c_str());519 printf("[%4d] push_scope\t %s\n", location, registerName(r0).c_str()); 534 520 break; 535 521 } 536 522 case op_pop_scope: { 537 print Instruction("pop_scope", location);523 printf("[%4d] pop_scope\n", location); 538 524 break; 539 525 } … … 541 527 int scopeDelta = (++it)->u.operand; 542 528 int offset = (++it)->u.operand; 543 print Instruction("jmp_scopes", location, "^%d, %d(->%d)", scopeDelta, offset, jumpTarget(begin, it, offset));529 printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, jumpTarget(begin, it, offset)); 544 530 break; 545 531 } 546 532 case op_catch: { 547 533 int r0 = (++it)->u.operand; 548 print Instruction("catch", location, "%s", registerName(r0).c_str());534 printf("[%4d] catch\t\t %s\n", location, registerName(r0).c_str()); 549 535 break; 550 536 } 551 537 case op_throw: { 552 538 int r0 = (++it)->u.operand; 553 print Instruction("throw", location, "%s", registerName(r0).c_str());539 printf("[%4d] throw\t\t %s\n", location, registerName(r0).c_str()); 554 540 break; 555 541 } … … 558 544 int errorType = (++it)->u.operand; 559 545 int k0 = (++it)->u.operand; 560 print Instruction("new_error", location, "%s, %d, %s", registerName(r0).c_str(), errorType, constantName(exec, k0, jsValues[k0]).c_str());546 printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, jsValues[k0]).c_str()); 561 547 break; 562 548 } … … 564 550 int retAddrDst = (++it)->u.operand; 565 551 int offset = (++it)->u.operand; 566 print Instruction("jsr", location, "%s, %d(->%d)", registerName(retAddrDst).c_str(), offset, jumpTarget(begin, it, offset));552 printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, jumpTarget(begin, it, offset)); 567 553 break; 568 554 } 569 555 case op_sret: { 570 556 int retAddrSrc = (++it)->u.operand; 571 print Instruction("sret", location, "%s", registerName(retAddrSrc).c_str());557 printf("[%4d] sret\t\t %s\n", location, registerName(retAddrSrc).c_str()); 572 558 break; 573 559 } … … 576 562 int firstLine = (++it)->u.operand; 577 563 int lastLine = (++it)->u.operand; 578 print Instruction("debug", location, "%s, %d, %d", debugHookName(debugHookID), firstLine, lastLine);564 printf("[%4d] debug\t\t %s, %d, %d\n", location, debugHookName(debugHookID), firstLine, lastLine); 579 565 break; 580 566 } 581 567 case op_end: { 582 568 int r0 = (++it)->u.operand; 583 print Instruction("end", location, "%s", registerName(r0).c_str());569 printf("[%4d] end\t\t %s\n", location, registerName(r0).c_str()); 584 570 break; 585 571 }
Note:
See TracChangeset
for help on using the changeset viewer.