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