Changeset 121480 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Jun 28, 2012, 4:03:07 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r121215 r121480 49 49 #include <stdio.h> 50 50 #include <wtf/StringExtras.h> 51 #include <wtf/UnusedParam.h> 51 52 52 53 #if ENABLE(DFG_JIT) … … 92 93 { 93 94 return makeUString(ident.ustring(), "(@id", UString::number(id0), ")").utf8(); 95 } 96 97 void CodeBlock::dumpBytecodeCommentAndNewLine(int location) 98 { 99 #if ENABLE(BYTECODE_COMMENTS) 100 const char* comment = commentForBytecodeOffset(location); 101 if (comment) 102 dataLog("\t\t ; %s", comment); 103 #else 104 UNUSED_PARAM(location); 105 #endif 106 dataLog("\n"); 94 107 } 95 108 … … 157 170 int r1 = (++it)->u.operand; 158 171 159 dataLog("[%4d] %s\t\t %s, %s\n", location, op, registerName(exec, r0).data(), registerName(exec, r1).data()); 172 dataLog("[%4d] %s\t\t %s, %s", location, op, registerName(exec, r0).data(), registerName(exec, r1).data()); 173 dumpBytecodeCommentAndNewLine(location); 160 174 } 161 175 … … 165 179 int r1 = (++it)->u.operand; 166 180 int r2 = (++it)->u.operand; 167 dataLog("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 181 dataLog("[%4d] %s\t\t %s, %s, %s", location, op, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 182 dumpBytecodeCommentAndNewLine(location); 168 183 } 169 184 … … 172 187 int r0 = (++it)->u.operand; 173 188 int offset = (++it)->u.operand; 174 dataLog("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(exec, r0).data(), offset, location + offset); 189 dataLog("[%4d] %s\t\t %s, %d(->%d)", location, op, registerName(exec, r0).data(), offset, location + offset); 190 dumpBytecodeCommentAndNewLine(location); 175 191 } 176 192 … … 403 419 #endif 404 420 } 405 d ataLog("\n");421 dumpBytecodeCommentAndNewLine(location); 406 422 it += 2; 407 423 } … … 412 428 int id0 = (++it)->u.operand; 413 429 int r1 = (++it)->u.operand; 414 dataLog("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data()); 430 dataLog("[%4d] %s\t %s, %s, %s", location, op, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data()); 431 dumpBytecodeCommentAndNewLine(location); 415 432 it += 5; 416 433 } … … 651 668 switch (exec->interpreter()->getOpcodeID(it->u.opcode)) { 652 669 case op_enter: { 653 dataLog("[%4d] enter\n", location); 670 dataLog("[%4d] enter", location); 671 dumpBytecodeCommentAndNewLine(location); 654 672 break; 655 673 } 656 674 case op_create_activation: { 657 675 int r0 = (++it)->u.operand; 658 dataLog("[%4d] create_activation %s\n", location, registerName(exec, r0).data()); 676 dataLog("[%4d] create_activation %s", location, registerName(exec, r0).data()); 677 dumpBytecodeCommentAndNewLine(location); 659 678 break; 660 679 } 661 680 case op_create_arguments: { 662 681 int r0 = (++it)->u.operand; 663 dataLog("[%4d] create_arguments\t %s\n", location, registerName(exec, r0).data()); 682 dataLog("[%4d] create_arguments\t %s", location, registerName(exec, r0).data()); 683 dumpBytecodeCommentAndNewLine(location); 664 684 break; 665 685 } 666 686 case op_init_lazy_reg: { 667 687 int r0 = (++it)->u.operand; 668 dataLog("[%4d] init_lazy_reg\t %s\n", location, registerName(exec, r0).data()); 688 dataLog("[%4d] init_lazy_reg\t %s", location, registerName(exec, r0).data()); 689 dumpBytecodeCommentAndNewLine(location); 669 690 break; 670 691 } 671 692 case op_create_this: { 672 693 int r0 = (++it)->u.operand; 673 dataLog("[%4d] create_this %s\n", location, registerName(exec, r0).data()); 694 dataLog("[%4d] create_this %s", location, registerName(exec, r0).data()); 695 dumpBytecodeCommentAndNewLine(location); 674 696 break; 675 697 } 676 698 case op_convert_this: { 677 699 int r0 = (++it)->u.operand; 678 dataLog("[%4d] convert_this\t %s\n", location, registerName(exec, r0).data()); 700 dataLog("[%4d] convert_this\t %s", location, registerName(exec, r0).data()); 701 dumpBytecodeCommentAndNewLine(location); 679 702 ++it; // Skip value profile. 680 703 break; … … 682 705 case op_new_object: { 683 706 int r0 = (++it)->u.operand; 684 dataLog("[%4d] new_object\t %s\n", location, registerName(exec, r0).data()); 707 dataLog("[%4d] new_object\t %s", location, registerName(exec, r0).data()); 708 dumpBytecodeCommentAndNewLine(location); 685 709 break; 686 710 } … … 689 713 int argv = (++it)->u.operand; 690 714 int argc = (++it)->u.operand; 691 dataLog("[%4d] new_array\t %s, %s, %d\n", location, registerName(exec, dst).data(), registerName(exec, argv).data(), argc); 715 dataLog("[%4d] new_array\t %s, %s, %d", location, registerName(exec, dst).data(), registerName(exec, argv).data(), argc); 716 dumpBytecodeCommentAndNewLine(location); 692 717 break; 693 718 } … … 696 721 int argv = (++it)->u.operand; 697 722 int argc = (++it)->u.operand; 698 dataLog("[%4d] new_array_buffer %s, %d, %d\n", location, registerName(exec, dst).data(), argv, argc); 723 dataLog("[%4d] new_array_buffer %s, %d, %d", location, registerName(exec, dst).data(), argv, argc); 724 dumpBytecodeCommentAndNewLine(location); 699 725 break; 700 726 } … … 704 730 dataLog("[%4d] new_regexp\t %s, ", location, registerName(exec, r0).data()); 705 731 if (r0 >=0 && r0 < (int)numberOfRegExps()) 706 dataLog("%s \n", regexpName(re0, regexp(re0)).data());732 dataLog("%s", regexpName(re0, regexp(re0)).data()); 707 733 else 708 dataLog("bad_regexp(%d)\n", re0); 734 dataLog("bad_regexp(%d)", re0); 735 dumpBytecodeCommentAndNewLine(location); 709 736 break; 710 737 } … … 712 739 int r0 = (++it)->u.operand; 713 740 int r1 = (++it)->u.operand; 714 dataLog("[%4d] mov\t\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 741 dataLog("[%4d] mov\t\t %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 742 dumpBytecodeCommentAndNewLine(location); 715 743 break; 716 744 } … … 761 789 case op_pre_inc: { 762 790 int r0 = (++it)->u.operand; 763 dataLog("[%4d] pre_inc\t\t %s\n", location, registerName(exec, r0).data()); 791 dataLog("[%4d] pre_inc\t\t %s", location, registerName(exec, r0).data()); 792 dumpBytecodeCommentAndNewLine(location); 764 793 break; 765 794 } 766 795 case op_pre_dec: { 767 796 int r0 = (++it)->u.operand; 768 dataLog("[%4d] pre_dec\t\t %s\n", location, registerName(exec, r0).data()); 797 dataLog("[%4d] pre_dec\t\t %s", location, registerName(exec, r0).data()); 798 dumpBytecodeCommentAndNewLine(location); 769 799 break; 770 800 } … … 838 868 case op_check_has_instance: { 839 869 int base = (++it)->u.operand; 840 dataLog("[%4d] check_has_instance\t\t %s\n", location, registerName(exec, base).data()); 870 dataLog("[%4d] check_has_instance\t\t %s", location, registerName(exec, base).data()); 871 dumpBytecodeCommentAndNewLine(location); 841 872 break; 842 873 } … … 846 877 int r2 = (++it)->u.operand; 847 878 int r3 = (++it)->u.operand; 848 dataLog("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data()); 879 dataLog("[%4d] instanceof\t\t %s, %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data()); 880 dumpBytecodeCommentAndNewLine(location); 849 881 break; 850 882 } … … 884 916 int r0 = (++it)->u.operand; 885 917 int id0 = (++it)->u.operand; 886 dataLog("[%4d] resolve\t\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 918 dataLog("[%4d] resolve\t\t %s, %s", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 919 dumpBytecodeCommentAndNewLine(location); 887 920 it++; 888 921 break; … … 892 925 int id0 = (++it)->u.operand; 893 926 int skipLevels = (++it)->u.operand; 894 dataLog("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), skipLevels); 927 dataLog("[%4d] resolve_skip\t %s, %s, %d", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), skipLevels); 928 dumpBytecodeCommentAndNewLine(location); 895 929 it++; 896 930 break; … … 899 933 int r0 = (++it)->u.operand; 900 934 int id0 = (++it)->u.operand; 901 dataLog("[%4d] resolve_global\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 935 dataLog("[%4d] resolve_global\t %s, %s", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 936 dumpBytecodeCommentAndNewLine(location); 902 937 it += 3; 903 938 break; … … 909 944 ++it; 910 945 int depth = (++it)->u.operand; 911 dataLog("[%4d] resolve_global_dynamic\t %s, %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), idName(id0, m_identifiers[id0]).data(), depth); 946 dataLog("[%4d] resolve_global_dynamic\t %s, %s, %s, %d", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), idName(id0, m_identifiers[id0]).data(), depth); 947 dumpBytecodeCommentAndNewLine(location); 912 948 ++it; 913 949 break; … … 917 953 int index = (++it)->u.operand; 918 954 int skipLevels = (++it)->u.operand; 919 dataLog("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(exec, r0).data(), index, skipLevels); 955 dataLog("[%4d] get_scoped_var\t %s, %d, %d", location, registerName(exec, r0).data(), index, skipLevels); 956 dumpBytecodeCommentAndNewLine(location); 920 957 it++; 921 958 break; … … 925 962 int skipLevels = (++it)->u.operand; 926 963 int r0 = (++it)->u.operand; 927 dataLog("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName(exec, r0).data()); 964 dataLog("[%4d] put_scoped_var\t %d, %d, %s", location, index, skipLevels, registerName(exec, r0).data()); 965 dumpBytecodeCommentAndNewLine(location); 928 966 break; 929 967 } … … 931 969 int r0 = (++it)->u.operand; 932 970 WriteBarrier<Unknown>* registerPointer = (++it)->u.registerPointer; 933 dataLog("[%4d] get_global_var\t %s, g%d(%p)\n", location, registerName(exec, r0).data(), m_globalObject->findRegisterIndex(registerPointer), registerPointer); 971 dataLog("[%4d] get_global_var\t %s, g%d(%p)", location, registerName(exec, r0).data(), m_globalObject->findRegisterIndex(registerPointer), registerPointer); 972 dumpBytecodeCommentAndNewLine(location); 934 973 it++; 935 974 break; … … 938 977 int r0 = (++it)->u.operand; 939 978 WriteBarrier<Unknown>* registerPointer = (++it)->u.registerPointer; 940 dataLog("[%4d] get_global_var_watchable\t %s, g%d(%p)\n", location, registerName(exec, r0).data(), m_globalObject->findRegisterIndex(registerPointer), registerPointer); 979 dataLog("[%4d] get_global_var_watchable\t %s, g%d(%p)", location, registerName(exec, r0).data(), m_globalObject->findRegisterIndex(registerPointer), registerPointer); 980 dumpBytecodeCommentAndNewLine(location); 941 981 it++; 942 982 it++; … … 946 986 WriteBarrier<Unknown>* registerPointer = (++it)->u.registerPointer; 947 987 int r0 = (++it)->u.operand; 948 dataLog("[%4d] put_global_var\t g%d(%p), %s\n", location, m_globalObject->findRegisterIndex(registerPointer), registerPointer, registerName(exec, r0).data()); 988 dataLog("[%4d] put_global_var\t g%d(%p), %s", location, m_globalObject->findRegisterIndex(registerPointer), registerPointer, registerName(exec, r0).data()); 989 dumpBytecodeCommentAndNewLine(location); 949 990 break; 950 991 } … … 952 993 WriteBarrier<Unknown>* registerPointer = (++it)->u.registerPointer; 953 994 int r0 = (++it)->u.operand; 954 dataLog("[%4d] put_global_var_check\t g%d(%p), %s\n", location, m_globalObject->findRegisterIndex(registerPointer), registerPointer, registerName(exec, r0).data()); 995 dataLog("[%4d] put_global_var_check\t g%d(%p), %s", location, m_globalObject->findRegisterIndex(registerPointer), registerPointer, registerName(exec, r0).data()); 996 dumpBytecodeCommentAndNewLine(location); 955 997 it++; 956 998 it++; … … 961 1003 int id0 = (++it)->u.operand; 962 1004 int isStrict = (++it)->u.operand; 963 dataLog("[%4d] resolve_base%s\t %s, %s\n", location, isStrict ? "_strict" : "", registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 1005 dataLog("[%4d] resolve_base%s\t %s, %s", location, isStrict ? "_strict" : "", registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 1006 dumpBytecodeCommentAndNewLine(location); 964 1007 it++; 965 1008 break; … … 968 1011 int r0 = (++it)->u.operand; 969 1012 int id0 = (++it)->u.operand; 970 dataLog("[%4d] ensure_property_exists\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 1013 dataLog("[%4d] ensure_property_exists\t %s, %s", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data()); 1014 dumpBytecodeCommentAndNewLine(location); 971 1015 break; 972 1016 } … … 975 1019 int r1 = (++it)->u.operand; 976 1020 int id0 = (++it)->u.operand; 977 dataLog("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data()); 1021 dataLog("[%4d] resolve_with_base %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data()); 1022 dumpBytecodeCommentAndNewLine(location); 978 1023 it++; 979 1024 break; … … 983 1028 int r1 = (++it)->u.operand; 984 1029 int id0 = (++it)->u.operand; 985 dataLog("[%4d] resolve_with_this %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data()); 1030 dataLog("[%4d] resolve_with_this %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data()); 1031 dumpBytecodeCommentAndNewLine(location); 986 1032 it++; 987 1033 break; … … 1002 1048 printGetByIdOp(exec, location, it); 1003 1049 printGetByIdCacheStatus(exec, location); 1004 d ataLog("\n");1050 dumpBytecodeCommentAndNewLine(location); 1005 1051 break; 1006 1052 } … … 1039 1085 int r1 = (++it)->u.operand; 1040 1086 int r2 = (++it)->u.operand; 1041 dataLog("[%4d] put_getter_setter\t %s, %s, %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1087 dataLog("[%4d] put_getter_setter\t %s, %s, %s, %s", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1088 dumpBytecodeCommentAndNewLine(location); 1042 1089 break; 1043 1090 } … … 1071 1118 } 1072 1119 #endif 1073 d ataLog("\n");1120 dumpBytecodeCommentAndNewLine(location); 1074 1121 ++it; 1075 1122 printGetByIdOp(exec, location, it); … … 1082 1129 int r1 = (++it)->u.operand; 1083 1130 int id0 = (++it)->u.operand; 1084 dataLog("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data()); 1131 dataLog("[%4d] del_by_id\t %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data()); 1132 dumpBytecodeCommentAndNewLine(location); 1085 1133 break; 1086 1134 } … … 1089 1137 int r1 = (++it)->u.operand; 1090 1138 int r2 = (++it)->u.operand; 1091 dataLog("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1139 dataLog("[%4d] get_by_val\t %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1140 dumpBytecodeCommentAndNewLine(location); 1092 1141 it++; 1093 1142 break; … … 1097 1146 int r1 = (++it)->u.operand; 1098 1147 int r2 = (++it)->u.operand; 1099 dataLog("[%4d] get_argument_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1148 dataLog("[%4d] get_argument_by_val\t %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1149 dumpBytecodeCommentAndNewLine(location); 1100 1150 ++it; 1101 1151 break; … … 1108 1158 int r4 = (++it)->u.operand; 1109 1159 int r5 = (++it)->u.operand; 1110 dataLog("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data(), registerName(exec, r4).data(), registerName(exec, r5).data()); 1160 dataLog("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data(), registerName(exec, r4).data(), registerName(exec, r5).data()); 1161 dumpBytecodeCommentAndNewLine(location); 1111 1162 break; 1112 1163 } … … 1115 1166 int r1 = (++it)->u.operand; 1116 1167 int r2 = (++it)->u.operand; 1117 dataLog("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1168 dataLog("[%4d] put_by_val\t %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1169 dumpBytecodeCommentAndNewLine(location); 1118 1170 break; 1119 1171 } … … 1122 1174 int r1 = (++it)->u.operand; 1123 1175 int r2 = (++it)->u.operand; 1124 dataLog("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1176 dataLog("[%4d] del_by_val\t %s, %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); 1177 dumpBytecodeCommentAndNewLine(location); 1125 1178 break; 1126 1179 } … … 1129 1182 unsigned n0 = (++it)->u.operand; 1130 1183 int r1 = (++it)->u.operand; 1131 dataLog("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(exec, r0).data(), n0, registerName(exec, r1).data()); 1184 dataLog("[%4d] put_by_index\t %s, %u, %s", location, registerName(exec, r0).data(), n0, registerName(exec, r1).data()); 1185 dumpBytecodeCommentAndNewLine(location); 1132 1186 break; 1133 1187 } 1134 1188 case op_jmp: { 1135 1189 int offset = (++it)->u.operand; 1136 dataLog("[%4d] jmp\t\t %d(->%d)\n", location, offset, location + offset); 1190 dataLog("[%4d] jmp\t\t %d(->%d)", location, offset, location + offset); 1191 dumpBytecodeCommentAndNewLine(location); 1137 1192 break; 1138 1193 } 1139 1194 case op_loop: { 1140 1195 int offset = (++it)->u.operand; 1141 dataLog("[%4d] loop\t\t %d(->%d)\n", location, offset, location + offset); 1196 dataLog("[%4d] loop\t\t %d(->%d)", location, offset, location + offset); 1197 dumpBytecodeCommentAndNewLine(location); 1142 1198 break; 1143 1199 } … … 1170 1226 void* pointer = (++it)->u.pointer; 1171 1227 int offset = (++it)->u.operand; 1172 dataLog("[%4d] jneq_ptr\t\t %s, %p, %d(->%d)\n", location, registerName(exec, r0).data(), pointer, offset, location + offset); 1228 dataLog("[%4d] jneq_ptr\t\t %s, %p, %d(->%d)", location, registerName(exec, r0).data(), pointer, offset, location + offset); 1229 dumpBytecodeCommentAndNewLine(location); 1173 1230 break; 1174 1231 } … … 1177 1234 int r1 = (++it)->u.operand; 1178 1235 int offset = (++it)->u.operand; 1179 dataLog("[%4d] jless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1236 dataLog("[%4d] jless\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1237 dumpBytecodeCommentAndNewLine(location); 1180 1238 break; 1181 1239 } … … 1184 1242 int r1 = (++it)->u.operand; 1185 1243 int offset = (++it)->u.operand; 1186 dataLog("[%4d] jlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1244 dataLog("[%4d] jlesseq\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1245 dumpBytecodeCommentAndNewLine(location); 1187 1246 break; 1188 1247 } … … 1191 1250 int r1 = (++it)->u.operand; 1192 1251 int offset = (++it)->u.operand; 1193 dataLog("[%4d] jgreater\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1252 dataLog("[%4d] jgreater\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1253 dumpBytecodeCommentAndNewLine(location); 1194 1254 break; 1195 1255 } … … 1198 1258 int r1 = (++it)->u.operand; 1199 1259 int offset = (++it)->u.operand; 1200 dataLog("[%4d] jgreatereq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1260 dataLog("[%4d] jgreatereq\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1261 dumpBytecodeCommentAndNewLine(location); 1201 1262 break; 1202 1263 } … … 1205 1266 int r1 = (++it)->u.operand; 1206 1267 int offset = (++it)->u.operand; 1207 dataLog("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1268 dataLog("[%4d] jnless\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1269 dumpBytecodeCommentAndNewLine(location); 1208 1270 break; 1209 1271 } … … 1212 1274 int r1 = (++it)->u.operand; 1213 1275 int offset = (++it)->u.operand; 1214 dataLog("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1276 dataLog("[%4d] jnlesseq\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1277 dumpBytecodeCommentAndNewLine(location); 1215 1278 break; 1216 1279 } … … 1219 1282 int r1 = (++it)->u.operand; 1220 1283 int offset = (++it)->u.operand; 1221 dataLog("[%4d] jngreater\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1284 dataLog("[%4d] jngreater\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1285 dumpBytecodeCommentAndNewLine(location); 1222 1286 break; 1223 1287 } … … 1226 1290 int r1 = (++it)->u.operand; 1227 1291 int offset = (++it)->u.operand; 1228 dataLog("[%4d] jngreatereq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1292 dataLog("[%4d] jngreatereq\t\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1293 dumpBytecodeCommentAndNewLine(location); 1229 1294 break; 1230 1295 } … … 1233 1298 int r1 = (++it)->u.operand; 1234 1299 int offset = (++it)->u.operand; 1235 dataLog("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1300 dataLog("[%4d] loop_if_less\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1301 dumpBytecodeCommentAndNewLine(location); 1236 1302 break; 1237 1303 } … … 1240 1306 int r1 = (++it)->u.operand; 1241 1307 int offset = (++it)->u.operand; 1242 dataLog("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1308 dataLog("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1309 dumpBytecodeCommentAndNewLine(location); 1243 1310 break; 1244 1311 } … … 1247 1314 int r1 = (++it)->u.operand; 1248 1315 int offset = (++it)->u.operand; 1249 dataLog("[%4d] loop_if_greater\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1316 dataLog("[%4d] loop_if_greater\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1317 dumpBytecodeCommentAndNewLine(location); 1250 1318 break; 1251 1319 } … … 1254 1322 int r1 = (++it)->u.operand; 1255 1323 int offset = (++it)->u.operand; 1256 dataLog("[%4d] loop_if_greatereq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1324 dataLog("[%4d] loop_if_greatereq\t %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset); 1325 dumpBytecodeCommentAndNewLine(location); 1257 1326 break; 1258 1327 } 1259 1328 case op_loop_hint: { 1260 dataLog("[%4d] loop_hint\n", location); 1329 dataLog("[%4d] loop_hint", location); 1330 dumpBytecodeCommentAndNewLine(location); 1261 1331 break; 1262 1332 } … … 1265 1335 int defaultTarget = (++it)->u.operand; 1266 1336 int scrutineeRegister = (++it)->u.operand; 1267 dataLog("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data()); 1337 dataLog("[%4d] switch_imm\t %d, %d(->%d), %s", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data()); 1338 dumpBytecodeCommentAndNewLine(location); 1268 1339 break; 1269 1340 } … … 1272 1343 int defaultTarget = (++it)->u.operand; 1273 1344 int scrutineeRegister = (++it)->u.operand; 1274 dataLog("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data()); 1345 dataLog("[%4d] switch_char\t %d, %d(->%d), %s", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data()); 1346 dumpBytecodeCommentAndNewLine(location); 1275 1347 break; 1276 1348 } … … 1279 1351 int defaultTarget = (++it)->u.operand; 1280 1352 int scrutineeRegister = (++it)->u.operand; 1281 dataLog("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data()); 1353 dataLog("[%4d] switch_string\t %d, %d(->%d), %s", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data()); 1354 dumpBytecodeCommentAndNewLine(location); 1282 1355 break; 1283 1356 } … … 1286 1359 int f0 = (++it)->u.operand; 1287 1360 int shouldCheck = (++it)->u.operand; 1288 dataLog("[%4d] new_func\t\t %s, f%d, %s\n", location, registerName(exec, r0).data(), f0, shouldCheck ? "<Checked>" : "<Unchecked>"); 1361 dataLog("[%4d] new_func\t\t %s, f%d, %s", location, registerName(exec, r0).data(), f0, shouldCheck ? "<Checked>" : "<Unchecked>"); 1362 dumpBytecodeCommentAndNewLine(location); 1289 1363 break; 1290 1364 } … … 1292 1366 int r0 = (++it)->u.operand; 1293 1367 int f0 = (++it)->u.operand; 1294 dataLog("[%4d] new_func_exp\t %s, f%d\n", location, registerName(exec, r0).data(), f0); 1368 dataLog("[%4d] new_func_exp\t %s, f%d", location, registerName(exec, r0).data(), f0); 1369 dumpBytecodeCommentAndNewLine(location); 1295 1370 break; 1296 1371 } … … 1308 1383 int arguments = (++it)->u.operand; 1309 1384 int firstFreeRegister = (++it)->u.operand; 1310 dataLog("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(exec, callee).data(), registerName(exec, thisValue).data(), registerName(exec, arguments).data(), firstFreeRegister); 1385 dataLog("[%4d] call_varargs\t %s, %s, %s, %d", location, registerName(exec, callee).data(), registerName(exec, thisValue).data(), registerName(exec, arguments).data(), firstFreeRegister); 1386 dumpBytecodeCommentAndNewLine(location); 1311 1387 break; 1312 1388 } … … 1314 1390 int r0 = (++it)->u.operand; 1315 1391 int r1 = (++it)->u.operand; 1316 dataLog("[%4d] tear_off_activation\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 1392 dataLog("[%4d] tear_off_activation\t %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 1393 dumpBytecodeCommentAndNewLine(location); 1317 1394 break; 1318 1395 } 1319 1396 case op_tear_off_arguments: { 1320 1397 int r0 = (++it)->u.operand; 1321 dataLog("[%4d] tear_off_arguments %s\n", location, registerName(exec, r0).data()); 1398 dataLog("[%4d] tear_off_arguments %s", location, registerName(exec, r0).data()); 1399 dumpBytecodeCommentAndNewLine(location); 1322 1400 break; 1323 1401 } 1324 1402 case op_ret: { 1325 1403 int r0 = (++it)->u.operand; 1326 dataLog("[%4d] ret\t\t %s\n", location, registerName(exec, r0).data()); 1404 dataLog("[%4d] ret\t\t %s", location, registerName(exec, r0).data()); 1405 dumpBytecodeCommentAndNewLine(location); 1327 1406 break; 1328 1407 } 1329 1408 case op_call_put_result: { 1330 1409 int r0 = (++it)->u.operand; 1331 dataLog("[%4d] call_put_result\t\t %s\n", location, registerName(exec, r0).data()); 1410 dataLog("[%4d] call_put_result\t\t %s", location, registerName(exec, r0).data()); 1411 dumpBytecodeCommentAndNewLine(location); 1332 1412 it++; 1333 1413 break; … … 1336 1416 int r0 = (++it)->u.operand; 1337 1417 int r1 = (++it)->u.operand; 1338 dataLog("[%4d] constructor_ret\t\t %s %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 1418 dataLog("[%4d] constructor_ret\t\t %s %s", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 1419 dumpBytecodeCommentAndNewLine(location); 1339 1420 break; 1340 1421 } … … 1347 1428 int r1 = (++it)->u.operand; 1348 1429 int count = (++it)->u.operand; 1349 dataLog("[%4d] strcat\t\t %s, %s, %d\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), count); 1430 dataLog("[%4d] strcat\t\t %s, %s, %d", location, registerName(exec, r0).data(), registerName(exec, r1).data(), count); 1431 dumpBytecodeCommentAndNewLine(location); 1350 1432 break; 1351 1433 } … … 1353 1435 int r0 = (++it)->u.operand; 1354 1436 int r1 = (++it)->u.operand; 1355 dataLog("[%4d] to_primitive\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 1437 dataLog("[%4d] to_primitive\t %s, %s", location, registerName(exec, r0).data(), registerName(exec, r1).data()); 1438 dumpBytecodeCommentAndNewLine(location); 1356 1439 break; 1357 1440 } … … 1362 1445 int r3 = it[4].u.operand; 1363 1446 int offset = it[5].u.operand; 1364 dataLog("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data(), offset, location + offset); 1447 dataLog("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data(), offset, location + offset); 1448 dumpBytecodeCommentAndNewLine(location); 1365 1449 it += OPCODE_LENGTH(op_get_pnames) - 1; 1366 1450 break; … … 1373 1457 int iter = it[5].u.operand; 1374 1458 int offset = it[6].u.operand; 1375 dataLog("[%4d] next_pname\t %s, %s, %s, %s, %s, %d(->%d)\n", location, registerName(exec, dest).data(), registerName(exec, base).data(), registerName(exec, i).data(), registerName(exec, size).data(), registerName(exec, iter).data(), offset, location + offset); 1459 dataLog("[%4d] next_pname\t %s, %s, %s, %s, %s, %d(->%d)", location, registerName(exec, dest).data(), registerName(exec, base).data(), registerName(exec, i).data(), registerName(exec, size).data(), registerName(exec, iter).data(), offset, location + offset); 1460 dumpBytecodeCommentAndNewLine(location); 1376 1461 it += OPCODE_LENGTH(op_next_pname) - 1; 1377 1462 break; … … 1379 1464 case op_push_scope: { 1380 1465 int r0 = (++it)->u.operand; 1381 dataLog("[%4d] push_scope\t %s\n", location, registerName(exec, r0).data()); 1466 dataLog("[%4d] push_scope\t %s", location, registerName(exec, r0).data()); 1467 dumpBytecodeCommentAndNewLine(location); 1382 1468 break; 1383 1469 } 1384 1470 case op_pop_scope: { 1385 dataLog("[%4d] pop_scope\n", location); 1471 dataLog("[%4d] pop_scope", location); 1472 dumpBytecodeCommentAndNewLine(location); 1386 1473 break; 1387 1474 } … … 1390 1477 int id0 = (++it)->u.operand; 1391 1478 int r1 = (++it)->u.operand; 1392 dataLog("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data()); 1479 dataLog("[%4d] push_new_scope \t%s, %s, %s", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data()); 1480 dumpBytecodeCommentAndNewLine(location); 1393 1481 break; 1394 1482 } … … 1396 1484 int scopeDelta = (++it)->u.operand; 1397 1485 int offset = (++it)->u.operand; 1398 dataLog("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, location + offset); 1486 dataLog("[%4d] jmp_scopes\t^%d, %d(->%d)", location, scopeDelta, offset, location + offset); 1487 dumpBytecodeCommentAndNewLine(location); 1399 1488 break; 1400 1489 } 1401 1490 case op_catch: { 1402 1491 int r0 = (++it)->u.operand; 1403 dataLog("[%4d] catch\t\t %s\n", location, registerName(exec, r0).data()); 1492 dataLog("[%4d] catch\t\t %s", location, registerName(exec, r0).data()); 1493 dumpBytecodeCommentAndNewLine(location); 1404 1494 break; 1405 1495 } 1406 1496 case op_throw: { 1407 1497 int r0 = (++it)->u.operand; 1408 dataLog("[%4d] throw\t\t %s\n", location, registerName(exec, r0).data()); 1498 dataLog("[%4d] throw\t\t %s", location, registerName(exec, r0).data()); 1499 dumpBytecodeCommentAndNewLine(location); 1409 1500 break; 1410 1501 } 1411 1502 case op_throw_reference_error: { 1412 1503 int k0 = (++it)->u.operand; 1413 dataLog("[%4d] throw_reference_error\t %s\n", location, constantName(exec, k0, getConstant(k0)).data()); 1504 dataLog("[%4d] throw_reference_error\t %s", location, constantName(exec, k0, getConstant(k0)).data()); 1505 dumpBytecodeCommentAndNewLine(location); 1414 1506 break; 1415 1507 } … … 1418 1510 int firstLine = (++it)->u.operand; 1419 1511 int lastLine = (++it)->u.operand; 1420 dataLog("[%4d] debug\t\t %s, %d, %d\n", location, debugHookName(debugHookID), firstLine, lastLine); 1512 dataLog("[%4d] debug\t\t %s, %d, %d", location, debugHookName(debugHookID), firstLine, lastLine); 1513 dumpBytecodeCommentAndNewLine(location); 1421 1514 break; 1422 1515 } 1423 1516 case op_profile_will_call: { 1424 1517 int function = (++it)->u.operand; 1425 dataLog("[%4d] profile_will_call %s\n", location, registerName(exec, function).data()); 1518 dataLog("[%4d] profile_will_call %s", location, registerName(exec, function).data()); 1519 dumpBytecodeCommentAndNewLine(location); 1426 1520 break; 1427 1521 } 1428 1522 case op_profile_did_call: { 1429 1523 int function = (++it)->u.operand; 1430 dataLog("[%4d] profile_did_call\t %s\n", location, registerName(exec, function).data()); 1524 dataLog("[%4d] profile_did_call\t %s", location, registerName(exec, function).data()); 1525 dumpBytecodeCommentAndNewLine(location); 1431 1526 break; 1432 1527 } 1433 1528 case op_end: { 1434 1529 int r0 = (++it)->u.operand; 1435 dataLog("[%4d] end\t\t %s\n", location, registerName(exec, r0).data()); 1530 dataLog("[%4d] end\t\t %s", location, registerName(exec, r0).data()); 1531 dumpBytecodeCommentAndNewLine(location); 1436 1532 break; 1437 1533 } … … 1602 1698 , m_reoptimizationRetryCounter(0) 1603 1699 , m_lineInfo(other.m_lineInfo) 1700 #if ENABLE(BYTECODE_COMMENTS) 1701 , m_bytecodeCommentIterator(0) 1702 #endif 1604 1703 #if ENABLE(JIT) 1605 1704 , m_canCompileWithDFGState(DFG::CapabilityLevelNotSet) … … 1654 1753 , m_optimizationDelayCounter(0) 1655 1754 , m_reoptimizationRetryCounter(0) 1755 #if ENABLE(BYTECODE_COMMENTS) 1756 , m_bytecodeCommentIterator(0) 1757 #endif 1656 1758 { 1657 1759 ASSERT(m_source); … … 2128 2230 } 2129 2231 2232 #if ENABLE(BYTECODE_COMMENTS) 2233 // Finds the comment string for the specified bytecode offset/PC is available. 2234 const char* CodeBlock::commentForBytecodeOffset(unsigned bytecodeOffset) 2235 { 2236 ASSERT(bytecodeOffset < instructions().size()); 2237 2238 Vector<Comment>& comments = m_bytecodeComments; 2239 size_t numberOfComments = comments.size(); 2240 const char* result = 0; 2241 2242 if (!numberOfComments) 2243 return 0; // No comments to match with. 2244 2245 // The next match is most likely the next comment in the list. 2246 // Do a quick check to see if that is a match first. 2247 // m_bytecodeCommentIterator should already be pointing to the 2248 // next comment we should check. 2249 2250 ASSERT(m_bytecodeCommentIterator < comments.size()); 2251 2252 size_t i = m_bytecodeCommentIterator; 2253 size_t commentPC = comments[i].pc; 2254 if (commentPC == bytecodeOffset) { 2255 // We've got a match. All done! 2256 m_bytecodeCommentIterator = i; 2257 result = comments[i].string; 2258 } else if (commentPC > bytecodeOffset) { 2259 // The current comment is already greater than the requested PC. 2260 // Start searching from the first comment. 2261 i = 0; 2262 } else { 2263 // Otherwise, the current comment's PC is less than the requested PC. 2264 // Hence, we can just start searching from the next comment in the 2265 // list. 2266 i++; 2267 } 2268 2269 // If the result is still not found, do a linear search in the range 2270 // that we've determined above. 2271 if (!result) { 2272 for (; i < comments.size(); ++i) { 2273 commentPC = comments[i].pc; 2274 if (commentPC == bytecodeOffset) { 2275 result = comments[i].string; 2276 break; 2277 } 2278 if (comments[i].pc > bytecodeOffset) { 2279 // The current comment PC is already past the requested 2280 // bytecodeOffset. Hence, there are no more possible 2281 // matches. Just fail. 2282 break; 2283 } 2284 } 2285 } 2286 2287 // Update the iterator to point to the next comment. 2288 if (++i >= numberOfComments) { 2289 // At most point to the last comment entry. This ensures that the 2290 // next time we call this function, the quick checks will at least 2291 // have one entry to check and can fail fast if appropriate. 2292 i = numberOfComments - 1; 2293 } 2294 m_bytecodeCommentIterator = i; 2295 return result; 2296 } 2297 2298 void CodeBlock::dumpBytecodeComments() 2299 { 2300 Vector<Comment>& comments = m_bytecodeComments; 2301 printf("Comments for codeblock %p: size %lu\n", this, comments.size()); 2302 for (size_t i = 0; i < comments.size(); ++i) 2303 printf(" pc %lu : '%s'\n", comments[i].pc, comments[i].string); 2304 printf("End of comments for codeblock %p\n", this); 2305 } 2306 #endif // ENABLE_BYTECODE_COMMENTS 2307 2130 2308 HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset) 2131 2309 {
Note:
See TracChangeset
for help on using the changeset viewer.