Changeset 96238 in webkit
- Timestamp:
- Sep 28, 2011 11:05:03 AM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r96230 r96238 1 2011-09-27 Yuqiang Xian <yuqiang.xian@intel.com> 2 3 Value profiling in baseline JIT for JSVALUE32_64 4 https://bugs.webkit.org/show_bug.cgi?id=68750 5 6 Reviewed by Geoff Garen. 7 8 * jit/JITArithmetic32_64.cpp: 9 (JSC::JIT::emit_op_mul): 10 (JSC::JIT::emit_op_div): 11 * jit/JITCall32_64.cpp: 12 (JSC::JIT::emit_op_call_put_result): 13 * jit/JITOpcodes32_64.cpp: 14 (JSC::JIT::emit_op_resolve): 15 (JSC::JIT::emit_op_resolve_base): 16 (JSC::JIT::emit_op_resolve_skip): 17 (JSC::JIT::emit_op_resolve_global): 18 (JSC::JIT::emitSlow_op_resolve_global): 19 (JSC::JIT::emit_op_resolve_with_base): 20 (JSC::JIT::emit_op_resolve_with_this): 21 * jit/JITPropertyAccess32_64.cpp: 22 (JSC::JIT::emit_op_method_check): 23 (JSC::JIT::emit_op_get_by_val): 24 (JSC::JIT::emitSlow_op_get_by_val): 25 (JSC::JIT::emit_op_get_by_id): 26 (JSC::JIT::emitSlow_op_get_by_id): 27 (JSC::JIT::emit_op_get_scoped_var): 28 (JSC::JIT::emit_op_get_global_var): 29 * jit/JITStubCall.h: 30 (JSC::JITStubCall::callWithValueProfiling): 31 1 32 2011-09-28 Yuqiang Xian <yuqiang.xian@intel.com> 2 33 -
trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp
r95901 r96238 1049 1049 divDouble(fpRegT1, fpRegT0); 1050 1050 1051 #if ENABLE( DFG_JIT)1051 #if ENABLE(VALUE_PROFILER) 1052 1052 // Is the result actually an integer? The DFG JIT would really like to know. If it's 1053 1053 // not an integer, we increment a count. If this together with the slow case counter -
trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp
r95901 r96238 859 859 emitStoreDouble(dst, fpRegT1); 860 860 break; 861 case op_div: 861 case op_div: { 862 862 emitLoadDouble(op1, fpRegT1); 863 863 divDouble(fpRegT0, fpRegT1); 864 865 #if ENABLE(VALUE_PROFILER) 866 // Is the result actually an integer? The DFG JIT would really like to know. If it's 867 // not an integer, we increment a count. If this together with the slow case counter 868 // are below threshold then the DFG JIT will compile this division with a specualtion 869 // that the remainder is zero. 870 871 // As well, there are cases where a double result here would cause an important field 872 // in the heap to sometimes have doubles in it, resulting in double predictions getting 873 // propagated to a use site where it might cause damage (such as the index to an array 874 // access). So if we are DFG compiling anything in the program, we want this code to 875 // ensure that it produces integers whenever possible. 876 877 // FIXME: This will fail to convert to integer if the result is zero. We should 878 // distinguish between positive zero and negative zero here. 879 880 JumpList notInteger; 881 branchConvertDoubleToInt32(fpRegT1, regT2, notInteger, fpRegT0); 882 // If we've got an integer, we might as well make that the result of the division. 883 emitStoreInt32(dst, regT2); 884 Jump isInteger = jump(); 885 notInteger.link(this); 886 add32(Imm32(1), AbsoluteAddress(&m_codeBlock->specialFastCaseProfileForBytecodeOffset(m_bytecodeOffset)->m_counter)); 864 887 emitStoreDouble(dst, fpRegT1); 865 break; 888 isInteger.link(this); 889 #else 890 emitStoreDouble(dst, fpRegT1); 891 #endif 892 break; 893 } 866 894 case op_jless: 867 895 emitLoadDouble(op1, fpRegT2); … … 936 964 emitStoreDouble(dst, fpRegT0); 937 965 break; 938 case op_div: 966 case op_div: { 939 967 emitLoadDouble(op2, fpRegT2); 940 968 divDouble(fpRegT2, fpRegT0); 969 #if ENABLE(VALUE_PROFILER) 970 // Is the result actually an integer? The DFG JIT would really like to know. If it's 971 // not an integer, we increment a count. If this together with the slow case counter 972 // are below threshold then the DFG JIT will compile this division with a specualtion 973 // that the remainder is zero. 974 975 // As well, there are cases where a double result here would cause an important field 976 // in the heap to sometimes have doubles in it, resulting in double predictions getting 977 // propagated to a use site where it might cause damage (such as the index to an array 978 // access). So if we are DFG compiling anything in the program, we want this code to 979 // ensure that it produces integers whenever possible. 980 981 // FIXME: This will fail to convert to integer if the result is zero. We should 982 // distinguish between positive zero and negative zero here. 983 984 JumpList notInteger; 985 branchConvertDoubleToInt32(fpRegT0, regT2, notInteger, fpRegT1); 986 // If we've got an integer, we might as well make that the result of the division. 987 emitStoreInt32(dst, regT2); 988 Jump isInteger = jump(); 989 notInteger.link(this); 990 add32(Imm32(1), AbsoluteAddress(&m_codeBlock->specialFastCaseProfileForBytecodeOffset(m_bytecodeOffset)->m_counter)); 941 991 emitStoreDouble(dst, fpRegT0); 942 break; 992 isInteger.link(this); 993 #else 994 emitStoreDouble(dst, fpRegT0); 995 #endif 996 break; 997 } 943 998 case op_jless: 944 999 emitLoadDouble(op2, fpRegT1); … … 989 1044 unsigned op2 = currentInstruction[3].u.operand; 990 1045 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 1046 1047 #if ENABLE(VALUE_PROFILER) 1048 m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset); 1049 #endif 991 1050 992 1051 JumpList notInt32Op1; … … 1031 1090 1032 1091 negZero.link(this); 1092 #if ENABLE(VALUE_PROFILER) 1093 // We only get here if we have a genuine negative zero. Record this, 1094 // so that the speculative JIT knows that we failed speculation 1095 // because of a negative zero. 1096 add32(Imm32(1), AbsoluteAddress(&m_codeBlock->specialFastCaseProfileForBytecodeOffset(m_bytecodeOffset)->m_counter)); 1097 #endif 1033 1098 overflow.link(this); 1034 1099 … … 1063 1128 unsigned op2 = currentInstruction[3].u.operand; 1064 1129 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 1130 1131 #if ENABLE(VALUE_PROFILER) 1132 m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset); 1133 #endif 1065 1134 1066 1135 if (!supportsFloatingPoint()) { -
trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp
r95901 r96238 59 59 { 60 60 int dst = instruction[1].u.operand; 61 emitValueProfilingSite(FirstProfilingSite); 61 62 emitStore(dst, regT1, regT0); 62 63 } -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r95901 r96238 617 617 JITStubCall stubCall(this, cti_op_resolve); 618 618 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 619 stubCall.call (currentInstruction[1].u.operand);619 stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite); 620 620 } 621 621 … … 659 659 JITStubCall stubCall(this, currentInstruction[3].u.operand ? cti_op_resolve_base_strict_put : cti_op_resolve_base); 660 660 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 661 stubCall.call (currentInstruction[1].u.operand);661 stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite); 662 662 } 663 663 … … 675 675 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 676 676 stubCall.addArgument(Imm32(currentInstruction[3].u.operand)); 677 stubCall.call (currentInstruction[1].u.operand);677 stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite); 678 678 } 679 679 … … 700 700 load32(BaseIndex(regT2, regT3, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0); // payload 701 701 load32(BaseIndex(regT2, regT3, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1); // tag 702 emitValueProfilingSite(FirstProfilingSite); 702 703 emitStore(dst, regT1, regT0); 703 704 map(m_bytecodeOffset + (dynamic ? OPCODE_LENGTH(op_resolve_global_dynamic) : OPCODE_LENGTH(op_resolve_global)), dst, regT1, regT0); … … 715 716 stubCall.addArgument(TrustedImmPtr(ident)); 716 717 stubCall.addArgument(Imm32(currentIndex)); 717 stubCall.call (dst);718 stubCall.callWithValueProfiling(dst, SubsequentProfilingSite); 718 719 } 719 720 … … 1113 1114 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand))); 1114 1115 stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); 1115 stubCall.call (currentInstruction[2].u.operand);1116 stubCall.callWithValueProfiling(currentInstruction[2].u.operand, FirstProfilingSite); 1116 1117 } 1117 1118 … … 1121 1122 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand))); 1122 1123 stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); 1123 stubCall.call (currentInstruction[2].u.operand);1124 stubCall.callWithValueProfiling(currentInstruction[2].u.operand, FirstProfilingSite); 1124 1125 } 1125 1126 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r95965 r96238 145 145 146 146 match.link(this); 147 emitValueProfilingSite(FirstProfilingSite); 147 148 emitStore(dst, regT1, regT0); 148 149 map(m_bytecodeOffset + OPCODE_LENGTH(op_method_check), dst, regT1, regT0); … … 217 218 addSlowCase(branch32(Equal, regT1, TrustedImm32(JSValue::EmptyValueTag))); 218 219 220 emitValueProfilingSite(FirstProfilingSite); 219 221 emitStore(dst, regT1, regT0); 220 222 map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_val), dst, regT1, regT0); … … 248 250 stubCall.addArgument(property); 249 251 stubCall.call(dst); 252 253 emitValueProfilingSite(SubsequentProfilingSite); 250 254 } 251 255 … … 311 315 emitJumpSlowCaseIfNotJSCell(base, regT1); 312 316 compileGetByIdHotPath(); 317 emitValueProfilingSite(FirstProfilingSite); 313 318 emitStore(dst, regT1, regT0); 314 319 map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_id), dst, regT1, regT0); … … 354 359 355 360 compileGetByIdSlowCase(dst, base, &(m_codeBlock->identifier(ident)), iter); 361 emitValueProfilingSite(SubsequentProfilingSite); 356 362 } 357 363 … … 1018 1024 1019 1025 emitLoad(index, regT1, regT0, regT2); 1026 emitValueProfilingSite(FirstProfilingSite); 1020 1027 emitStore(dst, regT1, regT0); 1021 1028 map(m_bytecodeOffset + OPCODE_LENGTH(op_get_scoped_var), dst, regT1, regT0); … … 1059 1066 1060 1067 emitLoad(index, regT1, regT0, regT2); 1068 emitValueProfilingSite(FirstProfilingSite); 1061 1069 emitStore(dst, regT1, regT0); 1062 1070 map(m_bytecodeOffset + OPCODE_LENGTH(op_get_global_var), dst, regT1, regT0); -
trunk/Source/JavaScriptCore/jit/JITStubCall.h
r95901 r96238 202 202 } 203 203 204 JIT::Call callWithValueProfiling(unsigned dst, JIT::ValueProfilingSiteKind) 205 { 206 return call(dst); 204 JIT::Call callWithValueProfiling(unsigned dst, JIT::ValueProfilingSiteKind kind) 205 { 206 ASSERT(m_returnType == Value || m_returnType == Cell); 207 JIT::Call call = this->call(); 208 m_jit->emitValueProfilingSite(kind); 209 if (m_returnType == Value) 210 m_jit->emitStore(dst, JIT::regT1, JIT::regT0); 211 else 212 m_jit->emitStoreCell(dst, JIT::returnValueRegister); 213 return call; 207 214 } 208 215 #else
Note: See TracChangeset
for help on using the changeset viewer.