Changeset 38425 in webkit for trunk/JavaScriptCore/bytecompiler/CodeGenerator.cpp
- Timestamp:
- Nov 15, 2008, 12:34:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecompiler/CodeGenerator.cpp
r38423 r38425 132 132 m_codeBlock->thisRegister = m_thisRegister.index(); 133 133 134 m_scopeNode->emit Code(*this);134 m_scopeNode->emitBytecode(*this); 135 135 136 136 #ifndef NDEBUG … … 228 228 , m_nextGlobalIndex(-1) 229 229 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 230 , m_last OpcodeID(op_end)230 , m_lastBytecodeID(op_end) 231 231 , m_emitNodeDepth(0) 232 232 { … … 234 234 m_codeBlock->needsFullScopeChain = true; 235 235 236 emit Opcode(op_enter);236 emitBytecode(op_enter); 237 237 codeBlock->globalData = m_globalData; 238 238 … … 305 305 , m_codeType(FunctionCode) 306 306 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 307 , m_last OpcodeID(op_end)307 , m_lastBytecodeID(op_end) 308 308 , m_emitNodeDepth(0) 309 309 { … … 323 323 ++m_codeBlock->numVars; 324 324 m_activationRegisterIndex = newRegister()->index(); 325 emit Opcode(op_enter_with_activation);325 emitBytecode(op_enter_with_activation); 326 326 instructions().append(m_activationRegisterIndex); 327 327 } else 328 emit Opcode(op_enter);328 emitBytecode(op_enter); 329 329 330 330 if (usesArguments) 331 emit Opcode(op_create_arguments);331 emitBytecode(op_create_arguments); 332 332 333 333 const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack(); … … 354 354 355 355 if (functionBody->usesThis()) { 356 emit Opcode(op_convert_this);356 emitBytecode(op_convert_this); 357 357 instructions().append(m_thisRegister.index()); 358 358 } … … 376 376 , m_codeType(EvalCode) 377 377 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 378 , m_last OpcodeID(op_end)378 , m_lastBytecodeID(op_end) 379 379 , m_emitNodeDepth(0) 380 380 { … … 382 382 m_codeBlock->needsFullScopeChain = true; 383 383 384 emit Opcode(op_enter);384 emitBytecode(op_enter); 385 385 codeBlock->globalData = m_globalData; 386 386 m_codeBlock->numParameters = 1; // Allocate space for "this" … … 513 513 514 514 // This disables peephole optimizations when an instruction is a jump target 515 m_last OpcodeID = op_end;515 m_lastBytecodeID = op_end; 516 516 return l0; 517 517 } 518 518 519 void CodeGenerator::emit Opcode(OpcodeID opcodeID)520 { 521 instructions().append(globalData()->interpreter->get Opcode(opcodeID));522 m_last OpcodeID = opcodeID;519 void CodeGenerator::emitBytecode(BytecodeID bytecodeID) 520 { 521 instructions().append(globalData()->interpreter->getBytecode(bytecodeID)); 522 m_lastBytecodeID = bytecodeID; 523 523 } 524 524 … … 554 554 PassRefPtr<LabelID> CodeGenerator::emitJump(LabelID* target) 555 555 { 556 emit Opcode(target->isForwardLabel() ? op_jmp : op_loop);556 emitBytecode(target->isForwardLabel() ? op_jmp : op_loop); 557 557 instructions().append(target->offsetFrom(instructions().size())); 558 558 return target; … … 561 561 PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrue(RegisterID* cond, LabelID* target) 562 562 { 563 if (m_last OpcodeID == op_less && !target->isForwardLabel()) {563 if (m_lastBytecodeID == op_less && !target->isForwardLabel()) { 564 564 int dstIndex; 565 565 int src1Index; … … 570 570 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 571 571 rewindBinaryOp(); 572 emit Opcode(op_loop_if_less);572 emitBytecode(op_loop_if_less); 573 573 instructions().append(src1Index); 574 574 instructions().append(src2Index); … … 576 576 return target; 577 577 } 578 } else if (m_last OpcodeID == op_lesseq && !target->isForwardLabel()) {578 } else if (m_lastBytecodeID == op_lesseq && !target->isForwardLabel()) { 579 579 int dstIndex; 580 580 int src1Index; … … 585 585 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 586 586 rewindBinaryOp(); 587 emit Opcode(op_loop_if_lesseq);587 emitBytecode(op_loop_if_lesseq); 588 588 instructions().append(src1Index); 589 589 instructions().append(src2Index); … … 591 591 return target; 592 592 } 593 } else if (m_last OpcodeID == op_eq_null && target->isForwardLabel()) {593 } else if (m_lastBytecodeID == op_eq_null && target->isForwardLabel()) { 594 594 int dstIndex; 595 595 int srcIndex; … … 599 599 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 600 600 rewindUnaryOp(); 601 emit Opcode(op_jeq_null);601 emitBytecode(op_jeq_null); 602 602 instructions().append(srcIndex); 603 603 instructions().append(target->offsetFrom(instructions().size())); 604 604 return target; 605 605 } 606 } else if (m_last OpcodeID == op_neq_null && target->isForwardLabel()) {606 } else if (m_lastBytecodeID == op_neq_null && target->isForwardLabel()) { 607 607 int dstIndex; 608 608 int srcIndex; … … 612 612 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 613 613 rewindUnaryOp(); 614 emit Opcode(op_jneq_null);614 emitBytecode(op_jneq_null); 615 615 instructions().append(srcIndex); 616 616 instructions().append(target->offsetFrom(instructions().size())); … … 619 619 } 620 620 621 emit Opcode(target->isForwardLabel() ? op_jtrue : op_loop_if_true);621 emitBytecode(target->isForwardLabel() ? op_jtrue : op_loop_if_true); 622 622 instructions().append(cond->index()); 623 623 instructions().append(target->offsetFrom(instructions().size())); … … 629 629 ASSERT(target->isForwardLabel()); 630 630 631 if (m_last OpcodeID == op_less) {631 if (m_lastBytecodeID == op_less) { 632 632 int dstIndex; 633 633 int src1Index; … … 638 638 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 639 639 rewindBinaryOp(); 640 emit Opcode(op_jnless);640 emitBytecode(op_jnless); 641 641 instructions().append(src1Index); 642 642 instructions().append(src2Index); … … 644 644 return target; 645 645 } 646 } else if (m_last OpcodeID == op_not) {646 } else if (m_lastBytecodeID == op_not) { 647 647 int dstIndex; 648 648 int srcIndex; … … 652 652 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 653 653 rewindUnaryOp(); 654 emit Opcode(op_jtrue);654 emitBytecode(op_jtrue); 655 655 instructions().append(srcIndex); 656 656 instructions().append(target->offsetFrom(instructions().size())); 657 657 return target; 658 658 } 659 } else if (m_last OpcodeID == op_eq_null) {659 } else if (m_lastBytecodeID == op_eq_null) { 660 660 int dstIndex; 661 661 int srcIndex; … … 665 665 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 666 666 rewindUnaryOp(); 667 emit Opcode(op_jneq_null);667 emitBytecode(op_jneq_null); 668 668 instructions().append(srcIndex); 669 669 instructions().append(target->offsetFrom(instructions().size())); 670 670 return target; 671 671 } 672 } else if (m_last OpcodeID == op_neq_null) {672 } else if (m_lastBytecodeID == op_neq_null) { 673 673 int dstIndex; 674 674 int srcIndex; … … 678 678 if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) { 679 679 rewindUnaryOp(); 680 emit Opcode(op_jeq_null);680 emitBytecode(op_jeq_null); 681 681 instructions().append(srcIndex); 682 682 instructions().append(target->offsetFrom(instructions().size())); … … 685 685 } 686 686 687 emit Opcode(op_jfalse);687 emitBytecode(op_jfalse); 688 688 instructions().append(cond->index()); 689 689 instructions().append(target->offsetFrom(instructions().size())); … … 748 748 RegisterID* CodeGenerator::emitMove(RegisterID* dst, RegisterID* src) 749 749 { 750 emit Opcode(op_mov);750 emitBytecode(op_mov); 751 751 instructions().append(dst->index()); 752 752 instructions().append(src->index()); … … 754 754 } 755 755 756 RegisterID* CodeGenerator::emitUnaryOp( OpcodeID opcode, RegisterID* dst, RegisterID* src, ResultType type)757 { 758 emit Opcode(opcode);756 RegisterID* CodeGenerator::emitUnaryOp(BytecodeID bytecode, RegisterID* dst, RegisterID* src, ResultType type) 757 { 758 emitBytecode(bytecode); 759 759 instructions().append(dst->index()); 760 760 instructions().append(src->index()); 761 if ( opcode == op_negate)761 if (bytecode == op_negate) 762 762 instructions().append(type.toInt()); 763 763 return dst; … … 766 766 RegisterID* CodeGenerator::emitPreInc(RegisterID* srcDst) 767 767 { 768 emit Opcode(op_pre_inc);768 emitBytecode(op_pre_inc); 769 769 instructions().append(srcDst->index()); 770 770 return srcDst; … … 773 773 RegisterID* CodeGenerator::emitPreDec(RegisterID* srcDst) 774 774 { 775 emit Opcode(op_pre_dec);775 emitBytecode(op_pre_dec); 776 776 instructions().append(srcDst->index()); 777 777 return srcDst; … … 780 780 RegisterID* CodeGenerator::emitPostInc(RegisterID* dst, RegisterID* srcDst) 781 781 { 782 emit Opcode(op_post_inc);782 emitBytecode(op_post_inc); 783 783 instructions().append(dst->index()); 784 784 instructions().append(srcDst->index()); … … 788 788 RegisterID* CodeGenerator::emitPostDec(RegisterID* dst, RegisterID* srcDst) 789 789 { 790 emit Opcode(op_post_dec);790 emitBytecode(op_post_dec); 791 791 instructions().append(dst->index()); 792 792 instructions().append(srcDst->index()); … … 794 794 } 795 795 796 RegisterID* CodeGenerator::emitBinaryOp( OpcodeID opcode, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes types)797 { 798 emit Opcode(opcode);796 RegisterID* CodeGenerator::emitBinaryOp(BytecodeID bytecode, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes types) 797 { 798 emitBytecode(bytecode); 799 799 instructions().append(dst->index()); 800 800 instructions().append(src1->index()); 801 801 instructions().append(src2->index()); 802 802 803 if ( opcode == op_bitor || opcode == op_bitand || opcode == op_bitxor ||804 opcode == op_add || opcode == op_mul || opcode == op_sub) {803 if (bytecode == op_bitor || bytecode == op_bitand || bytecode == op_bitxor || 804 bytecode == op_add || bytecode == op_mul || bytecode == op_sub) { 805 805 instructions().append(types.toInt()); 806 806 } … … 809 809 } 810 810 811 RegisterID* CodeGenerator::emitEqualityOp( OpcodeID opcode, RegisterID* dst, RegisterID* src1, RegisterID* src2)812 { 813 if (m_last OpcodeID == op_typeof) {811 RegisterID* CodeGenerator::emitEqualityOp(BytecodeID bytecode, RegisterID* dst, RegisterID* src1, RegisterID* src2) 812 { 813 if (m_lastBytecodeID == op_typeof) { 814 814 int dstIndex; 815 815 int srcIndex; … … 824 824 if (value == "undefined") { 825 825 rewindUnaryOp(); 826 emit Opcode(op_is_undefined);826 emitBytecode(op_is_undefined); 827 827 instructions().append(dst->index()); 828 828 instructions().append(srcIndex); … … 831 831 if (value == "boolean") { 832 832 rewindUnaryOp(); 833 emit Opcode(op_is_boolean);833 emitBytecode(op_is_boolean); 834 834 instructions().append(dst->index()); 835 835 instructions().append(srcIndex); … … 838 838 if (value == "number") { 839 839 rewindUnaryOp(); 840 emit Opcode(op_is_number);840 emitBytecode(op_is_number); 841 841 instructions().append(dst->index()); 842 842 instructions().append(srcIndex); … … 845 845 if (value == "string") { 846 846 rewindUnaryOp(); 847 emit Opcode(op_is_string);847 emitBytecode(op_is_string); 848 848 instructions().append(dst->index()); 849 849 instructions().append(srcIndex); … … 852 852 if (value == "object") { 853 853 rewindUnaryOp(); 854 emit Opcode(op_is_object);854 emitBytecode(op_is_object); 855 855 instructions().append(dst->index()); 856 856 instructions().append(srcIndex); … … 859 859 if (value == "function") { 860 860 rewindUnaryOp(); 861 emit Opcode(op_is_function);861 emitBytecode(op_is_function); 862 862 instructions().append(dst->index()); 863 863 instructions().append(srcIndex); … … 867 867 } 868 868 869 emit Opcode(opcode);869 emitBytecode(bytecode); 870 870 instructions().append(dst->index()); 871 871 instructions().append(src1->index()); … … 915 915 RegisterID* CodeGenerator::emitUnexpectedLoad(RegisterID* dst, bool b) 916 916 { 917 emit Opcode(op_unexpected_load);917 emitBytecode(op_unexpected_load); 918 918 instructions().append(dst->index()); 919 919 instructions().append(addUnexpectedConstant(jsBoolean(b))); … … 923 923 RegisterID* CodeGenerator::emitUnexpectedLoad(RegisterID* dst, double d) 924 924 { 925 emit Opcode(op_unexpected_load);925 emitBytecode(op_unexpected_load); 926 926 instructions().append(dst->index()); 927 927 instructions().append(addUnexpectedConstant(jsNumber(globalData(), d))); … … 985 985 RegisterID* CodeGenerator::emitInstanceOf(RegisterID* dst, RegisterID* value, RegisterID* base, RegisterID* basePrototype) 986 986 { 987 emit Opcode(op_instanceof);987 emitBytecode(op_instanceof); 988 988 instructions().append(dst->index()); 989 989 instructions().append(value->index()); … … 1000 1000 if (!findScopedProperty(property, index, depth, false, globalObject) && !globalObject) { 1001 1001 // We can't optimise at all :-( 1002 emit Opcode(op_resolve);1002 emitBytecode(op_resolve); 1003 1003 instructions().append(dst->index()); 1004 1004 instructions().append(addConstant(property)); … … 1013 1013 if (globalObject) { 1014 1014 m_codeBlock->globalResolveInstructions.append(instructions().size()); 1015 emit Opcode(op_resolve_global);1015 emitBytecode(op_resolve_global); 1016 1016 instructions().append(dst->index()); 1017 1017 instructions().append(globalObject); … … 1024 1024 // In this case we are at least able to drop a few scope chains from the 1025 1025 // lookup chain, although we still need to hash from then on. 1026 emit Opcode(op_resolve_skip);1026 emitBytecode(op_resolve_skip); 1027 1027 instructions().append(dst->index()); 1028 1028 instructions().append(addConstant(property)); … … 1034 1034 { 1035 1035 if (globalObject) { 1036 emit Opcode(op_get_global_var);1036 emitBytecode(op_get_global_var); 1037 1037 instructions().append(dst->index()); 1038 1038 instructions().append(asCell(globalObject)); … … 1041 1041 } 1042 1042 1043 emit Opcode(op_get_scoped_var);1043 emitBytecode(op_get_scoped_var); 1044 1044 instructions().append(dst->index()); 1045 1045 instructions().append(index); … … 1051 1051 { 1052 1052 if (globalObject) { 1053 emit Opcode(op_put_global_var);1053 emitBytecode(op_put_global_var); 1054 1054 instructions().append(asCell(globalObject)); 1055 1055 instructions().append(index); … … 1057 1057 return value; 1058 1058 } 1059 emit Opcode(op_put_scoped_var);1059 emitBytecode(op_put_scoped_var); 1060 1060 instructions().append(index); 1061 1061 instructions().append(depth); … … 1066 1066 RegisterID* CodeGenerator::emitResolveBase(RegisterID* dst, const Identifier& property) 1067 1067 { 1068 emit Opcode(op_resolve_base);1068 emitBytecode(op_resolve_base); 1069 1069 instructions().append(dst->index()); 1070 1070 instructions().append(addConstant(property)); … … 1074 1074 RegisterID* CodeGenerator::emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property) 1075 1075 { 1076 emit Opcode(op_resolve_with_base);1076 emitBytecode(op_resolve_with_base); 1077 1077 instructions().append(baseDst->index()); 1078 1078 instructions().append(propDst->index()); … … 1083 1083 RegisterID* CodeGenerator::emitResolveFunction(RegisterID* baseDst, RegisterID* funcDst, const Identifier& property) 1084 1084 { 1085 emit Opcode(op_resolve_func);1085 emitBytecode(op_resolve_func); 1086 1086 instructions().append(baseDst->index()); 1087 1087 instructions().append(funcDst->index()); … … 1094 1094 m_codeBlock->propertyAccessInstructions.append(instructions().size()); 1095 1095 1096 emit Opcode(op_get_by_id);1096 emitBytecode(op_get_by_id); 1097 1097 instructions().append(dst->index()); 1098 1098 instructions().append(base->index()); … … 1109 1109 m_codeBlock->propertyAccessInstructions.append(instructions().size()); 1110 1110 1111 emit Opcode(op_put_by_id);1111 emitBytecode(op_put_by_id); 1112 1112 instructions().append(base->index()); 1113 1113 instructions().append(addConstant(property)); … … 1122 1122 RegisterID* CodeGenerator::emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value) 1123 1123 { 1124 emit Opcode(op_put_getter);1124 emitBytecode(op_put_getter); 1125 1125 instructions().append(base->index()); 1126 1126 instructions().append(addConstant(property)); … … 1131 1131 RegisterID* CodeGenerator::emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value) 1132 1132 { 1133 emit Opcode(op_put_setter);1133 emitBytecode(op_put_setter); 1134 1134 instructions().append(base->index()); 1135 1135 instructions().append(addConstant(property)); … … 1140 1140 RegisterID* CodeGenerator::emitDeleteById(RegisterID* dst, RegisterID* base, const Identifier& property) 1141 1141 { 1142 emit Opcode(op_del_by_id);1142 emitBytecode(op_del_by_id); 1143 1143 instructions().append(dst->index()); 1144 1144 instructions().append(base->index()); … … 1149 1149 RegisterID* CodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property) 1150 1150 { 1151 emit Opcode(op_get_by_val);1151 emitBytecode(op_get_by_val); 1152 1152 instructions().append(dst->index()); 1153 1153 instructions().append(base->index()); … … 1158 1158 RegisterID* CodeGenerator::emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value) 1159 1159 { 1160 emit Opcode(op_put_by_val);1160 emitBytecode(op_put_by_val); 1161 1161 instructions().append(base->index()); 1162 1162 instructions().append(property->index()); … … 1167 1167 RegisterID* CodeGenerator::emitDeleteByVal(RegisterID* dst, RegisterID* base, RegisterID* property) 1168 1168 { 1169 emit Opcode(op_del_by_val);1169 emitBytecode(op_del_by_val); 1170 1170 instructions().append(dst->index()); 1171 1171 instructions().append(base->index()); … … 1176 1176 RegisterID* CodeGenerator::emitPutByIndex(RegisterID* base, unsigned index, RegisterID* value) 1177 1177 { 1178 emit Opcode(op_put_by_index);1178 emitBytecode(op_put_by_index); 1179 1179 instructions().append(base->index()); 1180 1180 instructions().append(index); … … 1185 1185 RegisterID* CodeGenerator::emitNewObject(RegisterID* dst) 1186 1186 { 1187 emit Opcode(op_new_object);1187 emitBytecode(op_new_object); 1188 1188 instructions().append(dst->index()); 1189 1189 return dst; … … 1199 1199 emitNode(argv.last().get(), n->value()); 1200 1200 } 1201 emit Opcode(op_new_array);1201 emitBytecode(op_new_array); 1202 1202 instructions().append(dst->index()); 1203 1203 instructions().append(argv.size() ? argv[0]->index() : 0); // argv … … 1208 1208 RegisterID* CodeGenerator::emitNewFunction(RegisterID* dst, FuncDeclNode* n) 1209 1209 { 1210 emit Opcode(op_new_func);1210 emitBytecode(op_new_func); 1211 1211 instructions().append(dst->index()); 1212 1212 instructions().append(addConstant(n)); … … 1216 1216 RegisterID* CodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) 1217 1217 { 1218 emit Opcode(op_new_regexp);1218 emitBytecode(op_new_regexp); 1219 1219 instructions().append(dst->index()); 1220 1220 instructions().append(addRegExp(regExp)); … … 1225 1225 RegisterID* CodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) 1226 1226 { 1227 emit Opcode(op_new_func_exp);1227 emitBytecode(op_new_func_exp); 1228 1228 instructions().append(r0->index()); 1229 1229 instructions().append(addConstant(n)); … … 1241 1241 } 1242 1242 1243 RegisterID* CodeGenerator::emitCall( OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)1244 { 1245 ASSERT( opcodeID == op_call || opcodeID == op_call_eval);1243 RegisterID* CodeGenerator::emitCall(BytecodeID bytecodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset) 1244 { 1245 ASSERT(bytecodeID == op_call || bytecodeID == op_call_eval); 1246 1246 ASSERT(func->refCount()); 1247 1247 … … 1274 1274 1275 1275 if (m_shouldEmitProfileHooks) { 1276 emit Opcode(op_profile_will_call);1276 emitBytecode(op_profile_will_call); 1277 1277 instructions().append(func->index()); 1278 1278 } … … 1282 1282 1283 1283 // Emit call. 1284 emit Opcode(opcodeID);1284 emitBytecode(bytecodeID); 1285 1285 instructions().append(dst->index()); // dst 1286 1286 instructions().append(func->index()); // func … … 1289 1289 1290 1290 if (m_shouldEmitProfileHooks) { 1291 emit Opcode(op_profile_did_call);1291 emitBytecode(op_profile_did_call); 1292 1292 instructions().append(func->index()); 1293 1293 … … 1304 1304 { 1305 1305 if (m_codeBlock->needsFullScopeChain) { 1306 emit Opcode(op_tear_off_activation);1306 emitBytecode(op_tear_off_activation); 1307 1307 instructions().append(m_activationRegisterIndex); 1308 1308 } else if (m_codeBlock->usesArguments && m_codeBlock->numParameters > 1) 1309 emit Opcode(op_tear_off_arguments);1309 emitBytecode(op_tear_off_arguments); 1310 1310 1311 1311 return emitUnaryNoDstOp(op_ret, src); 1312 1312 } 1313 1313 1314 RegisterID* CodeGenerator::emitUnaryNoDstOp( OpcodeID opcode, RegisterID* src)1315 { 1316 emit Opcode(opcode);1314 RegisterID* CodeGenerator::emitUnaryNoDstOp(BytecodeID bytecode, RegisterID* src) 1315 { 1316 emitBytecode(bytecode); 1317 1317 instructions().append(src->index()); 1318 1318 return src; … … 1344 1344 1345 1345 if (m_shouldEmitProfileHooks) { 1346 emit Opcode(op_profile_will_call);1346 emitBytecode(op_profile_will_call); 1347 1347 instructions().append(func->index()); 1348 1348 } … … 1360 1360 m_codeBlock->callLinkInfos.append(CallLinkInfo()); 1361 1361 1362 emit Opcode(op_construct);1362 emitBytecode(op_construct); 1363 1363 instructions().append(dst->index()); // dst 1364 1364 instructions().append(func->index()); // func … … 1368 1368 instructions().append(argv[0]->index()); // thisRegister 1369 1369 1370 emit Opcode(op_construct_verify);1370 emitBytecode(op_construct_verify); 1371 1371 instructions().append(dst->index()); 1372 1372 instructions().append(argv[0]->index()); 1373 1373 1374 1374 if (m_shouldEmitProfileHooks) { 1375 emit Opcode(op_profile_did_call);1375 emitBytecode(op_profile_did_call); 1376 1376 instructions().append(func->index()); 1377 1377 … … 1398 1398 ASSERT(!m_scopeContextStack.last().isFinallyBlock); 1399 1399 1400 emit Opcode(op_pop_scope);1400 emitBytecode(op_pop_scope); 1401 1401 1402 1402 m_scopeContextStack.removeLast(); … … 1408 1408 if (!m_shouldEmitDebugHooks) 1409 1409 return; 1410 emit Opcode(op_debug);1410 emitBytecode(op_debug); 1411 1411 instructions().append(debugHookID); 1412 1412 instructions().append(firstLine); … … 1517 1517 // We need to remove a number of dynamic scopes to get to the next 1518 1518 // finally block 1519 emit Opcode(op_jmp_scopes);1519 emitBytecode(op_jmp_scopes); 1520 1520 instructions().append(nNormalScopes); 1521 1521 … … 1559 1559 return emitComplexJumpScopes(target, &m_scopeContextStack.last(), &m_scopeContextStack.last() - scopeDelta); 1560 1560 1561 emit Opcode(op_jmp_scopes);1561 emitBytecode(op_jmp_scopes); 1562 1562 instructions().append(scopeDelta); 1563 1563 instructions().append(target->offsetFrom(instructions().size())); … … 1567 1567 RegisterID* CodeGenerator::emitNextPropertyName(RegisterID* dst, RegisterID* iter, LabelID* target) 1568 1568 { 1569 emit Opcode(op_next_pname);1569 emitBytecode(op_next_pname); 1570 1570 instructions().append(dst->index()); 1571 1571 instructions().append(iter->index()); … … 1578 1578 HandlerInfo info = { start->offsetFrom(0), end->offsetFrom(0), instructions().size(), m_dynamicScopeDepth, 0 }; 1579 1579 exceptionHandlers().append(info); 1580 emit Opcode(op_catch);1580 emitBytecode(op_catch); 1581 1581 instructions().append(targetRegister->index()); 1582 1582 return targetRegister; … … 1585 1585 RegisterID* CodeGenerator::emitNewError(RegisterID* dst, ErrorType type, JSValue* message) 1586 1586 { 1587 emit Opcode(op_new_error);1587 emitBytecode(op_new_error); 1588 1588 instructions().append(dst->index()); 1589 1589 instructions().append(static_cast<int>(type)); … … 1594 1594 PassRefPtr<LabelID> CodeGenerator::emitJumpSubroutine(RegisterID* retAddrDst, LabelID* finally) 1595 1595 { 1596 emit Opcode(op_jsr);1596 emitBytecode(op_jsr); 1597 1597 instructions().append(retAddrDst->index()); 1598 1598 instructions().append(finally->offsetFrom(instructions().size())); … … 1602 1602 void CodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc) 1603 1603 { 1604 emit Opcode(op_sret);1604 emitBytecode(op_sret); 1605 1605 instructions().append(retAddrSrc->index()); 1606 1606 } … … 1613 1613 m_dynamicScopeDepth++; 1614 1614 1615 emit Opcode(op_push_new_scope);1615 emitBytecode(op_push_new_scope); 1616 1616 instructions().append(dst->index()); 1617 1617 instructions().append(addConstant(property)); … … 1624 1624 switch (type) { 1625 1625 case SwitchInfo::SwitchImmediate: 1626 emit Opcode(op_switch_imm);1626 emitBytecode(op_switch_imm); 1627 1627 break; 1628 1628 case SwitchInfo::SwitchCharacter: 1629 emit Opcode(op_switch_char);1629 emitBytecode(op_switch_char); 1630 1630 break; 1631 1631 case SwitchInfo::SwitchString: 1632 emit Opcode(op_switch_string);1632 emitBytecode(op_switch_string); 1633 1633 break; 1634 1634 default: … … 1717 1717 m_switchContextStack.removeLast(); 1718 1718 if (switchInfo.switchType == SwitchInfo::SwitchImmediate) { 1719 instructions()[switchInfo. opcodeOffset + 1] = m_codeBlock->immediateSwitchJumpTables.size();1720 instructions()[switchInfo. opcodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.opcodeOffset + 3);1719 instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->immediateSwitchJumpTables.size(); 1720 instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.bytecodeOffset + 3); 1721 1721 1722 1722 m_codeBlock->immediateSwitchJumpTables.append(SimpleJumpTable()); 1723 1723 SimpleJumpTable& jumpTable = m_codeBlock->immediateSwitchJumpTables.last(); 1724 1724 1725 prepareJumpTableForImmediateSwitch(jumpTable, switchInfo. opcodeOffset + 3, clauseCount, labels, nodes, min, max);1725 prepareJumpTableForImmediateSwitch(jumpTable, switchInfo.bytecodeOffset + 3, clauseCount, labels, nodes, min, max); 1726 1726 } else if (switchInfo.switchType == SwitchInfo::SwitchCharacter) { 1727 instructions()[switchInfo. opcodeOffset + 1] = m_codeBlock->characterSwitchJumpTables.size();1728 instructions()[switchInfo. opcodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.opcodeOffset + 3);1727 instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->characterSwitchJumpTables.size(); 1728 instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.bytecodeOffset + 3); 1729 1729 1730 1730 m_codeBlock->characterSwitchJumpTables.append(SimpleJumpTable()); 1731 1731 SimpleJumpTable& jumpTable = m_codeBlock->characterSwitchJumpTables.last(); 1732 1732 1733 prepareJumpTableForCharacterSwitch(jumpTable, switchInfo. opcodeOffset + 3, clauseCount, labels, nodes, min, max);1733 prepareJumpTableForCharacterSwitch(jumpTable, switchInfo.bytecodeOffset + 3, clauseCount, labels, nodes, min, max); 1734 1734 } else { 1735 1735 ASSERT(switchInfo.switchType == SwitchInfo::SwitchString); 1736 instructions()[switchInfo. opcodeOffset + 1] = m_codeBlock->stringSwitchJumpTables.size();1737 instructions()[switchInfo. opcodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.opcodeOffset + 3);1736 instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->stringSwitchJumpTables.size(); 1737 instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.bytecodeOffset + 3); 1738 1738 1739 1739 m_codeBlock->stringSwitchJumpTables.append(StringJumpTable()); 1740 1740 StringJumpTable& jumpTable = m_codeBlock->stringSwitchJumpTables.last(); 1741 1741 1742 prepareJumpTableForStringSwitch(jumpTable, switchInfo. opcodeOffset + 3, clauseCount, labels, nodes);1742 prepareJumpTableForStringSwitch(jumpTable, switchInfo.bytecodeOffset + 3, clauseCount, labels, nodes); 1743 1743 } 1744 1744 }
Note:
See TracChangeset
for help on using the changeset viewer.