Changeset 193985 in webkit
- Timestamp:
- Dec 11, 2015, 3:01:57 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r193983 r193985 1 2015-12-11 Mark Lam <mark.lam@apple.com> 2 3 Refactoring to reduce potential cut-paste errors with the FTL ICs. 4 https://bugs.webkit.org/show_bug.cgi?id=152185 5 6 Reviewed by Saam Barati. 7 8 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 9 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 10 * JavaScriptCore.xcodeproj/project.pbxproj: 11 12 * ftl/FTLCompile.cpp: 13 - ICs now have their own names. GetById and PutByID fast path ICs no longer just 14 say "inline cache fast path". 15 16 * ftl/FTLCompileBinaryOp.cpp: 17 (JSC::FTL::generateBinaryArithOpFastPath): 18 - Fixed an indentation. 19 20 * ftl/FTLInlineCacheDescriptor.h: 21 (JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor): 22 (JSC::FTL::InlineCacheDescriptor::name): 23 (JSC::FTL::GetByIdDescriptor::GetByIdDescriptor): 24 (JSC::FTL::PutByIdDescriptor::PutByIdDescriptor): 25 (JSC::FTL::CheckInDescriptor::CheckInDescriptor): 26 (JSC::FTL::BinaryOpDescriptor::nodeType): 27 (JSC::FTL::BinaryOpDescriptor::size): 28 (JSC::FTL::BinaryOpDescriptor::slowPathFunction): 29 (JSC::FTL::BinaryOpDescriptor::leftOperand): 30 (JSC::FTL::BinaryOpDescriptor::BinaryOpDescriptor): 31 (JSC::FTL::ArithDivDescriptor::ArithDivDescriptor): 32 (JSC::FTL::ArithDivDescriptor::icSize): 33 (JSC::FTL::ArithDivDescriptor::nodeType): 34 (JSC::FTL::ArithDivDescriptor::opName): 35 (JSC::FTL::ArithDivDescriptor::slowPathFunction): 36 (JSC::FTL::ArithDivDescriptor::nonNumberSlowPathFunction): 37 (JSC::FTL::ArithMulDescriptor::ArithMulDescriptor): 38 (JSC::FTL::ArithMulDescriptor::icSize): 39 (JSC::FTL::ArithMulDescriptor::nodeType): 40 (JSC::FTL::ArithMulDescriptor::opName): 41 (JSC::FTL::ArithMulDescriptor::slowPathFunction): 42 (JSC::FTL::ArithMulDescriptor::nonNumberSlowPathFunction): 43 (JSC::FTL::ArithSubDescriptor::ArithSubDescriptor): 44 (JSC::FTL::ArithSubDescriptor::icSize): 45 (JSC::FTL::ArithSubDescriptor::nodeType): 46 (JSC::FTL::ArithSubDescriptor::opName): 47 (JSC::FTL::ArithSubDescriptor::slowPathFunction): 48 (JSC::FTL::ArithSubDescriptor::nonNumberSlowPathFunction): 49 (JSC::FTL::ValueAddDescriptor::ValueAddDescriptor): 50 (JSC::FTL::ValueAddDescriptor::icSize): 51 (JSC::FTL::ValueAddDescriptor::nodeType): 52 (JSC::FTL::ValueAddDescriptor::opName): 53 (JSC::FTL::ValueAddDescriptor::slowPathFunction): 54 (JSC::FTL::ValueAddDescriptor::nonNumberSlowPathFunction): 55 (JSC::FTL::LazySlowPathDescriptor::LazySlowPathDescriptor): 56 (JSC::FTL::ProbeDescriptor::ProbeDescriptor): 57 (JSC::FTL::BinaryOpDescriptor::name): Deleted. 58 (JSC::FTL::BinaryOpDescriptor::fastPathICName): Deleted. 59 * ftl/FTLInlineCacheDescriptorInlines.h: Removed. 60 - Consolidate the number of places where we have to fill in a data about new 61 snippet ICs. It is all done in FTLInlineCacheDescriptor.h now. 62 63 * ftl/FTLJITFinalizer.cpp: 64 (JSC::FTL::JITFinalizer::finalizeFunction): 65 66 * ftl/FTLLowerDFGToLLVM.cpp: 67 (JSC::FTL::DFG::LowerDFGToLLVM::compileUntypedBinaryOp): 68 (JSC::FTL::DFG::LowerDFGToLLVM::compileValueAdd): 69 (JSC::FTL::DFG::LowerDFGToLLVM::compileArithAddOrSub): 70 (JSC::FTL::DFG::LowerDFGToLLVM::compileArithMul): 71 (JSC::FTL::DFG::LowerDFGToLLVM::compileArithDiv): 72 - Introduced a compileUntypedBinaryOp() template and use that at all the FTL 73 places that need to use a snippet. This reduces the amount of cut and paste 74 code. 75 76 * ftl/FTLState.h: 77 - Removed a bad #include. 78 1 79 2015-12-11 Keith Miller <keith_miller@apple.com> 2 80 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r193788 r193985 1320 1320 <ClInclude Include="..\ftl\FTLGeneratedFunction.h" /> 1321 1321 <ClInclude Include="..\ftl\FTLInlineCacheDescriptor.h" /> 1322 <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h" />1323 1322 <ClInclude Include="..\ftl\FTLInlineCacheSize.h" /> 1324 1323 <ClInclude Include="..\ftl\FTLIntrinsicRepository.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r193788 r193985 4253 4253 <Filter>ftl</Filter> 4254 4254 </ClInclude> 4255 <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h">4256 <Filter>ftl</Filter>4257 </ClInclude>4258 4255 <ClInclude Include="..\ftl\FTLInlineCacheSize.h"> 4259 4256 <Filter>ftl</Filter> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r193938 r193985 2003 2003 FE187A0E1C030D640038BBCA /* JITDivGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */; }; 2004 2004 FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */; }; 2005 FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */; };2006 2005 FE187A191C0E13E30038BBCA /* FTLCompileBinaryOp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */; }; 2007 2006 FE187A1A1C0E13E60038BBCA /* FTLCompileBinaryOp.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */; }; … … 4191 4190 FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLCompileBinaryOp.cpp; path = ftl/FTLCompileBinaryOp.cpp; sourceTree = "<group>"; }; 4192 4191 FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLCompileBinaryOp.h; path = ftl/FTLCompileBinaryOp.h; sourceTree = "<group>"; }; 4193 FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLInlineCacheDescriptorInlines.h; path = ftl/FTLInlineCacheDescriptorInlines.h; sourceTree = "<group>"; };4194 4192 FE1C0FFC1B193E9800B53FCA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; }; 4195 4193 FE1C0FFE1B194FD100B53FCA /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; }; … … 4509 4507 A78A977C179738D5009DF744 /* FTLGeneratedFunction.h */, 4510 4508 0F25F1A7181635F300522F39 /* FTLInlineCacheDescriptor.h */, 4511 FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */,4512 4509 0F25F1A8181635F300522F39 /* FTLInlineCacheSize.cpp */, 4513 4510 0F25F1A9181635F300522F39 /* FTLInlineCacheSize.h */, … … 6984 6981 0F7C11AD1BC3862C00C74CDB /* CopyBarrier.h in Headers */, 6985 6982 0F5A52D017ADD717008ECB2D /* CopyToken.h in Headers */, 6986 FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */,6987 6983 C2239D1816262BDD005AC5FD /* CopyVisitor.h in Headers */, 6988 6984 C2239D1916262BDD005AC5FD /* CopyVisitorInlines.h in Headers */, -
trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp
r193485 r193985 41 41 #include "FTLExceptionHandlerManager.h" 42 42 #include "FTLExitThunkGenerator.h" 43 #include "FTLInlineCacheDescriptor Inlines.h"43 #include "FTLInlineCacheDescriptor.h" 44 44 #include "FTLInlineCacheSize.h" 45 45 #include "FTLJITCode.h" … … 216 216 void generateICFastPath( 217 217 State& state, CodeBlock* codeBlock, GeneratedFunction generatedFunction, 218 StackMaps::RecordMap& recordMap, DescriptorType& ic, size_t sizeOfIC )218 StackMaps::RecordMap& recordMap, DescriptorType& ic, size_t sizeOfIC, const char* icName) 219 219 { 220 220 VM& vm = state.graph.m_vm; … … 240 240 bitwise_cast<char*>(generatedFunction) + record.instructionOffset; 241 241 242 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "inline cache fast path", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {242 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, icName, [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 243 243 state.finalizer->sideCodeLinkBuffer->link(ic.m_slowPathDone[i], 244 244 CodeLocationLabel(startOfIC + sizeOfIC)); … … 305 305 }; 306 306 307 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "CheckIn inline cache", postLink);307 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "CheckIn", postLink); 308 308 } 309 309 } … … 340 340 341 341 char* startOfIC = bitwise_cast<char*>(generatedFunction) + record.instructionOffset; 342 const char* fastPathICName = ic.fastPathICName(); 343 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, fastPathICName, [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 342 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, ic.name(), [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 344 343 linkBuffer.link(done, CodeLocationLabel(startOfIC + sizeOfIC)); 345 344 state.finalizer->sideCodeLinkBuffer->link(ic.m_slowPathDone[i], CodeLocationLabel(startOfIC + sizeOfIC)); … … 878 877 generateICFastPath( 879 878 state, codeBlock, generatedFunction, recordMap, state.getByIds[i], 880 sizeOfGetById() );879 sizeOfGetById(), "GetById"); 881 880 } 882 881 for (unsigned i = state.putByIds.size(); i--;) { 883 882 generateICFastPath( 884 883 state, codeBlock, generatedFunction, recordMap, state.putByIds[i], 885 sizeOfPutById() );884 sizeOfPutById(), "PutById"); 886 885 } 887 886 for (unsigned i = state.checkIns.size(); i--;) { … … 922 921 char* startOfIC = bitwise_cast<char*>(generatedFunction) + call.m_instructionOffset; 923 922 924 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfCall(), "JSCall inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {923 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfCall(), "JSCall", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 925 924 call.link(vm, linkBuffer); 926 925 }); … … 938 937 size_t sizeOfIC = sizeOfICFor(call.node()); 939 938 940 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "varargs call inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {939 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "varargs call", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 941 940 call.link(vm, linkBuffer, state.finalizer->handleExceptionsLinkBuffer->entrypoint()); 942 941 }); … … 954 953 size_t sizeOfIC = call.estimatedSize(); 955 954 956 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "tail call inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {955 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "tail call", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 957 956 call.link(vm, linkBuffer); 958 957 }); -
trunk/Source/JavaScriptCore/ftl/FTLCompileBinaryOp.cpp
r193781 r193985 180 180 181 181 auto numberOfBytesUsedToPreserveReusedRegisters = 182 allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);182 allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace); 183 183 184 184 context.initializeRegisters(jit); -
trunk/Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h
r193781 r193985 31 31 #include "CodeOrigin.h" 32 32 #include "DFGAbstractValue.h" 33 #include "DFGOperations.h" 34 #include "FTLInlineCacheSize.h" 33 35 #include "FTLLazySlowPath.h" 34 36 #include "JITInlineCacheGenerator.h" … … 133 135 size_t size() const { return m_size; } 134 136 const char* name() const { return m_name; } 135 const char* fastPathICName() const { return m_fastPathICName; }136 137 SlowPathFunction slowPathFunction() const { return m_slowPathFunction; } 137 138 … … 143 144 protected: 144 145 BinaryOpDescriptor(unsigned nodeType, unsigned stackmapID, CodeOrigin codeOrigin, 145 size_t size, const char* name, const char* fastPathICName,146 SlowPathFunction slowPathFunction,const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)146 size_t size, const char* name, SlowPathFunction slowPathFunction, 147 const SnippetOperand& leftOperand, const SnippetOperand& rightOperand) 147 148 : InlineCacheDescriptor(stackmapID, codeOrigin, nullptr) 148 149 , m_nodeType(nodeType) 149 150 , m_size(size) 150 151 , m_name(name) 151 , m_fastPathICName(fastPathICName)152 152 , m_slowPathFunction(slowPathFunction) 153 153 , m_leftOperand(leftOperand) … … 159 159 size_t m_size; 160 160 const char* m_name; 161 const char* m_fastPathICName;162 161 SlowPathFunction m_slowPathFunction; 163 162 … … 168 167 class ArithDivDescriptor : public BinaryOpDescriptor { 169 168 public: 170 ArithDivDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand); 171 static size_t icSize(); 169 ArithDivDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand) 170 : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand) 171 { } 172 173 static size_t icSize() { return sizeOfArithDiv(); } 174 static unsigned nodeType() { return DFG::ArithDiv; } 175 static const char* opName() { return "ArithDiv"; } 176 static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueDiv; } 177 static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); } 172 178 }; 173 179 174 180 class ArithMulDescriptor : public BinaryOpDescriptor { 175 181 public: 176 ArithMulDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand); 177 static size_t icSize(); 182 ArithMulDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand) 183 : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand) 184 { } 185 186 static size_t icSize() { return sizeOfArithMul(); } 187 static unsigned nodeType() { return DFG::ArithMul; } 188 static const char* opName() { return "ArithMul"; } 189 static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueMul; } 190 static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); } 178 191 }; 179 192 180 193 class ArithSubDescriptor : public BinaryOpDescriptor { 181 194 public: 182 ArithSubDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand); 183 static size_t icSize(); 195 ArithSubDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand) 196 : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand) 197 { } 198 199 static size_t icSize() { return sizeOfArithSub(); } 200 static unsigned nodeType() { return DFG::ArithSub; } 201 static const char* opName() { return "ArithSub"; } 202 static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueSub; } 203 static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); } 184 204 }; 185 205 186 206 class ValueAddDescriptor : public BinaryOpDescriptor { 187 207 public: 188 ValueAddDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand); 189 static size_t icSize(); 208 ValueAddDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand) 209 : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand) 210 { } 211 212 static size_t icSize() { return sizeOfValueAdd(); } 213 static unsigned nodeType() { return DFG::ValueAdd; } 214 static const char* opName() { return "ValueAdd"; } 215 static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueAdd; } 216 static J_JITOperation_EJJ nonNumberSlowPathFunction() { return DFG::operationValueAddNotNumber; } 190 217 }; 191 218 -
trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp
r193362 r193985 138 138 jitCode->addHandle(FINALIZE_CODE_IF( 139 139 dumpDisassembly, *outOfLineCodeInfos[i].m_linkBuffer, 140 ("FTL out of line code for %s ", outOfLineCodeInfos[i].m_codeDescription)).executableMemory());140 ("FTL out of line code for %s inline cache", outOfLineCodeInfos[i].m_codeDescription)).executableMemory()); 141 141 } 142 142 #endif // FTL_USES_B3 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r193974 r193985 1039 1039 } 1040 1040 1041 enum ConstInt32OperandOptimizationSupport { 1042 HasConstInt32OperandOptimization, 1043 DoesNotHaveConstInt32OperandOptimization, 1044 }; 1045 1046 enum ConstDoubleOperandOptimizationSupport { 1047 HasConstDoubleOperandOptimization, 1048 DoesNotHaveConstDoubleOperandOptimization, 1049 }; 1050 1051 template <typename SnippetICDescriptor, 1052 ConstInt32OperandOptimizationSupport constInt32Opt = HasConstInt32OperandOptimization, 1053 ConstDoubleOperandOptimizationSupport constDoubleOpt = DoesNotHaveConstDoubleOperandOptimization> 1054 void compileUntypedBinaryOp() 1055 { 1056 Edge& leftChild = m_node->child1(); 1057 Edge& rightChild = m_node->child2(); 1058 1059 if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) { 1060 setJSValue(vmCall(m_out.int64, m_out.operation(SnippetICDescriptor::nonNumberSlowPathFunction()), m_callFrame, 1061 lowJSValue(leftChild), lowJSValue(rightChild))); 1062 return; 1063 } 1064 1065 unsigned stackmapID = m_stackmapIDs++; 1066 1067 if (Options::verboseCompilation()) 1068 dataLog(" Emitting ", SnippetICDescriptor::opName(), " patchpoint with stackmap #", stackmapID, "\n"); 1069 1070 #if FTL_USES_B3 1071 CRASH(); 1072 #else 1073 LValue left = lowJSValue(leftChild); 1074 LValue right = lowJSValue(rightChild); 1075 1076 SnippetOperand leftOperand(abstractValue(leftChild).resultType()); 1077 SnippetOperand rightOperand(abstractValue(rightChild).resultType()); 1078 1079 if (constInt32Opt == HasConstInt32OperandOptimization && leftChild->isInt32Constant()) 1080 leftOperand.setConstInt32(leftChild->asInt32()); 1081 #if USE(JSVALUE64) 1082 else if (constDoubleOpt == HasConstDoubleOperandOptimization && leftChild->isDoubleConstant()) 1083 leftOperand.setConstDouble(leftChild->asNumber()); 1084 #endif 1085 1086 if (leftOperand.isConst()) { 1087 // Because the snippet does not support both operands being constant, if the left 1088 // operand is already a constant, we'll just pretend the right operand is not. 1089 } else if (constInt32Opt == HasConstInt32OperandOptimization && rightChild->isInt32Constant()) 1090 rightOperand.setConstInt32(rightChild->asInt32()); 1091 #if USE(JSVALUE64) 1092 else if (constDoubleOpt == HasConstDoubleOperandOptimization && rightChild->isDoubleConstant()) 1093 rightOperand.setConstDouble(rightChild->asNumber()); 1094 #endif 1095 1096 RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst()); 1097 1098 // Arguments: id, bytes, target, numArgs, args... 1099 StackmapArgumentList arguments; 1100 arguments.append(m_out.constInt64(stackmapID)); 1101 arguments.append(m_out.constInt32(SnippetICDescriptor::icSize())); 1102 arguments.append(constNull(m_out.ref8)); 1103 arguments.append(m_out.constInt32(2)); 1104 arguments.append(left); 1105 arguments.append(right); 1106 1107 appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments, 1108 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations. 1109 1110 LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments); 1111 setInstructionCallingConvention(call, LLVMAnyRegCallConv); 1112 1113 m_ftlState.binaryOps.append(SnippetICDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand)); 1114 1115 setJSValue(call); 1116 #endif 1117 } 1118 1041 1119 void compileUpsilon() 1042 1120 { … … 1513 1591 void compileValueAdd() 1514 1592 { 1515 Edge& leftChild = m_node->child1(); 1516 Edge& rightChild = m_node->child2(); 1517 1518 if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) { 1519 setJSValue(vmCall(m_out.int64, m_out.operation(operationValueAddNotNumber), m_callFrame, 1520 lowJSValue(leftChild), lowJSValue(rightChild))); 1521 return; 1522 } 1523 1524 unsigned stackmapID = m_stackmapIDs++; 1525 1526 if (Options::verboseCompilation()) 1527 dataLog(" Emitting ValueAdd patchpoint with stackmap #", stackmapID, "\n"); 1528 1529 #if FTL_USES_B3 1530 CRASH(); 1531 #else 1532 LValue left = lowJSValue(leftChild); 1533 LValue right = lowJSValue(rightChild); 1534 1535 SnippetOperand leftOperand(abstractValue(leftChild).resultType()); 1536 SnippetOperand rightOperand(abstractValue(rightChild).resultType()); 1537 1538 // Because the snippet does not support both operands being constant, if the left 1539 // operand is already a constant, we'll just pretend the right operand is not. 1540 if (leftChild->isInt32Constant()) 1541 leftOperand.setConstInt32(leftChild->asInt32()); 1542 else if (rightChild->isInt32Constant()) 1543 rightOperand.setConstInt32(rightChild->asInt32()); 1544 1545 // Arguments: id, bytes, target, numArgs, args... 1546 StackmapArgumentList arguments; 1547 arguments.append(m_out.constInt64(stackmapID)); 1548 arguments.append(m_out.constInt32(ValueAddDescriptor::icSize())); 1549 arguments.append(constNull(m_out.ref8)); 1550 arguments.append(m_out.constInt32(2)); 1551 arguments.append(left); 1552 arguments.append(right); 1553 1554 appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments, 1555 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations. 1556 1557 LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments); 1558 setInstructionCallingConvention(call, LLVMAnyRegCallConv); 1559 1560 m_ftlState.binaryOps.append(ValueAddDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand)); 1561 1562 setJSValue(call); 1563 #endif 1593 compileUntypedBinaryOp<ValueAddDescriptor>(); 1564 1594 } 1565 1595 … … 1710 1740 } 1711 1741 1712 unsigned stackmapID = m_stackmapIDs++; 1713 1714 if (Options::verboseCompilation()) 1715 dataLog(" Emitting ArithSub patchpoint with stackmap #", stackmapID, "\n"); 1716 1717 #if FTL_USES_B3 1718 CRASH(); 1719 #else 1720 LValue left = lowJSValue(m_node->child1()); 1721 LValue right = lowJSValue(m_node->child2()); 1722 1723 // Arguments: id, bytes, target, numArgs, args... 1724 StackmapArgumentList arguments; 1725 arguments.append(m_out.constInt64(stackmapID)); 1726 arguments.append(m_out.constInt32(ArithSubDescriptor::icSize())); 1727 arguments.append(constNull(m_out.ref8)); 1728 arguments.append(m_out.constInt32(2)); 1729 arguments.append(left); 1730 arguments.append(right); 1731 1732 appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments, 1733 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations. 1734 1735 LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments); 1736 setInstructionCallingConvention(call, LLVMAnyRegCallConv); 1737 1738 SnippetOperand leftOperand(abstractValue(m_node->child1()).resultType()); 1739 SnippetOperand rightOperand(abstractValue(m_node->child2()).resultType()); 1740 m_ftlState.binaryOps.append(ArithSubDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand)); 1741 1742 setJSValue(call); 1743 #endif 1742 compileUntypedBinaryOp<ArithSubDescriptor, DoesNotHaveConstInt32OperandOptimization, DoesNotHaveConstDoubleOperandOptimization>(); 1744 1743 break; 1745 1744 } … … 1837 1836 1838 1837 case UntypedUse: { 1839 Edge& leftChild = m_node->child1(); 1840 Edge& rightChild = m_node->child2(); 1841 1842 if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) { 1843 setJSValue(vmCall(m_out.int64, m_out.operation(operationValueMul), m_callFrame, 1844 lowJSValue(leftChild), lowJSValue(rightChild))); 1845 return; 1846 } 1847 1848 unsigned stackmapID = m_stackmapIDs++; 1849 1850 if (Options::verboseCompilation()) 1851 dataLog(" Emitting ArithMul patchpoint with stackmap #", stackmapID, "\n"); 1852 1853 #if FTL_USES_B3 1854 CRASH(); 1855 #else 1856 LValue left = lowJSValue(leftChild); 1857 LValue right = lowJSValue(rightChild); 1858 1859 SnippetOperand leftOperand(abstractValue(leftChild).resultType()); 1860 SnippetOperand rightOperand(abstractValue(rightChild).resultType()); 1861 1862 // Because the snippet does not support both operands being constant, if the left 1863 // operand is already a constant, we'll just pretend the right operand is not. 1864 if (leftChild->isInt32Constant()) 1865 leftOperand.setConstInt32(leftChild->asInt32()); 1866 else if (rightChild->isInt32Constant()) 1867 rightOperand.setConstInt32(rightChild->asInt32()); 1868 1869 RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst()); 1870 1871 // Arguments: id, bytes, target, numArgs, args... 1872 StackmapArgumentList arguments; 1873 arguments.append(m_out.constInt64(stackmapID)); 1874 arguments.append(m_out.constInt32(ArithMulDescriptor::icSize())); 1875 arguments.append(constNull(m_out.ref8)); 1876 arguments.append(m_out.constInt32(2)); 1877 arguments.append(left); 1878 arguments.append(right); 1879 1880 appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments, 1881 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations. 1882 1883 LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments); 1884 setInstructionCallingConvention(call, LLVMAnyRegCallConv); 1885 1886 m_ftlState.binaryOps.append(ArithMulDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand)); 1887 1888 setJSValue(call); 1889 #endif 1838 compileUntypedBinaryOp<ArithMulDescriptor>(); 1890 1839 break; 1891 1840 } … … 1956 1905 1957 1906 case UntypedUse: { 1958 Edge& leftChild = m_node->child1(); 1959 Edge& rightChild = m_node->child2(); 1960 1961 if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) { 1962 setJSValue(vmCall(m_out.int64, m_out.operation(operationValueDiv), m_callFrame, 1963 lowJSValue(leftChild), lowJSValue(rightChild))); 1964 return; 1965 } 1966 1967 unsigned stackmapID = m_stackmapIDs++; 1968 1969 if (Options::verboseCompilation()) 1970 dataLog(" Emitting ArithDiv patchpoint with stackmap #", stackmapID, "\n"); 1971 1972 #if FTL_USES_B3 1973 CRASH(); 1974 #else 1975 LValue left = lowJSValue(leftChild); 1976 LValue right = lowJSValue(rightChild); 1977 1978 SnippetOperand leftOperand(abstractValue(leftChild).resultType()); 1979 SnippetOperand rightOperand(abstractValue(rightChild).resultType()); 1980 1981 if (leftChild->isInt32Constant()) 1982 leftOperand.setConstInt32(leftChild->asInt32()); 1983 #if USE(JSVALUE64) 1984 else if (leftChild->isDoubleConstant()) 1985 leftOperand.setConstDouble(leftChild->asNumber()); 1986 #endif 1987 1988 if (leftOperand.isConst()) { 1989 // The snippet generator only supports 1 argument as a constant. 1990 // Ignore the rightChild's const-ness. 1991 } else if (rightChild->isInt32Constant()) 1992 rightOperand.setConstInt32(rightChild->asInt32()); 1993 #if USE(JSVALUE64) 1994 else if (rightChild->isDoubleConstant()) 1995 rightOperand.setConstDouble(rightChild->asNumber()); 1996 #endif 1997 1998 RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst()); 1999 2000 // Arguments: id, bytes, target, numArgs, args... 2001 StackmapArgumentList arguments; 2002 arguments.append(m_out.constInt64(stackmapID)); 2003 arguments.append(m_out.constInt32(ArithDivDescriptor::icSize())); 2004 arguments.append(constNull(m_out.ref8)); 2005 arguments.append(m_out.constInt32(2)); 2006 arguments.append(left); 2007 arguments.append(right); 2008 2009 appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments, 2010 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations. 2011 2012 LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments); 2013 setInstructionCallingConvention(call, LLVMAnyRegCallConv); 2014 2015 m_ftlState.binaryOps.append(ArithDivDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand)); 2016 2017 setJSValue(call); 2018 #endif // FTL_USES_B3 1907 compileUntypedBinaryOp<ArithDivDescriptor, HasConstInt32OperandOptimization, HasConstDoubleOperandOptimization>(); 2019 1908 break; 2020 1909 } -
trunk/Source/JavaScriptCore/ftl/FTLState.h
r193640 r193985 41 41 #include "FTLJSTailCall.h" 42 42 #include "FTLStackMaps.h" 43 #include "FTLState.h"44 43 #include <wtf/Noncopyable.h> 45 44
Note:
See TracChangeset
for help on using the changeset viewer.