Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (193984 => 193985)
--- trunk/Source/_javascript_Core/ChangeLog 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-12-11 23:01:57 UTC (rev 193985)
@@ -1,3 +1,81 @@
+2015-12-11 Mark Lam <[email protected]>
+
+ Refactoring to reduce potential cut-paste errors with the FTL ICs.
+ https://bugs.webkit.org/show_bug.cgi?id=152185
+
+ Reviewed by Saam Barati.
+
+ * _javascript_Core.vcxproj/_javascript_Core.vcxproj:
+ * _javascript_Core.vcxproj/_javascript_Core.vcxproj.filters:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+
+ * ftl/FTLCompile.cpp:
+ - ICs now have their own names. GetById and PutByID fast path ICs no longer just
+ say "inline cache fast path".
+
+ * ftl/FTLCompileBinaryOp.cpp:
+ (JSC::FTL::generateBinaryArithOpFastPath):
+ - Fixed an indentation.
+
+ * ftl/FTLInlineCacheDescriptor.h:
+ (JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor):
+ (JSC::FTL::InlineCacheDescriptor::name):
+ (JSC::FTL::GetByIdDescriptor::GetByIdDescriptor):
+ (JSC::FTL::PutByIdDescriptor::PutByIdDescriptor):
+ (JSC::FTL::CheckInDescriptor::CheckInDescriptor):
+ (JSC::FTL::BinaryOpDescriptor::nodeType):
+ (JSC::FTL::BinaryOpDescriptor::size):
+ (JSC::FTL::BinaryOpDescriptor::slowPathFunction):
+ (JSC::FTL::BinaryOpDescriptor::leftOperand):
+ (JSC::FTL::BinaryOpDescriptor::BinaryOpDescriptor):
+ (JSC::FTL::ArithDivDescriptor::ArithDivDescriptor):
+ (JSC::FTL::ArithDivDescriptor::icSize):
+ (JSC::FTL::ArithDivDescriptor::nodeType):
+ (JSC::FTL::ArithDivDescriptor::opName):
+ (JSC::FTL::ArithDivDescriptor::slowPathFunction):
+ (JSC::FTL::ArithDivDescriptor::nonNumberSlowPathFunction):
+ (JSC::FTL::ArithMulDescriptor::ArithMulDescriptor):
+ (JSC::FTL::ArithMulDescriptor::icSize):
+ (JSC::FTL::ArithMulDescriptor::nodeType):
+ (JSC::FTL::ArithMulDescriptor::opName):
+ (JSC::FTL::ArithMulDescriptor::slowPathFunction):
+ (JSC::FTL::ArithMulDescriptor::nonNumberSlowPathFunction):
+ (JSC::FTL::ArithSubDescriptor::ArithSubDescriptor):
+ (JSC::FTL::ArithSubDescriptor::icSize):
+ (JSC::FTL::ArithSubDescriptor::nodeType):
+ (JSC::FTL::ArithSubDescriptor::opName):
+ (JSC::FTL::ArithSubDescriptor::slowPathFunction):
+ (JSC::FTL::ArithSubDescriptor::nonNumberSlowPathFunction):
+ (JSC::FTL::ValueAddDescriptor::ValueAddDescriptor):
+ (JSC::FTL::ValueAddDescriptor::icSize):
+ (JSC::FTL::ValueAddDescriptor::nodeType):
+ (JSC::FTL::ValueAddDescriptor::opName):
+ (JSC::FTL::ValueAddDescriptor::slowPathFunction):
+ (JSC::FTL::ValueAddDescriptor::nonNumberSlowPathFunction):
+ (JSC::FTL::LazySlowPathDescriptor::LazySlowPathDescriptor):
+ (JSC::FTL::ProbeDescriptor::ProbeDescriptor):
+ (JSC::FTL::BinaryOpDescriptor::name): Deleted.
+ (JSC::FTL::BinaryOpDescriptor::fastPathICName): Deleted.
+ * ftl/FTLInlineCacheDescriptorInlines.h: Removed.
+ - Consolidate the number of places where we have to fill in a data about new
+ snippet ICs. It is all done in FTLInlineCacheDescriptor.h now.
+
+ * ftl/FTLJITFinalizer.cpp:
+ (JSC::FTL::JITFinalizer::finalizeFunction):
+
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileUntypedBinaryOp):
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileValueAdd):
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileArithAddOrSub):
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileArithMul):
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileArithDiv):
+ - Introduced a compileUntypedBinaryOp() template and use that at all the FTL
+ places that need to use a snippet. This reduces the amount of cut and paste
+ code.
+
+ * ftl/FTLState.h:
+ - Removed a bad #include.
+
2015-12-11 Keith Miller <[email protected]>
Overrides has instance should not move ValueFalse to a register then immediately to the stack in the LLInt.
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj (193984 => 193985)
--- trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj 2015-12-11 23:01:57 UTC (rev 193985)
@@ -1319,7 +1319,6 @@
<ClInclude Include="..\ftl\FTLForOSREntryJITCode.h" />
<ClInclude Include="..\ftl\FTLGeneratedFunction.h" />
<ClInclude Include="..\ftl\FTLInlineCacheDescriptor.h" />
- <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h" />
<ClInclude Include="..\ftl\FTLInlineCacheSize.h" />
<ClInclude Include="..\ftl\FTLIntrinsicRepository.h" />
<ClInclude Include="..\ftl\FTLJITCode.h" />
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj.filters (193984 => 193985)
--- trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj.filters 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj.filters 2015-12-11 23:01:57 UTC (rev 193985)
@@ -4252,9 +4252,6 @@
<ClInclude Include="..\ftl\FTLInlineCacheDescriptor.h">
<Filter>ftl</Filter>
</ClInclude>
- <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h">
- <Filter>ftl</Filter>
- </ClInclude>
<ClInclude Include="..\ftl\FTLInlineCacheSize.h">
<Filter>ftl</Filter>
</ClInclude>
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (193984 => 193985)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2015-12-11 23:01:57 UTC (rev 193985)
@@ -2002,7 +2002,6 @@
FE187A0D1C030D5C0038BBCA /* JITDivGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0B1C0229230038BBCA /* JITDivGenerator.h */; };
FE187A0E1C030D640038BBCA /* JITDivGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */; };
FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */; };
- FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */; };
FE187A191C0E13E30038BBCA /* FTLCompileBinaryOp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */; };
FE187A1A1C0E13E60038BBCA /* FTLCompileBinaryOp.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */; };
FE1C0FFD1B193E9800B53FCA /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1C0FFC1B193E9800B53FCA /* Exception.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4190,7 +4189,6 @@
FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SnippetOperand.h; sourceTree = "<group>"; };
FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLCompileBinaryOp.cpp; path = ftl/FTLCompileBinaryOp.cpp; sourceTree = "<group>"; };
FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLCompileBinaryOp.h; path = ftl/FTLCompileBinaryOp.h; sourceTree = "<group>"; };
- FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLInlineCacheDescriptorInlines.h; path = ftl/FTLInlineCacheDescriptorInlines.h; sourceTree = "<group>"; };
FE1C0FFC1B193E9800B53FCA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; };
FE1C0FFE1B194FD100B53FCA /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; };
FE20CE9B15F04A9500DF3430 /* LLIntCLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntCLoop.cpp; path = llint/LLIntCLoop.cpp; sourceTree = "<group>"; };
@@ -4508,7 +4506,6 @@
0FD8A31617D51F2200CA2C40 /* FTLForOSREntryJITCode.h */,
A78A977C179738D5009DF744 /* FTLGeneratedFunction.h */,
0F25F1A7181635F300522F39 /* FTLInlineCacheDescriptor.h */,
- FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */,
0F25F1A8181635F300522F39 /* FTLInlineCacheSize.cpp */,
0F25F1A9181635F300522F39 /* FTLInlineCacheSize.h */,
0FEA0A261709623B00BB722C /* FTLIntrinsicRepository.cpp */,
@@ -6983,7 +6980,6 @@
C2C8D02D14A3C6E000578E65 /* CopiedSpaceInlines.h in Headers */,
0F7C11AD1BC3862C00C74CDB /* CopyBarrier.h in Headers */,
0F5A52D017ADD717008ECB2D /* CopyToken.h in Headers */,
- FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */,
C2239D1816262BDD005AC5FD /* CopyVisitor.h in Headers */,
C2239D1916262BDD005AC5FD /* CopyVisitorInlines.h in Headers */,
C218D1401655CFD50062BB81 /* CopyWorkList.h in Headers */,
Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (193984 => 193985)
--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2015-12-11 23:01:57 UTC (rev 193985)
@@ -40,7 +40,7 @@
#include "FTLCompileBinaryOp.h"
#include "FTLExceptionHandlerManager.h"
#include "FTLExitThunkGenerator.h"
-#include "FTLInlineCacheDescriptorInlines.h"
+#include "FTLInlineCacheDescriptor.h"
#include "FTLInlineCacheSize.h"
#include "FTLJITCode.h"
#include "FTLThunks.h"
@@ -215,7 +215,7 @@
template<typename DescriptorType>
void generateICFastPath(
State& state, CodeBlock* codeBlock, GeneratedFunction generatedFunction,
- StackMaps::RecordMap& recordMap, DescriptorType& ic, size_t sizeOfIC)
+ StackMaps::RecordMap& recordMap, DescriptorType& ic, size_t sizeOfIC, const char* icName)
{
VM& vm = state.graph.m_vm;
@@ -239,7 +239,7 @@
char* startOfIC =
bitwise_cast<char*>(generatedFunction) + record.instructionOffset;
- generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "inline cache fast path", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
+ generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, icName, [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
state.finalizer->sideCodeLinkBuffer->link(ic.m_slowPathDone[i],
CodeLocationLabel(startOfIC + sizeOfIC));
@@ -304,7 +304,7 @@
callReturnLocation, slowPathBeginLoc);
};
- generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "CheckIn inline cache", postLink);
+ generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "CheckIn", postLink);
}
}
@@ -339,8 +339,7 @@
generateBinaryOpFastPath(ic, fastPathJIT, result, left, right, usedRegisters, done, slowPathStart);
char* startOfIC = bitwise_cast<char*>(generatedFunction) + record.instructionOffset;
- const char* fastPathICName = ic.fastPathICName();
- generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, fastPathICName, [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
+ generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, ic.name(), [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
linkBuffer.link(done, CodeLocationLabel(startOfIC + sizeOfIC));
state.finalizer->sideCodeLinkBuffer->link(ic.m_slowPathDone[i], CodeLocationLabel(startOfIC + sizeOfIC));
@@ -877,12 +876,12 @@
for (unsigned i = state.getByIds.size(); i--;) {
generateICFastPath(
state, codeBlock, generatedFunction, recordMap, state.getByIds[i],
- sizeOfGetById());
+ sizeOfGetById(), "GetById");
}
for (unsigned i = state.putByIds.size(); i--;) {
generateICFastPath(
state, codeBlock, generatedFunction, recordMap, state.putByIds[i],
- sizeOfPutById());
+ sizeOfPutById(), "PutById");
}
for (unsigned i = state.checkIns.size(); i--;) {
generateCheckInICFastPath(
@@ -921,7 +920,7 @@
char* startOfIC = bitwise_cast<char*>(generatedFunction) + call.m_instructionOffset;
- generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfCall(), "JSCall inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
+ generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfCall(), "JSCall", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
call.link(vm, linkBuffer);
});
}
@@ -937,7 +936,7 @@
char* startOfIC = bitwise_cast<char*>(generatedFunction) + call.m_instructionOffset;
size_t sizeOfIC = sizeOfICFor(call.node());
- generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "varargs call inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
+ generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "varargs call", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
call.link(vm, linkBuffer, state.finalizer->handleExceptionsLinkBuffer->entrypoint());
});
}
@@ -953,7 +952,7 @@
char* startOfIC = bitwise_cast<char*>(generatedFunction) + call.m_instructionOffset;
size_t sizeOfIC = call.estimatedSize();
- generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "tail call inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
+ generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "tail call", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
call.link(vm, linkBuffer);
});
}
Modified: trunk/Source/_javascript_Core/ftl/FTLCompileBinaryOp.cpp (193984 => 193985)
--- trunk/Source/_javascript_Core/ftl/FTLCompileBinaryOp.cpp 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ftl/FTLCompileBinaryOp.cpp 2015-12-11 23:01:57 UTC (rev 193985)
@@ -179,7 +179,7 @@
JSValueRegs(left), JSValueRegs(right), leftFPR, rightFPR, scratchGPR, scratchFPR);
auto numberOfBytesUsedToPreserveReusedRegisters =
- allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);
+ allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);
context.initializeRegisters(jit);
gen.generateFastPath(jit);
Modified: trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptor.h (193984 => 193985)
--- trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptor.h 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptor.h 2015-12-11 23:01:57 UTC (rev 193985)
@@ -30,6 +30,8 @@
#include "CodeOrigin.h"
#include "DFGAbstractValue.h"
+#include "DFGOperations.h"
+#include "FTLInlineCacheSize.h"
#include "FTLLazySlowPath.h"
#include "JITInlineCacheGenerator.h"
#include "MacroAssembler.h"
@@ -132,7 +134,6 @@
unsigned nodeType() const { return m_nodeType; }
size_t size() const { return m_size; }
const char* name() const { return m_name; }
- const char* fastPathICName() const { return m_fastPathICName; }
SlowPathFunction slowPathFunction() const { return m_slowPathFunction; }
SnippetOperand leftOperand() { return m_leftOperand; }
@@ -142,13 +143,12 @@
protected:
BinaryOpDescriptor(unsigned nodeType, unsigned stackmapID, CodeOrigin codeOrigin,
- size_t size, const char* name, const char* fastPathICName,
- SlowPathFunction slowPathFunction, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
+ size_t size, const char* name, SlowPathFunction slowPathFunction,
+ const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
: InlineCacheDescriptor(stackmapID, codeOrigin, nullptr)
, m_nodeType(nodeType)
, m_size(size)
, m_name(name)
- , m_fastPathICName(fastPathICName)
, m_slowPathFunction(slowPathFunction)
, m_leftOperand(leftOperand)
, m_rightOperand(rightOperand)
@@ -158,7 +158,6 @@
unsigned m_nodeType;
size_t m_size;
const char* m_name;
- const char* m_fastPathICName;
SlowPathFunction m_slowPathFunction;
SnippetOperand m_leftOperand;
@@ -167,26 +166,54 @@
class ArithDivDescriptor : public BinaryOpDescriptor {
public:
- ArithDivDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
- static size_t icSize();
+ ArithDivDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
+ : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
+ { }
+
+ static size_t icSize() { return sizeOfArithDiv(); }
+ static unsigned nodeType() { return DFG::ArithDiv; }
+ static const char* opName() { return "ArithDiv"; }
+ static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueDiv; }
+ static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); }
};
class ArithMulDescriptor : public BinaryOpDescriptor {
public:
- ArithMulDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
- static size_t icSize();
+ ArithMulDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
+ : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
+ { }
+
+ static size_t icSize() { return sizeOfArithMul(); }
+ static unsigned nodeType() { return DFG::ArithMul; }
+ static const char* opName() { return "ArithMul"; }
+ static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueMul; }
+ static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); }
};
class ArithSubDescriptor : public BinaryOpDescriptor {
public:
- ArithSubDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
- static size_t icSize();
+ ArithSubDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
+ : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
+ { }
+
+ static size_t icSize() { return sizeOfArithSub(); }
+ static unsigned nodeType() { return DFG::ArithSub; }
+ static const char* opName() { return "ArithSub"; }
+ static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueSub; }
+ static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); }
};
class ValueAddDescriptor : public BinaryOpDescriptor {
public:
- ValueAddDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
- static size_t icSize();
+ ValueAddDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
+ : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
+ { }
+
+ static size_t icSize() { return sizeOfValueAdd(); }
+ static unsigned nodeType() { return DFG::ValueAdd; }
+ static const char* opName() { return "ValueAdd"; }
+ static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueAdd; }
+ static J_JITOperation_EJJ nonNumberSlowPathFunction() { return DFG::operationValueAddNotNumber; }
};
// You can create a lazy slow path call in lowerDFGToLLVM by doing:
Deleted: trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptorInlines.h (193984 => 193985)
--- trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptorInlines.h 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptorInlines.h 2015-12-11 23:01:57 UTC (rev 193985)
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FTLInlineCacheDescriptorInlines_h
-#define FTLInlineCacheDescriptorInlines_h
-
-#if ENABLE(FTL_JIT)
-
-#include "DFGNodeType.h"
-#include "DFGOperations.h"
-#include "FTLInlineCacheDescriptor.h"
-#include "FTLInlineCacheSize.h"
-
-namespace JSC { namespace FTL {
-
-ArithDivDescriptor::ArithDivDescriptor(unsigned stackmapID, CodeOrigin codeOrigin,
- const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
- : BinaryOpDescriptor(DFG::ArithDiv, stackmapID, codeOrigin, icSize(),
- "ArithDiv", "ArithDiv IC fast path", DFG::operationValueDiv, leftOperand, rightOperand)
-{
-}
-
-size_t ArithDivDescriptor::icSize()
-{
- return sizeOfArithDiv();
-}
-
-ArithMulDescriptor::ArithMulDescriptor(unsigned stackmapID, CodeOrigin codeOrigin,
- const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
- : BinaryOpDescriptor(DFG::ArithMul, stackmapID, codeOrigin, icSize(),
- "ArithMul", "ArithMul IC fast path", DFG::operationValueMul, leftOperand, rightOperand)
-{
-}
-
-size_t ArithMulDescriptor::icSize()
-{
- return sizeOfArithMul();
-}
-
-ArithSubDescriptor::ArithSubDescriptor(unsigned stackmapID, CodeOrigin codeOrigin,
- const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
- : BinaryOpDescriptor(DFG::ArithSub, stackmapID, codeOrigin, icSize(),
- "ArithSub", "ArithSub IC fast path", DFG::operationValueSub, leftOperand, rightOperand)
-{
-}
-
-size_t ArithSubDescriptor::icSize()
-{
- return sizeOfArithSub();
-}
-
-ValueAddDescriptor::ValueAddDescriptor(unsigned stackmapID, CodeOrigin codeOrigin,
- const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
- : BinaryOpDescriptor(DFG::ValueAdd, stackmapID, codeOrigin, icSize(),
- "ValueAdd", "ValueAdd IC fast path", DFG::operationValueAdd, leftOperand, rightOperand)
-{
-}
-
-size_t ValueAddDescriptor::icSize()
-{
- return sizeOfValueAdd();
-}
-
-} } // namespace JSC::FTL
-
-#endif // ENABLE(FTL_JIT)
-
-#endif // FTLInlineCacheDescriptorInlines_h
Modified: trunk/Source/_javascript_Core/ftl/FTLJITFinalizer.cpp (193984 => 193985)
--- trunk/Source/_javascript_Core/ftl/FTLJITFinalizer.cpp 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ftl/FTLJITFinalizer.cpp 2015-12-11 23:01:57 UTC (rev 193985)
@@ -137,7 +137,7 @@
for (unsigned i = 0; i < outOfLineCodeInfos.size(); ++i) {
jitCode->addHandle(FINALIZE_CODE_IF(
dumpDisassembly, *outOfLineCodeInfos[i].m_linkBuffer,
- ("FTL out of line code for %s", outOfLineCodeInfos[i].m_codeDescription)).executableMemory());
+ ("FTL out of line code for %s inline cache", outOfLineCodeInfos[i].m_codeDescription)).executableMemory());
}
#endif // FTL_USES_B3
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (193984 => 193985)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-12-11 23:01:57 UTC (rev 193985)
@@ -1038,6 +1038,84 @@
return true;
}
+ enum ConstInt32OperandOptimizationSupport {
+ HasConstInt32OperandOptimization,
+ DoesNotHaveConstInt32OperandOptimization,
+ };
+
+ enum ConstDoubleOperandOptimizationSupport {
+ HasConstDoubleOperandOptimization,
+ DoesNotHaveConstDoubleOperandOptimization,
+ };
+
+ template <typename SnippetICDescriptor,
+ ConstInt32OperandOptimizationSupport constInt32Opt = HasConstInt32OperandOptimization,
+ ConstDoubleOperandOptimizationSupport constDoubleOpt = DoesNotHaveConstDoubleOperandOptimization>
+ void compileUntypedBinaryOp()
+ {
+ Edge& leftChild = m_node->child1();
+ Edge& rightChild = m_node->child2();
+
+ if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
+ setJSValue(vmCall(m_out.int64, m_out.operation(SnippetICDescriptor::nonNumberSlowPathFunction()), m_callFrame,
+ lowJSValue(leftChild), lowJSValue(rightChild)));
+ return;
+ }
+
+ unsigned stackmapID = m_stackmapIDs++;
+
+ if (Options::verboseCompilation())
+ dataLog(" Emitting ", SnippetICDescriptor::opName(), " patchpoint with stackmap #", stackmapID, "\n");
+
+#if FTL_USES_B3
+ CRASH();
+#else
+ LValue left = lowJSValue(leftChild);
+ LValue right = lowJSValue(rightChild);
+
+ SnippetOperand leftOperand(abstractValue(leftChild).resultType());
+ SnippetOperand rightOperand(abstractValue(rightChild).resultType());
+
+ if (constInt32Opt == HasConstInt32OperandOptimization && leftChild->isInt32Constant())
+ leftOperand.setConstInt32(leftChild->asInt32());
+#if USE(JSVALUE64)
+ else if (constDoubleOpt == HasConstDoubleOperandOptimization && leftChild->isDoubleConstant())
+ leftOperand.setConstDouble(leftChild->asNumber());
+#endif
+
+ if (leftOperand.isConst()) {
+ // Because the snippet does not support both operands being constant, if the left
+ // operand is already a constant, we'll just pretend the right operand is not.
+ } else if (constInt32Opt == HasConstInt32OperandOptimization && rightChild->isInt32Constant())
+ rightOperand.setConstInt32(rightChild->asInt32());
+#if USE(JSVALUE64)
+ else if (constDoubleOpt == HasConstDoubleOperandOptimization && rightChild->isDoubleConstant())
+ rightOperand.setConstDouble(rightChild->asNumber());
+#endif
+
+ RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst());
+
+ // Arguments: id, bytes, target, numArgs, args...
+ StackmapArgumentList arguments;
+ arguments.append(m_out.constInt64(stackmapID));
+ arguments.append(m_out.constInt32(SnippetICDescriptor::icSize()));
+ arguments.append(constNull(m_out.ref8));
+ arguments.append(m_out.constInt32(2));
+ arguments.append(left);
+ arguments.append(right);
+
+ appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
+ ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
+
+ LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
+ setInstructionCallingConvention(call, LLVMAnyRegCallConv);
+
+ m_ftlState.binaryOps.append(SnippetICDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
+
+ setJSValue(call);
+#endif
+ }
+
void compileUpsilon()
{
LValue upsilonValue = nullptr;
@@ -1512,55 +1590,7 @@
void compileValueAdd()
{
- Edge& leftChild = m_node->child1();
- Edge& rightChild = m_node->child2();
-
- if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
- setJSValue(vmCall(m_out.int64, m_out.operation(operationValueAddNotNumber), m_callFrame,
- lowJSValue(leftChild), lowJSValue(rightChild)));
- return;
- }
-
- unsigned stackmapID = m_stackmapIDs++;
-
- if (Options::verboseCompilation())
- dataLog(" Emitting ValueAdd patchpoint with stackmap #", stackmapID, "\n");
-
-#if FTL_USES_B3
- CRASH();
-#else
- LValue left = lowJSValue(leftChild);
- LValue right = lowJSValue(rightChild);
-
- SnippetOperand leftOperand(abstractValue(leftChild).resultType());
- SnippetOperand rightOperand(abstractValue(rightChild).resultType());
-
- // Because the snippet does not support both operands being constant, if the left
- // operand is already a constant, we'll just pretend the right operand is not.
- if (leftChild->isInt32Constant())
- leftOperand.setConstInt32(leftChild->asInt32());
- else if (rightChild->isInt32Constant())
- rightOperand.setConstInt32(rightChild->asInt32());
-
- // Arguments: id, bytes, target, numArgs, args...
- StackmapArgumentList arguments;
- arguments.append(m_out.constInt64(stackmapID));
- arguments.append(m_out.constInt32(ValueAddDescriptor::icSize()));
- arguments.append(constNull(m_out.ref8));
- arguments.append(m_out.constInt32(2));
- arguments.append(left);
- arguments.append(right);
-
- appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
- ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
-
- LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
- setInstructionCallingConvention(call, LLVMAnyRegCallConv);
-
- m_ftlState.binaryOps.append(ValueAddDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
-
- setJSValue(call);
-#endif
+ compileUntypedBinaryOp<ValueAddDescriptor>();
}
void compileStrCat()
@@ -1709,38 +1739,7 @@
break;
}
- unsigned stackmapID = m_stackmapIDs++;
-
- if (Options::verboseCompilation())
- dataLog(" Emitting ArithSub patchpoint with stackmap #", stackmapID, "\n");
-
-#if FTL_USES_B3
- CRASH();
-#else
- LValue left = lowJSValue(m_node->child1());
- LValue right = lowJSValue(m_node->child2());
-
- // Arguments: id, bytes, target, numArgs, args...
- StackmapArgumentList arguments;
- arguments.append(m_out.constInt64(stackmapID));
- arguments.append(m_out.constInt32(ArithSubDescriptor::icSize()));
- arguments.append(constNull(m_out.ref8));
- arguments.append(m_out.constInt32(2));
- arguments.append(left);
- arguments.append(right);
-
- appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
- ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
-
- LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
- setInstructionCallingConvention(call, LLVMAnyRegCallConv);
-
- SnippetOperand leftOperand(abstractValue(m_node->child1()).resultType());
- SnippetOperand rightOperand(abstractValue(m_node->child2()).resultType());
- m_ftlState.binaryOps.append(ArithSubDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
-
- setJSValue(call);
-#endif
+ compileUntypedBinaryOp<ArithSubDescriptor, DoesNotHaveConstInt32OperandOptimization, DoesNotHaveConstDoubleOperandOptimization>();
break;
}
@@ -1836,57 +1835,7 @@
}
case UntypedUse: {
- Edge& leftChild = m_node->child1();
- Edge& rightChild = m_node->child2();
-
- if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
- setJSValue(vmCall(m_out.int64, m_out.operation(operationValueMul), m_callFrame,
- lowJSValue(leftChild), lowJSValue(rightChild)));
- return;
- }
-
- unsigned stackmapID = m_stackmapIDs++;
-
- if (Options::verboseCompilation())
- dataLog(" Emitting ArithMul patchpoint with stackmap #", stackmapID, "\n");
-
-#if FTL_USES_B3
- CRASH();
-#else
- LValue left = lowJSValue(leftChild);
- LValue right = lowJSValue(rightChild);
-
- SnippetOperand leftOperand(abstractValue(leftChild).resultType());
- SnippetOperand rightOperand(abstractValue(rightChild).resultType());
-
- // Because the snippet does not support both operands being constant, if the left
- // operand is already a constant, we'll just pretend the right operand is not.
- if (leftChild->isInt32Constant())
- leftOperand.setConstInt32(leftChild->asInt32());
- else if (rightChild->isInt32Constant())
- rightOperand.setConstInt32(rightChild->asInt32());
-
- RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst());
-
- // Arguments: id, bytes, target, numArgs, args...
- StackmapArgumentList arguments;
- arguments.append(m_out.constInt64(stackmapID));
- arguments.append(m_out.constInt32(ArithMulDescriptor::icSize()));
- arguments.append(constNull(m_out.ref8));
- arguments.append(m_out.constInt32(2));
- arguments.append(left);
- arguments.append(right);
-
- appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
- ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
-
- LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
- setInstructionCallingConvention(call, LLVMAnyRegCallConv);
-
- m_ftlState.binaryOps.append(ArithMulDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
-
- setJSValue(call);
-#endif
+ compileUntypedBinaryOp<ArithMulDescriptor>();
break;
}
@@ -1955,67 +1904,7 @@
}
case UntypedUse: {
- Edge& leftChild = m_node->child1();
- Edge& rightChild = m_node->child2();
-
- if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
- setJSValue(vmCall(m_out.int64, m_out.operation(operationValueDiv), m_callFrame,
- lowJSValue(leftChild), lowJSValue(rightChild)));
- return;
- }
-
- unsigned stackmapID = m_stackmapIDs++;
-
- if (Options::verboseCompilation())
- dataLog(" Emitting ArithDiv patchpoint with stackmap #", stackmapID, "\n");
-
-#if FTL_USES_B3
- CRASH();
-#else
- LValue left = lowJSValue(leftChild);
- LValue right = lowJSValue(rightChild);
-
- SnippetOperand leftOperand(abstractValue(leftChild).resultType());
- SnippetOperand rightOperand(abstractValue(rightChild).resultType());
-
- if (leftChild->isInt32Constant())
- leftOperand.setConstInt32(leftChild->asInt32());
-#if USE(JSVALUE64)
- else if (leftChild->isDoubleConstant())
- leftOperand.setConstDouble(leftChild->asNumber());
-#endif
-
- if (leftOperand.isConst()) {
- // The snippet generator only supports 1 argument as a constant.
- // Ignore the rightChild's const-ness.
- } else if (rightChild->isInt32Constant())
- rightOperand.setConstInt32(rightChild->asInt32());
-#if USE(JSVALUE64)
- else if (rightChild->isDoubleConstant())
- rightOperand.setConstDouble(rightChild->asNumber());
-#endif
-
- RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst());
-
- // Arguments: id, bytes, target, numArgs, args...
- StackmapArgumentList arguments;
- arguments.append(m_out.constInt64(stackmapID));
- arguments.append(m_out.constInt32(ArithDivDescriptor::icSize()));
- arguments.append(constNull(m_out.ref8));
- arguments.append(m_out.constInt32(2));
- arguments.append(left);
- arguments.append(right);
-
- appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
- ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
-
- LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
- setInstructionCallingConvention(call, LLVMAnyRegCallConv);
-
- m_ftlState.binaryOps.append(ArithDivDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
-
- setJSValue(call);
-#endif // FTL_USES_B3
+ compileUntypedBinaryOp<ArithDivDescriptor, HasConstInt32OperandOptimization, HasConstDoubleOperandOptimization>();
break;
}
Modified: trunk/Source/_javascript_Core/ftl/FTLState.h (193984 => 193985)
--- trunk/Source/_javascript_Core/ftl/FTLState.h 2015-12-11 22:43:49 UTC (rev 193984)
+++ trunk/Source/_javascript_Core/ftl/FTLState.h 2015-12-11 23:01:57 UTC (rev 193985)
@@ -40,7 +40,6 @@
#include "FTLJSCallVarargs.h"
#include "FTLJSTailCall.h"
#include "FTLStackMaps.h"
-#include "FTLState.h"
#include <wtf/Noncopyable.h>
namespace JSC { namespace FTL {