Changeset 197760 in webkit
- Timestamp:
- Mar 8, 2016, 5:57:58 AM (9 years ago)
- Location:
- releases/WebKitGTK/webkit-2.12
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog
r197755 r197760 1 2016-03-03 Filip Pizlo <fpizlo@apple.com> 2 3 DFG should be able to compile StringReplace 4 https://bugs.webkit.org/show_bug.cgi?id=154979 5 6 Reviewed by Benjamin Poulain. 7 8 Add a microbenchmark for a case of StringReplace that we hadn't covered with a microbenchmark 9 yet: using something absurd for the replace value. This is interesting for implementing the 10 32_64 version of StringReplace, which gets really weird in the absurd case because of how it 11 consumes the entire register file while making the call on x86-32. 12 13 * js/regress/script-tests/string-replace-generic.js: Added. 14 * js/regress/string-replace-generic-expected.txt: Added. 15 * js/regress/string-replace-generic.html: Added. 16 1 17 2016-03-02 Zalan Bujtas <zalan@apple.com> 2 18 -
releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/ChangeLog
r197758 r197760 1 2016-03-03 Filip Pizlo <fpizlo@apple.com> 2 3 DFG should be able to compile StringReplace 4 https://bugs.webkit.org/show_bug.cgi?id=154979 5 6 Reviewed by Benjamin Poulain. 7 8 Adds support for StringReplace to the DFG tier. This is a 3% speed-up on Octane/regexp. 9 10 * dfg/DFGByteCodeParser.cpp: 11 (JSC::DFG::ByteCodeParser::handleIntrinsicCall): 12 * dfg/DFGSpeculativeJIT.cpp: 13 (JSC::DFG::SpeculativeJIT::speculateFinalObject): 14 (JSC::DFG::SpeculativeJIT::speculateRegExpObject): 15 (JSC::DFG::SpeculativeJIT::speculateObjectOrOther): 16 * dfg/DFGSpeculativeJIT.h: 17 (JSC::DFG::SpeculativeJIT::callOperation): 18 * dfg/DFGSpeculativeJIT32_64.cpp: 19 (JSC::DFG::SpeculativeJIT::compile): 20 * dfg/DFGSpeculativeJIT64.cpp: 21 (JSC::DFG::SpeculativeJIT::compile): 22 * jit/JITOperations.h: 23 1 24 2016-03-02 Filip Pizlo <fpizlo@apple.com> 2 25 -
releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r197679 r197760 2191 2191 2192 2192 case StringPrototypeReplaceIntrinsic: { 2193 if (!isFTL(m_graph.m_plan.mode)) {2194 // This is a marginally profitable intrinsic. We've only the work to make it an2195 // intrinsic on the fourth tier.2196 return false;2197 }2198 2199 2193 if (argumentCountIncludingThis != 3) 2200 2194 return false; -
releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r197679 r197760 6624 6624 } 6625 6625 6626 void SpeculativeJIT::speculateRegExpObject(Edge edge, GPRReg cell) 6627 { 6628 speculateCellType(edge, cell, SpecRegExpObject, RegExpObjectType); 6629 } 6630 6626 6631 void SpeculativeJIT::speculateRegExpObject(Edge edge) 6627 6632 { … … 6630 6635 6631 6636 SpeculateCellOperand operand(this, edge); 6632 speculate CellType(edge, operand.gpr(), SpecRegExpObject, RegExpObjectType);6637 speculateRegExpObject(edge, operand.gpr()); 6633 6638 } 6634 6639 -
releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r197679 r197760 1273 1273 return appendCallSetResult(operation, result); 1274 1274 } 1275 JITCompiler::Call callOperation(J_JITOperation_EJssReo operation, GPRReg result, GPRReg arg1, GPRReg arg2) 1276 { 1277 m_jit.setupArgumentsWithExecState(arg1, arg2); 1278 return appendCallSetResult(operation, result); 1279 } 1280 JITCompiler::Call callOperation(J_JITOperation_EJssReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3) 1281 { 1282 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3); 1283 return appendCallSetResult(operation, result); 1284 } 1275 1285 JITCompiler::Call callOperation(J_JITOperation_EJssZ operation, GPRReg result, GPRReg arg1, GPRReg arg2) 1276 1286 { … … 1436 1446 return appendCallSetResult(operation, result); 1437 1447 } 1438 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, MacroAssembler::TrustedImm32imm)1439 { 1440 m_jit.setupArgumentsWithExecState(arg1, MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm .m_value))));1441 return appendCallSetResult(operation, result); 1442 } 1443 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, MacroAssembler::TrustedImm32imm, GPRReg arg2)1444 { 1445 m_jit.setupArgumentsWithExecState(MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm .m_value))), arg2);1448 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, int32_t imm) 1449 { 1450 m_jit.setupArgumentsWithExecState(arg1, MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm)))); 1451 return appendCallSetResult(operation, result); 1452 } 1453 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, int32_t imm, GPRReg arg2) 1454 { 1455 m_jit.setupArgumentsWithExecState(MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm))), arg2); 1446 1456 return appendCallSetResult(operation, result); 1447 1457 } … … 1449 1459 { 1450 1460 return callOperation(operation, result.payloadGPR(), arg1.payloadGPR(), arg2.payloadGPR()); 1461 } 1462 JITCompiler::Call callOperation(J_JITOperation_EJJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3) 1463 { 1464 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3); 1465 return appendCallSetResult(operation, result); 1451 1466 } 1452 1467 JITCompiler::Call callOperation(J_JITOperation_ECC operation, GPRReg result, GPRReg arg1, GPRReg arg2) … … 1635 1650 return appendCallSetResult(operation, resultPayload, resultTag); 1636 1651 } 1652 JITCompiler::Call callOperation(J_JITOperation_EJssReo operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2) 1653 { 1654 m_jit.setupArgumentsWithExecState(arg1, arg2); 1655 return appendCallSetResult(operation, resultPayload, resultTag); 1656 } 1657 JITCompiler::Call callOperation(J_JITOperation_EJssReoJss operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2, GPRReg arg3) 1658 { 1659 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3); 1660 return appendCallSetResult(operation, resultPayload, resultTag); 1661 } 1637 1662 JITCompiler::Call callOperation(J_JITOperation_EPS operation, GPRReg resultTag, GPRReg resultPayload, void* pointer, size_t size) 1638 1663 { … … 1791 1816 { 1792 1817 return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1.tagGPR(), arg1.payloadGPR(), arg2.tagGPR(), arg2.payloadGPR()); 1818 } 1819 JITCompiler::Call callOperation(J_JITOperation_EJJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload) 1820 { 1821 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag, arg3Payload, arg3Tag); 1822 return appendCallSetResult(operation, resultPayload, resultTag); 1793 1823 } 1794 1824 … … 2471 2501 void speculateFunction(Edge); 2472 2502 void speculateFinalObject(Edge); 2503 void speculateRegExpObject(Edge, GPRReg cell); 2473 2504 void speculateRegExpObject(Edge); 2474 2505 void speculateObjectOrOther(Edge); -
releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r197758 r197760 2903 2903 break; 2904 2904 } 2905 2906 case StringReplace: { 2907 if (node->child1().useKind() == StringUse 2908 && node->child2().useKind() == RegExpObjectUse 2909 && node->child3().useKind() == StringUse) { 2910 if (JSString* replace = node->child3()->dynamicCastConstant<JSString*>()) { 2911 if (!replace->length()) { 2912 SpeculateCellOperand string(this, node->child1()); 2913 SpeculateCellOperand regExp(this, node->child2()); 2914 GPRReg stringGPR = string.gpr(); 2915 GPRReg regExpGPR = regExp.gpr(); 2916 speculateString(node->child1(), stringGPR); 2917 speculateRegExpObject(node->child2(), regExpGPR); 2918 2919 flushRegisters(); 2920 GPRFlushedCallResult2 resultTag(this); 2921 GPRFlushedCallResult resultPayload(this); 2922 callOperation( 2923 operationStringProtoFuncReplaceRegExpEmptyStr, resultTag.gpr(), 2924 resultPayload.gpr(), stringGPR, regExpGPR); 2925 m_jit.exceptionCheck(); 2926 cellResult(resultPayload.gpr(), node); 2927 break; 2928 } 2929 } 2930 2931 SpeculateCellOperand string(this, node->child1()); 2932 SpeculateCellOperand regExp(this, node->child2()); 2933 SpeculateCellOperand replace(this, node->child3()); 2934 GPRReg stringGPR = string.gpr(); 2935 GPRReg regExpGPR = regExp.gpr(); 2936 GPRReg replaceGPR = replace.gpr(); 2937 speculateString(node->child1(), stringGPR); 2938 speculateRegExpObject(node->child2(), regExpGPR); 2939 speculateString(node->child3(), replaceGPR); 2940 2941 flushRegisters(); 2942 GPRFlushedCallResult2 resultTag(this); 2943 GPRFlushedCallResult resultPayload(this); 2944 callOperation( 2945 operationStringProtoFuncReplaceRegExpString, resultTag.gpr(), resultPayload.gpr(), 2946 stringGPR, regExpGPR, replaceGPR); 2947 m_jit.exceptionCheck(); 2948 cellResult(resultPayload.gpr(), node); 2949 break; 2950 } 2951 2952 JSValueOperand string(this, node->child1()); 2953 JSValueOperand regExp(this, node->child2()); 2954 JSValueOperand replace(this, node->child3()); 2955 GPRReg stringTagGPR = string.tagGPR(); 2956 GPRReg stringPayloadGPR = string.payloadGPR(); 2957 GPRReg regExpTagGPR = regExp.tagGPR(); 2958 GPRReg regExpPayloadGPR = regExp.payloadGPR(); 2959 GPRReg replaceTagGPR = replace.tagGPR(); 2960 GPRReg replacePayloadGPR = replace.payloadGPR(); 2961 2962 flushRegisters(); 2963 GPRFlushedCallResult2 resultTag(this); 2964 GPRFlushedCallResult resultPayload(this); 2965 callOperation( 2966 operationStringProtoFuncReplaceGeneric, resultTag.gpr(), resultPayload.gpr(), 2967 stringTagGPR, stringPayloadGPR, regExpTagGPR, regExpPayloadGPR, replaceTagGPR, 2968 replacePayloadGPR); 2969 m_jit.exceptionCheck(); 2970 cellResult(resultPayload.gpr(), node); 2971 break; 2972 } 2905 2973 2906 2974 case ArrayPush: { … … 4863 4931 case GetStack: 4864 4932 case GetMyArgumentByVal: 4865 case StringReplace:4866 4933 DFG_CRASH(m_jit.graph(), node, "unexpected node in DFG backend"); 4867 4934 break; -
releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r197758 r197760 45 45 #include "SetupVarargsFrame.h" 46 46 #include "SpillRegistersMode.h" 47 #include "StringPrototype.h" 47 48 #include "TypeProfilerLog.h" 48 49 #include "Watchdog.h" … … 3024 3025 m_jit.or32(TrustedImm32(ValueFalse), result.gpr()); 3025 3026 jsValueResult(result.gpr(), node, DataFormatJSBoolean); 3027 break; 3028 } 3029 3030 case StringReplace: { 3031 if (node->child1().useKind() == StringUse 3032 && node->child2().useKind() == RegExpObjectUse 3033 && node->child3().useKind() == StringUse) { 3034 if (JSString* replace = node->child3()->dynamicCastConstant<JSString*>()) { 3035 if (!replace->length()) { 3036 SpeculateCellOperand string(this, node->child1()); 3037 SpeculateCellOperand regExp(this, node->child2()); 3038 GPRReg stringGPR = string.gpr(); 3039 GPRReg regExpGPR = regExp.gpr(); 3040 speculateString(node->child1(), stringGPR); 3041 speculateRegExpObject(node->child2(), regExpGPR); 3042 3043 flushRegisters(); 3044 GPRFlushedCallResult result(this); 3045 callOperation( 3046 operationStringProtoFuncReplaceRegExpEmptyStr, result.gpr(), stringGPR, 3047 regExpGPR); 3048 m_jit.exceptionCheck(); 3049 cellResult(result.gpr(), node); 3050 break; 3051 } 3052 } 3053 3054 SpeculateCellOperand string(this, node->child1()); 3055 SpeculateCellOperand regExp(this, node->child2()); 3056 SpeculateCellOperand replace(this, node->child3()); 3057 GPRReg stringGPR = string.gpr(); 3058 GPRReg regExpGPR = regExp.gpr(); 3059 GPRReg replaceGPR = replace.gpr(); 3060 speculateString(node->child1(), stringGPR); 3061 speculateRegExpObject(node->child2(), regExpGPR); 3062 speculateString(node->child3(), replaceGPR); 3063 3064 flushRegisters(); 3065 GPRFlushedCallResult result(this); 3066 callOperation( 3067 operationStringProtoFuncReplaceRegExpString, result.gpr(), stringGPR, regExpGPR, 3068 replaceGPR); 3069 m_jit.exceptionCheck(); 3070 cellResult(result.gpr(), node); 3071 break; 3072 } 3073 3074 JSValueOperand string(this, node->child1()); 3075 JSValueOperand regExp(this, node->child2()); 3076 JSValueOperand replace(this, node->child3()); 3077 GPRReg stringGPR = string.gpr(); 3078 GPRReg regExpGPR = regExp.gpr(); 3079 GPRReg replaceGPR = replace.gpr(); 3080 3081 flushRegisters(); 3082 GPRFlushedCallResult result(this); 3083 callOperation( 3084 operationStringProtoFuncReplaceGeneric, result.gpr(), stringGPR, regExpGPR, 3085 replaceGPR); 3086 m_jit.exceptionCheck(); 3087 cellResult(result.gpr(), node); 3026 3088 break; 3027 3089 } … … 4915 4977 case KillStack: 4916 4978 case GetStack: 4917 case StringReplace:4918 4979 DFG_CRASH(m_jit.graph(), node, "Unexpected node"); 4919 4980 break; -
releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/JITOperations.h
r197736 r197760 46 46 class JSLexicalEnvironment; 47 47 class JSScope; 48 class RegExpObject; 48 49 class Register; 49 50 class StructureStubInfo; … … 95 96 Q: int64_t 96 97 R: Register 98 Reo: RegExpObject* 97 99 S: size_t 98 100 Sprt: SlowPathReturnType … … 129 131 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJIdc)(ExecState*, EncodedJSValue, const Identifier*); 130 132 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue); 133 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue); 131 134 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJJAp)(ExecState*, EncodedJSValue, EncodedJSValue, ArrayProfile*); 132 135 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJJBy)(ExecState*, EncodedJSValue, EncodedJSValue, ByValInfo*); 136 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue); 133 137 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJssZ)(ExecState*, JSString*, int32_t); 138 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJssReo)(ExecState*, JSString*, RegExpObject*); 139 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJssReoJss)(ExecState*, JSString*, RegExpObject*, JSString*); 134 140 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJP)(ExecState*, EncodedJSValue, void*); 135 141 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EP)(ExecState*, void*);
Note:
See TracChangeset
for help on using the changeset viewer.