Changeset 50537 in webkit for trunk/JavaScriptCore/bytecode
- Timestamp:
- Nov 4, 2009, 6:22:08 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/bytecode
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecode/CodeBlock.cpp
r50254 r50537 72 72 } 73 73 74 static CString registerName(int r) 74 static CString constantName(ExecState* exec, int k, JSValue value) 75 { 76 return (valueToSourceString(exec, value) + "(@k" + UString::from(k - FirstConstantRegisterIndex) + ")").UTF8String(); 77 } 78 79 static CString idName(int id0, const Identifier& ident) 80 { 81 return (ident.ustring() + "(@id" + UString::from(id0) +")").UTF8String(); 82 } 83 84 CString CodeBlock::registerName(ExecState* exec, int r) const 75 85 { 76 86 if (r == missingThisObjectMarker()) 77 87 return "<null>"; 78 88 89 if (isConstantRegisterIndex(r)) 90 return constantName(exec, r, getConstant(r)); 91 79 92 return (UString("r") + UString::from(r)).UTF8String(); 80 }81 82 static CString constantName(ExecState* exec, int k, JSValue value)83 {84 return (valueToSourceString(exec, value) + "(@k" + UString::from(k) + ")").UTF8String();85 }86 87 static CString idName(int id0, const Identifier& ident)88 {89 return (ident.ustring() + "(@id" + UString::from(id0) +")").UTF8String();90 93 } 91 94 … … 136 139 } 137 140 138 static void printUnaryOp(int location, Vector<Instruction>::const_iterator& it, const char* op) 141 void CodeBlock::printUnaryOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const 139 142 { 140 143 int r0 = (++it)->u.operand; 141 144 int r1 = (++it)->u.operand; 142 145 143 printf("[%4d] %s\t\t %s, %s\n", location, op, registerName( r0).c_str(), registerName(r1).c_str());144 } 145 146 static void printBinaryOp(int location, Vector<Instruction>::const_iterator& it, const char* op) 146 printf("[%4d] %s\t\t %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); 147 } 148 149 void CodeBlock::printBinaryOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const 147 150 { 148 151 int r0 = (++it)->u.operand; 149 152 int r1 = (++it)->u.operand; 150 153 int r2 = (++it)->u.operand; 151 printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName( r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());152 } 153 154 static void printConditionalJump(const Vector<Instruction>::const_iterator&, Vector<Instruction>::const_iterator& it, int location, const char* op) 154 printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); 155 } 156 157 void CodeBlock::printConditionalJump(ExecState* exec, const Vector<Instruction>::const_iterator&, Vector<Instruction>::const_iterator& it, int location, const char* op) const 155 158 { 156 159 int r0 = (++it)->u.operand; 157 160 int offset = (++it)->u.operand; 158 printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName( r0).c_str(), offset, location + offset);159 } 160 161 static void printGetByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op) 161 printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(exec, r0).c_str(), offset, location + offset); 162 } 163 164 void CodeBlock::printGetByIdOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const 162 165 { 163 166 int r0 = (++it)->u.operand; 164 167 int r1 = (++it)->u.operand; 165 168 int id0 = (++it)->u.operand; 166 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName( r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str());169 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); 167 170 it += 4; 168 171 } 169 172 170 static void printPutByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op) 173 void CodeBlock::printPutByIdOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const 171 174 { 172 175 int r0 = (++it)->u.operand; 173 176 int id0 = (++it)->u.operand; 174 177 int r1 = (++it)->u.operand; 175 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName( r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());178 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); 176 179 it += 4; 177 180 } … … 358 361 size_t i = 0; 359 362 do { 360 printf(" r%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).ascii());363 printf(" k%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).ascii()); 361 364 ++i; 362 365 ++registerIndex; … … 482 485 case op_enter_with_activation: { 483 486 int r0 = (++it)->u.operand; 484 printf("[%4d] enter_with_activation %s\n", location, registerName( r0).c_str());487 printf("[%4d] enter_with_activation %s\n", location, registerName(exec, r0).c_str()); 485 488 break; 486 489 } … … 495 498 case op_convert_this: { 496 499 int r0 = (++it)->u.operand; 497 printf("[%4d] convert_this %s\n", location, registerName( r0).c_str());500 printf("[%4d] convert_this %s\n", location, registerName(exec, r0).c_str()); 498 501 break; 499 502 } 500 503 case op_new_object: { 501 504 int r0 = (++it)->u.operand; 502 printf("[%4d] new_object\t %s\n", location, registerName( r0).c_str());505 printf("[%4d] new_object\t %s\n", location, registerName(exec, r0).c_str()); 503 506 break; 504 507 } … … 507 510 int argv = (++it)->u.operand; 508 511 int argc = (++it)->u.operand; 509 printf("[%4d] new_array\t %s, %s, %d\n", location, registerName( dst).c_str(), registerName(argv).c_str(), argc);512 printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, argv).c_str(), argc); 510 513 break; 511 514 } … … 513 516 int r0 = (++it)->u.operand; 514 517 int re0 = (++it)->u.operand; 515 printf("[%4d] new_regexp\t %s, %s\n", location, registerName( r0).c_str(), regexpName(re0, regexp(re0)).c_str());518 printf("[%4d] new_regexp\t %s, %s\n", location, registerName(exec, r0).c_str(), regexpName(re0, regexp(re0)).c_str()); 516 519 break; 517 520 } … … 519 522 int r0 = (++it)->u.operand; 520 523 int r1 = (++it)->u.operand; 521 printf("[%4d] mov\t\t %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str());524 printf("[%4d] mov\t\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); 522 525 break; 523 526 } 524 527 case op_not: { 525 printUnaryOp( location, it, "not");528 printUnaryOp(exec, location, it, "not"); 526 529 break; 527 530 } 528 531 case op_eq: { 529 printBinaryOp( location, it, "eq");532 printBinaryOp(exec, location, it, "eq"); 530 533 break; 531 534 } 532 535 case op_eq_null: { 533 printUnaryOp( location, it, "eq_null");536 printUnaryOp(exec, location, it, "eq_null"); 534 537 break; 535 538 } 536 539 case op_neq: { 537 printBinaryOp( location, it, "neq");540 printBinaryOp(exec, location, it, "neq"); 538 541 break; 539 542 } 540 543 case op_neq_null: { 541 printUnaryOp( location, it, "neq_null");544 printUnaryOp(exec, location, it, "neq_null"); 542 545 break; 543 546 } 544 547 case op_stricteq: { 545 printBinaryOp( location, it, "stricteq");548 printBinaryOp(exec, location, it, "stricteq"); 546 549 break; 547 550 } 548 551 case op_nstricteq: { 549 printBinaryOp( location, it, "nstricteq");552 printBinaryOp(exec, location, it, "nstricteq"); 550 553 break; 551 554 } 552 555 case op_less: { 553 printBinaryOp( location, it, "less");556 printBinaryOp(exec, location, it, "less"); 554 557 break; 555 558 } 556 559 case op_lesseq: { 557 printBinaryOp( location, it, "lesseq");560 printBinaryOp(exec, location, it, "lesseq"); 558 561 break; 559 562 } 560 563 case op_pre_inc: { 561 564 int r0 = (++it)->u.operand; 562 printf("[%4d] pre_inc\t\t %s\n", location, registerName( r0).c_str());565 printf("[%4d] pre_inc\t\t %s\n", location, registerName(exec, r0).c_str()); 563 566 break; 564 567 } 565 568 case op_pre_dec: { 566 569 int r0 = (++it)->u.operand; 567 printf("[%4d] pre_dec\t\t %s\n", location, registerName( r0).c_str());570 printf("[%4d] pre_dec\t\t %s\n", location, registerName(exec, r0).c_str()); 568 571 break; 569 572 } 570 573 case op_post_inc: { 571 printUnaryOp( location, it, "post_inc");574 printUnaryOp(exec, location, it, "post_inc"); 572 575 break; 573 576 } 574 577 case op_post_dec: { 575 printUnaryOp( location, it, "post_dec");578 printUnaryOp(exec, location, it, "post_dec"); 576 579 break; 577 580 } 578 581 case op_to_jsnumber: { 579 printUnaryOp( location, it, "to_jsnumber");582 printUnaryOp(exec, location, it, "to_jsnumber"); 580 583 break; 581 584 } 582 585 case op_negate: { 583 printUnaryOp( location, it, "negate");586 printUnaryOp(exec, location, it, "negate"); 584 587 break; 585 588 } 586 589 case op_add: { 587 printBinaryOp( location, it, "add");590 printBinaryOp(exec, location, it, "add"); 588 591 ++it; 589 592 break; 590 593 } 591 594 case op_mul: { 592 printBinaryOp( location, it, "mul");595 printBinaryOp(exec, location, it, "mul"); 593 596 ++it; 594 597 break; 595 598 } 596 599 case op_div: { 597 printBinaryOp( location, it, "div");600 printBinaryOp(exec, location, it, "div"); 598 601 ++it; 599 602 break; 600 603 } 601 604 case op_mod: { 602 printBinaryOp( location, it, "mod");605 printBinaryOp(exec, location, it, "mod"); 603 606 break; 604 607 } 605 608 case op_sub: { 606 printBinaryOp( location, it, "sub");609 printBinaryOp(exec, location, it, "sub"); 607 610 ++it; 608 611 break; 609 612 } 610 613 case op_lshift: { 611 printBinaryOp( location, it, "lshift");614 printBinaryOp(exec, location, it, "lshift"); 612 615 break; 613 616 } 614 617 case op_rshift: { 615 printBinaryOp( location, it, "rshift");618 printBinaryOp(exec, location, it, "rshift"); 616 619 break; 617 620 } 618 621 case op_urshift: { 619 printBinaryOp( location, it, "urshift");622 printBinaryOp(exec, location, it, "urshift"); 620 623 break; 621 624 } 622 625 case op_bitand: { 623 printBinaryOp( location, it, "bitand");626 printBinaryOp(exec, location, it, "bitand"); 624 627 ++it; 625 628 break; 626 629 } 627 630 case op_bitxor: { 628 printBinaryOp( location, it, "bitxor");631 printBinaryOp(exec, location, it, "bitxor"); 629 632 ++it; 630 633 break; 631 634 } 632 635 case op_bitor: { 633 printBinaryOp( location, it, "bitor");636 printBinaryOp(exec, location, it, "bitor"); 634 637 ++it; 635 638 break; 636 639 } 637 640 case op_bitnot: { 638 printUnaryOp( location, it, "bitnot");641 printUnaryOp(exec, location, it, "bitnot"); 639 642 break; 640 643 } … … 644 647 int r2 = (++it)->u.operand; 645 648 int r3 = (++it)->u.operand; 646 printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str());649 printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str()); 647 650 break; 648 651 } 649 652 case op_typeof: { 650 printUnaryOp( location, it, "typeof");653 printUnaryOp(exec, location, it, "typeof"); 651 654 break; 652 655 } 653 656 case op_is_undefined: { 654 printUnaryOp( location, it, "is_undefined");657 printUnaryOp(exec, location, it, "is_undefined"); 655 658 break; 656 659 } 657 660 case op_is_boolean: { 658 printUnaryOp( location, it, "is_boolean");661 printUnaryOp(exec, location, it, "is_boolean"); 659 662 break; 660 663 } 661 664 case op_is_number: { 662 printUnaryOp( location, it, "is_number");665 printUnaryOp(exec, location, it, "is_number"); 663 666 break; 664 667 } 665 668 case op_is_string: { 666 printUnaryOp( location, it, "is_string");669 printUnaryOp(exec, location, it, "is_string"); 667 670 break; 668 671 } 669 672 case op_is_object: { 670 printUnaryOp( location, it, "is_object");673 printUnaryOp(exec, location, it, "is_object"); 671 674 break; 672 675 } 673 676 case op_is_function: { 674 printUnaryOp( location, it, "is_function");677 printUnaryOp(exec, location, it, "is_function"); 675 678 break; 676 679 } 677 680 case op_in: { 678 printBinaryOp( location, it, "in");681 printBinaryOp(exec, location, it, "in"); 679 682 break; 680 683 } … … 682 685 int r0 = (++it)->u.operand; 683 686 int id0 = (++it)->u.operand; 684 printf("[%4d] resolve\t\t %s, %s\n", location, registerName( r0).c_str(), idName(id0, m_identifiers[id0]).c_str());687 printf("[%4d] resolve\t\t %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); 685 688 break; 686 689 } … … 689 692 int id0 = (++it)->u.operand; 690 693 int skipLevels = (++it)->u.operand; 691 printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName( r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels);694 printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels); 692 695 break; 693 696 } … … 696 699 JSValue scope = JSValue((++it)->u.jsCell); 697 700 int id0 = (++it)->u.operand; 698 printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName( r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str());701 printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str()); 699 702 it += 2; 700 703 break; … … 704 707 int index = (++it)->u.operand; 705 708 int skipLevels = (++it)->u.operand; 706 printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName( r0).c_str(), index, skipLevels);709 printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(exec, r0).c_str(), index, skipLevels); 707 710 break; 708 711 } … … 711 714 int skipLevels = (++it)->u.operand; 712 715 int r0 = (++it)->u.operand; 713 printf("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName( r0).c_str());716 printf("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName(exec, r0).c_str()); 714 717 break; 715 718 } … … 718 721 JSValue scope = JSValue((++it)->u.jsCell); 719 722 int index = (++it)->u.operand; 720 printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName( r0).c_str(), valueToSourceString(exec, scope).ascii(), index);723 printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), index); 721 724 break; 722 725 } … … 725 728 int index = (++it)->u.operand; 726 729 int r0 = (++it)->u.operand; 727 printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName( r0).c_str());730 printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName(exec, r0).c_str()); 728 731 break; 729 732 } … … 731 734 int r0 = (++it)->u.operand; 732 735 int id0 = (++it)->u.operand; 733 printf("[%4d] resolve_base\t %s, %s\n", location, registerName( r0).c_str(), idName(id0, m_identifiers[id0]).c_str());736 printf("[%4d] resolve_base\t %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); 734 737 break; 735 738 } … … 738 741 int r1 = (++it)->u.operand; 739 742 int id0 = (++it)->u.operand; 740 printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str());743 printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); 741 744 break; 742 745 } 743 746 case op_get_by_id: { 744 printGetByIdOp( location, it, m_identifiers, "get_by_id");747 printGetByIdOp(exec, location, it, "get_by_id"); 745 748 break; 746 749 } 747 750 case op_get_by_id_self: { 748 printGetByIdOp( location, it, m_identifiers, "get_by_id_self");751 printGetByIdOp(exec, location, it, "get_by_id_self"); 749 752 break; 750 753 } 751 754 case op_get_by_id_self_list: { 752 printGetByIdOp( location, it, m_identifiers, "get_by_id_self_list");755 printGetByIdOp(exec, location, it, "get_by_id_self_list"); 753 756 break; 754 757 } 755 758 case op_get_by_id_proto: { 756 printGetByIdOp( location, it, m_identifiers, "get_by_id_proto");759 printGetByIdOp(exec, location, it, "get_by_id_proto"); 757 760 break; 758 761 } 759 762 case op_get_by_id_proto_list: { 760 printGetByIdOp( location, it, m_identifiers, "op_get_by_id_proto_list");763 printGetByIdOp(exec, location, it, "op_get_by_id_proto_list"); 761 764 break; 762 765 } 763 766 case op_get_by_id_chain: { 764 printGetByIdOp( location, it, m_identifiers, "get_by_id_chain");767 printGetByIdOp(exec, location, it, "get_by_id_chain"); 765 768 break; 766 769 } 767 770 case op_get_by_id_generic: { 768 printGetByIdOp( location, it, m_identifiers, "get_by_id_generic");771 printGetByIdOp(exec, location, it, "get_by_id_generic"); 769 772 break; 770 773 } 771 774 case op_get_array_length: { 772 printGetByIdOp( location, it, m_identifiers, "get_array_length");775 printGetByIdOp(exec, location, it, "get_array_length"); 773 776 break; 774 777 } 775 778 case op_get_string_length: { 776 printGetByIdOp( location, it, m_identifiers, "get_string_length");779 printGetByIdOp(exec, location, it, "get_string_length"); 777 780 break; 778 781 } 779 782 case op_put_by_id: { 780 printPutByIdOp( location, it, m_identifiers, "put_by_id");783 printPutByIdOp(exec, location, it, "put_by_id"); 781 784 break; 782 785 } 783 786 case op_put_by_id_replace: { 784 printPutByIdOp( location, it, m_identifiers, "put_by_id_replace");787 printPutByIdOp(exec, location, it, "put_by_id_replace"); 785 788 break; 786 789 } 787 790 case op_put_by_id_transition: { 788 printPutByIdOp( location, it, m_identifiers, "put_by_id_transition");791 printPutByIdOp(exec, location, it, "put_by_id_transition"); 789 792 break; 790 793 } 791 794 case op_put_by_id_generic: { 792 printPutByIdOp( location, it, m_identifiers, "put_by_id_generic");795 printPutByIdOp(exec, location, it, "put_by_id_generic"); 793 796 break; 794 797 } … … 797 800 int id0 = (++it)->u.operand; 798 801 int r1 = (++it)->u.operand; 799 printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName( r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());802 printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); 800 803 break; 801 804 } … … 804 807 int id0 = (++it)->u.operand; 805 808 int r1 = (++it)->u.operand; 806 printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName( r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());809 printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); 807 810 break; 808 811 } … … 815 818 int r1 = (++it)->u.operand; 816 819 int id0 = (++it)->u.operand; 817 printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str());820 printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); 818 821 break; 819 822 } … … 822 825 int r1 = (++it)->u.operand; 823 826 int r2 = (++it)->u.operand; 824 printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());827 printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); 825 828 break; 826 829 } … … 832 835 int r4 = (++it)->u.operand; 833 836 int r5 = (++it)->u.operand; 834 printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), registerName(r4).c_str(), registerName(r5).c_str());837 printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), registerName(exec, r4).c_str(), registerName(exec, r5).c_str()); 835 838 break; 836 839 } … … 839 842 int r1 = (++it)->u.operand; 840 843 int r2 = (++it)->u.operand; 841 printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());844 printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); 842 845 break; 843 846 } … … 846 849 int r1 = (++it)->u.operand; 847 850 int r2 = (++it)->u.operand; 848 printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str());851 printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); 849 852 break; 850 853 } … … 853 856 unsigned n0 = (++it)->u.operand; 854 857 int r1 = (++it)->u.operand; 855 printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName( r0).c_str(), n0, registerName(r1).c_str());858 printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(exec, r0).c_str(), n0, registerName(exec, r1).c_str()); 856 859 break; 857 860 } … … 867 870 } 868 871 case op_jtrue: { 869 printConditionalJump( begin, it, location, "jtrue");872 printConditionalJump(exec, begin, it, location, "jtrue"); 870 873 break; 871 874 } 872 875 case op_loop_if_true: { 873 printConditionalJump( begin, it, location, "loop_if_true");876 printConditionalJump(exec, begin, it, location, "loop_if_true"); 874 877 break; 875 878 } 876 879 case op_jfalse: { 877 printConditionalJump( begin, it, location, "jfalse");880 printConditionalJump(exec, begin, it, location, "jfalse"); 878 881 break; 879 882 } 880 883 case op_jeq_null: { 881 printConditionalJump( begin, it, location, "jeq_null");884 printConditionalJump(exec, begin, it, location, "jeq_null"); 882 885 break; 883 886 } 884 887 case op_jneq_null: { 885 printConditionalJump( begin, it, location, "jneq_null");888 printConditionalJump(exec, begin, it, location, "jneq_null"); 886 889 break; 887 890 } … … 890 893 int r1 = (++it)->u.operand; 891 894 int offset = (++it)->u.operand; 892 printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName( r0).c_str(), registerName(r1).c_str(), offset, location + offset);895 printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); 893 896 break; 894 897 } … … 897 900 int r1 = (++it)->u.operand; 898 901 int offset = (++it)->u.operand; 899 printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName( r0).c_str(), registerName(r1).c_str(), offset, location + offset);902 printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); 900 903 break; 901 904 } … … 904 907 int r1 = (++it)->u.operand; 905 908 int offset = (++it)->u.operand; 906 printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName( r0).c_str(), registerName(r1).c_str(), offset, location + offset);909 printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); 907 910 break; 908 911 } … … 911 914 int r1 = (++it)->u.operand; 912 915 int offset = (++it)->u.operand; 913 printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName( r0).c_str(), registerName(r1).c_str(), offset, location + offset);916 printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); 914 917 break; 915 918 } … … 918 921 int r1 = (++it)->u.operand; 919 922 int offset = (++it)->u.operand; 920 printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName( r0).c_str(), registerName(r1).c_str(), offset, location + offset);923 printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); 921 924 break; 922 925 } … … 925 928 int defaultTarget = (++it)->u.operand; 926 929 int scrutineeRegister = (++it)->u.operand; 927 printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName( scrutineeRegister).c_str());930 printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); 928 931 break; 929 932 } … … 932 935 int defaultTarget = (++it)->u.operand; 933 936 int scrutineeRegister = (++it)->u.operand; 934 printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName( scrutineeRegister).c_str());937 printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); 935 938 break; 936 939 } … … 939 942 int defaultTarget = (++it)->u.operand; 940 943 int scrutineeRegister = (++it)->u.operand; 941 printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName( scrutineeRegister).c_str());944 printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); 942 945 break; 943 946 } … … 945 948 int r0 = (++it)->u.operand; 946 949 int f0 = (++it)->u.operand; 947 printf("[%4d] new_func\t\t %s, f%d\n", location, registerName( r0).c_str(), f0);950 printf("[%4d] new_func\t\t %s, f%d\n", location, registerName(exec, r0).c_str(), f0); 948 951 break; 949 952 } … … 951 954 int r0 = (++it)->u.operand; 952 955 int f0 = (++it)->u.operand; 953 printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName( r0).c_str(), f0);956 printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName(exec, r0).c_str(), f0); 954 957 break; 955 958 } … … 959 962 int argCount = (++it)->u.operand; 960 963 int registerOffset = (++it)->u.operand; 961 printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName( dst).c_str(), registerName(func).c_str(), argCount, registerOffset);964 printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset); 962 965 break; 963 966 } … … 967 970 int argCount = (++it)->u.operand; 968 971 int registerOffset = (++it)->u.operand; 969 printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName( dst).c_str(), registerName(func).c_str(), argCount, registerOffset);972 printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset); 970 973 break; 971 974 } … … 975 978 int argCount = (++it)->u.operand; 976 979 int registerOffset = (++it)->u.operand; 977 printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName( dst).c_str(), registerName(func).c_str(), registerName(argCount).c_str(), registerOffset);980 printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), registerName(exec, argCount).c_str(), registerOffset); 978 981 break; 979 982 } 980 983 case op_load_varargs: { 981 printUnaryOp( location, it, "load_varargs");984 printUnaryOp(exec, location, it, "load_varargs"); 982 985 break; 983 986 } 984 987 case op_tear_off_activation: { 985 988 int r0 = (++it)->u.operand; 986 printf("[%4d] tear_off_activation\t %s\n", location, registerName( r0).c_str());989 printf("[%4d] tear_off_activation\t %s\n", location, registerName(exec, r0).c_str()); 987 990 break; 988 991 } … … 993 996 case op_ret: { 994 997 int r0 = (++it)->u.operand; 995 printf("[%4d] ret\t\t %s\n", location, registerName( r0).c_str());998 printf("[%4d] ret\t\t %s\n", location, registerName(exec, r0).c_str()); 996 999 break; 997 1000 } … … 1003 1006 int proto = (++it)->u.operand; 1004 1007 int thisRegister = (++it)->u.operand; 1005 printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName( dst).c_str(), registerName(func).c_str(), argCount, registerOffset, registerName(proto).c_str(), registerName(thisRegister).c_str());1008 printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset, registerName(exec, proto).c_str(), registerName(exec, thisRegister).c_str()); 1006 1009 break; 1007 1010 } … … 1009 1012 int r0 = (++it)->u.operand; 1010 1013 int r1 = (++it)->u.operand; 1011 printf("[%4d] construct_verify\t %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str());1014 printf("[%4d] construct_verify\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); 1012 1015 break; 1013 1016 } … … 1016 1019 int r1 = (++it)->u.operand; 1017 1020 int count = (++it)->u.operand; 1018 printf("[%4d] op_strcat\t %s, %s, %d\n", location, registerName( r0).c_str(), registerName(r1).c_str(), count);1021 printf("[%4d] op_strcat\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), count); 1019 1022 break; 1020 1023 } … … 1022 1025 int r0 = (++it)->u.operand; 1023 1026 int r1 = (++it)->u.operand; 1024 printf("[%4d] op_to_primitive\t %s, %s\n", location, registerName( r0).c_str(), registerName(r1).c_str());1027 printf("[%4d] op_to_primitive\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); 1025 1028 break; 1026 1029 } … … 1031 1034 int r3 = it[4].u.operand; 1032 1035 int offset = it[5].u.operand; 1033 printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName( r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), offset, location + offset);1036 printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), offset, location + offset); 1034 1037 it += OPCODE_LENGTH(op_get_pnames) - 1; 1035 1038 break; … … 1039 1042 int iter = it[4].u.operand; 1040 1043 int offset = it[5].u.operand; 1041 printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName( dest).c_str(), registerName(iter).c_str(), offset, location + offset);1044 printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(exec, dest).c_str(), registerName(exec, iter).c_str(), offset, location + offset); 1042 1045 it += OPCODE_LENGTH(op_next_pname) - 1; 1043 1046 break; … … 1045 1048 case op_push_scope: { 1046 1049 int r0 = (++it)->u.operand; 1047 printf("[%4d] push_scope\t %s\n", location, registerName( r0).c_str());1050 printf("[%4d] push_scope\t %s\n", location, registerName(exec, r0).c_str()); 1048 1051 break; 1049 1052 } … … 1056 1059 int id0 = (++it)->u.operand; 1057 1060 int r1 = (++it)->u.operand; 1058 printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName( r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());1061 printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); 1059 1062 break; 1060 1063 } … … 1067 1070 case op_catch: { 1068 1071 int r0 = (++it)->u.operand; 1069 printf("[%4d] catch\t\t %s\n", location, registerName( r0).c_str());1072 printf("[%4d] catch\t\t %s\n", location, registerName(exec, r0).c_str()); 1070 1073 break; 1071 1074 } 1072 1075 case op_throw: { 1073 1076 int r0 = (++it)->u.operand; 1074 printf("[%4d] throw\t\t %s\n", location, registerName( r0).c_str());1077 printf("[%4d] throw\t\t %s\n", location, registerName(exec, r0).c_str()); 1075 1078 break; 1076 1079 } … … 1079 1082 int errorType = (++it)->u.operand; 1080 1083 int k0 = (++it)->u.operand; 1081 printf("[%4d] new_error\t %s, %d, %s\n", location, registerName( r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str());1084 printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(exec, r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str()); 1082 1085 break; 1083 1086 } … … 1085 1088 int retAddrDst = (++it)->u.operand; 1086 1089 int offset = (++it)->u.operand; 1087 printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName( retAddrDst).c_str(), offset, location + offset);1090 printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(exec, retAddrDst).c_str(), offset, location + offset); 1088 1091 break; 1089 1092 } 1090 1093 case op_sret: { 1091 1094 int retAddrSrc = (++it)->u.operand; 1092 printf("[%4d] sret\t\t %s\n", location, registerName( retAddrSrc).c_str());1095 printf("[%4d] sret\t\t %s\n", location, registerName(exec, retAddrSrc).c_str()); 1093 1096 break; 1094 1097 } … … 1102 1105 case op_profile_will_call: { 1103 1106 int function = (++it)->u.operand; 1104 printf("[%4d] profile_will_call %s\n", location, registerName( function).c_str());1107 printf("[%4d] profile_will_call %s\n", location, registerName(exec, function).c_str()); 1105 1108 break; 1106 1109 } 1107 1110 case op_profile_did_call: { 1108 1111 int function = (++it)->u.operand; 1109 printf("[%4d] profile_did_call\t %s\n", location, registerName( function).c_str());1112 printf("[%4d] profile_did_call\t %s\n", location, registerName(exec, function).c_str()); 1110 1113 break; 1111 1114 } 1112 1115 case op_end: { 1113 1116 int r0 = (++it)->u.operand; 1114 printf("[%4d] end\t\t %s\n", location, registerName( r0).c_str());1117 printf("[%4d] end\t\t %s\n", location, registerName(exec, r0).c_str()); 1115 1118 break; 1116 1119 } -
trunk/JavaScriptCore/bytecode/CodeBlock.h
r48836 r50537 439 439 void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); } 440 440 Register& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; } 441 ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; }441 ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; } 442 442 ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); } 443 443 … … 483 483 #if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING) 484 484 void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const; 485 486 CString registerName(ExecState*, int r) const; 487 void printUnaryOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; 488 void printBinaryOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; 489 void printConditionalJump(ExecState*, const Vector<Instruction>::const_iterator&, Vector<Instruction>::const_iterator&, int location, const char* op) const; 490 void printGetByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; 491 void printPutByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; 485 492 #endif 486 493
Note:
See TracChangeset
for help on using the changeset viewer.