summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h')
-rw-r--r--Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h141
1 files changed, 74 insertions, 67 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h b/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h
index e595c383c..34d3631ea 100644
--- a/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h
+++ b/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h
@@ -26,12 +26,15 @@
#ifndef DFGSlowPathGenerator_h
#define DFGSlowPathGenerator_h
+#include <wtf/Platform.h>
+
#if ENABLE(DFG_JIT)
#include "DFGCommon.h"
#include "DFGSilentRegisterSavePlan.h"
#include "DFGSpeculativeJIT.h"
#include <wtf/FastMalloc.h>
+#include <wtf/PassOwnPtr.h>
namespace JSC { namespace DFG {
@@ -40,8 +43,6 @@ class SlowPathGenerator {
public:
SlowPathGenerator(SpeculativeJIT* jit)
: m_currentNode(jit->m_currentNode)
- , m_streamIndex(jit->m_stream->size())
- , m_origin(jit->m_origin)
{
}
virtual ~SlowPathGenerator() { }
@@ -49,12 +50,9 @@ public:
{
m_label = jit->m_jit.label();
jit->m_currentNode = m_currentNode;
- jit->m_outOfLineStreamIndex = m_streamIndex;
- jit->m_origin = m_origin;
generateInternal(jit);
- jit->m_outOfLineStreamIndex = UINT_MAX;
if (!ASSERT_DISABLED)
- jit->m_jit.abortWithReason(DFGSlowPathGeneratorFellThrough);
+ jit->m_jit.breakpoint(); // make sure that the generator jumps back to somewhere
}
MacroAssembler::Label label() const { return m_label; }
virtual MacroAssembler::Call call() const
@@ -62,15 +60,10 @@ public:
RELEASE_ASSERT_NOT_REACHED(); // By default slow path generators don't have a call.
return MacroAssembler::Call();
}
-
- const NodeOrigin& origin() const { return m_origin; }
-
protected:
virtual void generateInternal(SpeculativeJIT*) = 0;
MacroAssembler::Label m_label;
Node* m_currentNode;
- unsigned m_streamIndex;
- NodeOrigin m_origin;
};
template<typename JumpType>
@@ -98,21 +91,15 @@ protected:
MacroAssembler::Label m_to;
};
-enum class ExceptionCheckRequirement {
- CheckNeeded,
- CheckNotNeeded
-};
-
template<typename JumpType, typename FunctionType, typename ResultType>
class CallSlowPathGenerator : public JumpingSlowPathGenerator<JumpType> {
public:
CallSlowPathGenerator(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- SpillRegistersMode spillMode, ExceptionCheckRequirement requirement, ResultType result)
+ SpillRegistersMode spillMode, ResultType result)
: JumpingSlowPathGenerator<JumpType>(from, jit)
, m_function(function)
, m_spillMode(spillMode)
- , m_exceptionCheckRequirement(requirement)
, m_result(result)
{
if (m_spillMode == NeedToSpill)
@@ -146,14 +133,11 @@ protected:
for (unsigned i = m_plans.size(); i--;)
jit->silentFill(m_plans[i], canTrample);
}
- if (m_exceptionCheckRequirement == ExceptionCheckRequirement::CheckNeeded)
- jit->m_jit.exceptionCheck();
this->jumpTo(jit);
}
FunctionType m_function;
SpillRegistersMode m_spillMode;
- ExceptionCheckRequirement m_exceptionCheckRequirement;
ResultType m_result;
MacroAssembler::Call m_call;
Vector<SilentRegisterSavePlan, 2> m_plans;
@@ -165,9 +149,9 @@ class CallResultAndNoArgumentsSlowPathGenerator
public:
CallResultAndNoArgumentsSlowPathGenerator(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- SpillRegistersMode spillMode, ExceptionCheckRequirement requirement, ResultType result)
+ SpillRegistersMode spillMode, ResultType result)
: CallSlowPathGenerator<JumpType, FunctionType, ResultType>(
- from, jit, function, spillMode, requirement, result)
+ from, jit, function, spillMode, result)
{
}
@@ -188,9 +172,9 @@ class CallResultAndOneArgumentSlowPathGenerator
public:
CallResultAndOneArgumentSlowPathGenerator(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- SpillRegistersMode spillMode, ExceptionCheckRequirement requirement, ResultType result, ArgumentType1 argument1)
+ SpillRegistersMode spillMode, ResultType result, ArgumentType1 argument1)
: CallSlowPathGenerator<JumpType, FunctionType, ResultType>(
- from, jit, function, spillMode, requirement, result)
+ from, jit, function, spillMode, result)
, m_argument1(argument1)
{
}
@@ -214,10 +198,10 @@ class CallResultAndTwoArgumentsSlowPathGenerator
public:
CallResultAndTwoArgumentsSlowPathGenerator(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- SpillRegistersMode spillMode, ExceptionCheckRequirement requirement, ResultType result, ArgumentType1 argument1,
+ SpillRegistersMode spillMode, ResultType result, ArgumentType1 argument1,
ArgumentType2 argument2)
: CallSlowPathGenerator<JumpType, FunctionType, ResultType>(
- from, jit, function, spillMode, requirement, result)
+ from, jit, function, spillMode, result)
, m_argument1(argument1)
, m_argument2(argument2)
{
@@ -243,10 +227,10 @@ class CallResultAndThreeArgumentsSlowPathGenerator
public:
CallResultAndThreeArgumentsSlowPathGenerator(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- SpillRegistersMode spillMode, ExceptionCheckRequirement requirement, ResultType result, ArgumentType1 argument1,
+ SpillRegistersMode spillMode, ResultType result, ArgumentType1 argument1,
ArgumentType2 argument2, ArgumentType3 argument3)
: CallSlowPathGenerator<JumpType, FunctionType, ResultType>(
- from, jit, function, spillMode, requirement, result)
+ from, jit, function, spillMode, result)
, m_argument1(argument1)
, m_argument2(argument2)
, m_argument3(argument3)
@@ -278,10 +262,10 @@ class CallResultAndFourArgumentsSlowPathGenerator
public:
CallResultAndFourArgumentsSlowPathGenerator(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- SpillRegistersMode spillMode, ExceptionCheckRequirement requirement, ResultType result, ArgumentType1 argument1,
+ SpillRegistersMode spillMode, ResultType result, ArgumentType1 argument1,
ArgumentType2 argument2, ArgumentType3 argument3, ArgumentType4 argument4)
: CallSlowPathGenerator<JumpType, FunctionType, ResultType>(
- from, jit, function, spillMode, requirement, result)
+ from, jit, function, spillMode, result)
, m_argument1(argument1)
, m_argument2(argument2)
, m_argument3(argument3)
@@ -315,11 +299,11 @@ class CallResultAndFiveArgumentsSlowPathGenerator
public:
CallResultAndFiveArgumentsSlowPathGenerator(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- SpillRegistersMode spillMode, ExceptionCheckRequirement requirement, ResultType result, ArgumentType1 argument1,
+ SpillRegistersMode spillMode, ResultType result, ArgumentType1 argument1,
ArgumentType2 argument2, ArgumentType3 argument3, ArgumentType4 argument4,
ArgumentType5 argument5)
: CallSlowPathGenerator<JumpType, FunctionType, ResultType>(
- from, jit, function, spillMode, requirement, result)
+ from, jit, function, spillMode, result)
, m_argument1(argument1)
, m_argument2(argument2)
, m_argument3(argument3)
@@ -347,77 +331,94 @@ protected:
};
template<typename JumpType, typename FunctionType, typename ResultType>
-inline std::unique_ptr<SlowPathGenerator> slowPathCall(
+inline PassOwnPtr<SlowPathGenerator> slowPathCall(
JumpType from, SpeculativeJIT* jit, FunctionType function,
- ResultType result, SpillRegistersMode spillMode = NeedToSpill, ExceptionCheckRequirement requirement = ExceptionCheckRequirement::CheckNeeded)
+ ResultType result, SpillRegistersMode spillMode = NeedToSpill)
{
- return std::make_unique<CallResultAndNoArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType>>(
- from, jit, function, spillMode, requirement, result);
+ return adoptPtr(
+ new CallResultAndNoArgumentsSlowPathGenerator<
+ JumpType, FunctionType, ResultType>(
+ from, jit, function, spillMode, result));
}
template<
typename JumpType, typename FunctionType, typename ResultType,
typename ArgumentType1>
-inline std::unique_ptr<SlowPathGenerator> slowPathCall(
+inline PassOwnPtr<SlowPathGenerator> slowPathCall(
JumpType from, SpeculativeJIT* jit, FunctionType function,
ResultType result, ArgumentType1 argument1,
- SpillRegistersMode spillMode = NeedToSpill, ExceptionCheckRequirement requirement = ExceptionCheckRequirement::CheckNeeded)
+ SpillRegistersMode spillMode = NeedToSpill)
{
- return std::make_unique<CallResultAndOneArgumentSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1>>(
- from, jit, function, spillMode, requirement, result, argument1);
+ return adoptPtr(
+ new CallResultAndOneArgumentSlowPathGenerator<
+ JumpType, FunctionType, ResultType, ArgumentType1>(
+ from, jit, function, spillMode, result, argument1));
}
template<
typename JumpType, typename FunctionType, typename ResultType,
typename ArgumentType1, typename ArgumentType2>
-inline std::unique_ptr<SlowPathGenerator> slowPathCall(
+inline PassOwnPtr<SlowPathGenerator> slowPathCall(
JumpType from, SpeculativeJIT* jit, FunctionType function,
ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
- SpillRegistersMode spillMode = NeedToSpill, ExceptionCheckRequirement requirement = ExceptionCheckRequirement::CheckNeeded)
+ SpillRegistersMode spillMode = NeedToSpill)
{
- return std::make_unique<CallResultAndTwoArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2>>(
- from, jit, function, spillMode, requirement, result, argument1, argument2);
+ return adoptPtr(
+ new CallResultAndTwoArgumentsSlowPathGenerator<
+ JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2>(
+ from, jit, function, spillMode, result, argument1, argument2));
}
template<
typename JumpType, typename FunctionType, typename ResultType,
typename ArgumentType1, typename ArgumentType2, typename ArgumentType3>
-inline std::unique_ptr<SlowPathGenerator> slowPathCall(
+inline PassOwnPtr<SlowPathGenerator> slowPathCall(
JumpType from, SpeculativeJIT* jit, FunctionType function,
ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
- ArgumentType3 argument3, SpillRegistersMode spillMode = NeedToSpill, ExceptionCheckRequirement requirement = ExceptionCheckRequirement::CheckNeeded)
+ ArgumentType3 argument3, SpillRegistersMode spillMode = NeedToSpill)
{
- return std::make_unique<CallResultAndThreeArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
- ArgumentType3>>(from, jit, function, spillMode, requirement, result, argument1, argument2, argument3);
+ return adoptPtr(
+ new CallResultAndThreeArgumentsSlowPathGenerator<
+ JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
+ ArgumentType3>(
+ from, jit, function, spillMode, result, argument1, argument2,
+ argument3));
}
template<
typename JumpType, typename FunctionType, typename ResultType,
typename ArgumentType1, typename ArgumentType2, typename ArgumentType3,
typename ArgumentType4>
-inline std::unique_ptr<SlowPathGenerator> slowPathCall(
+inline PassOwnPtr<SlowPathGenerator> slowPathCall(
JumpType from, SpeculativeJIT* jit, FunctionType function,
ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
ArgumentType3 argument3, ArgumentType4 argument4,
- SpillRegistersMode spillMode = NeedToSpill, ExceptionCheckRequirement requirement = ExceptionCheckRequirement::CheckNeeded)
+ SpillRegistersMode spillMode = NeedToSpill)
{
- return std::make_unique<CallResultAndFourArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
- ArgumentType3, ArgumentType4>>(from, jit, function, spillMode, requirement, result, argument1, argument2, argument3, argument4);
+ return adoptPtr(
+ new CallResultAndFourArgumentsSlowPathGenerator<
+ JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
+ ArgumentType3, ArgumentType4>(
+ from, jit, function, spillMode, result, argument1, argument2,
+ argument3, argument4));
}
template<
typename JumpType, typename FunctionType, typename ResultType,
typename ArgumentType1, typename ArgumentType2, typename ArgumentType3,
typename ArgumentType4, typename ArgumentType5>
-inline std::unique_ptr<SlowPathGenerator> slowPathCall(
+inline PassOwnPtr<SlowPathGenerator> slowPathCall(
JumpType from, SpeculativeJIT* jit, FunctionType function,
ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
ArgumentType3 argument3, ArgumentType4 argument4, ArgumentType5 argument5,
- SpillRegistersMode spillMode = NeedToSpill, ExceptionCheckRequirement requirement = ExceptionCheckRequirement::CheckNeeded)
+ SpillRegistersMode spillMode = NeedToSpill)
{
- return std::make_unique<CallResultAndFiveArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
- ArgumentType3, ArgumentType4, ArgumentType5>>(from, jit, function, spillMode, requirement, result, argument1, argument2, argument3,
- argument4, argument5);
+ return adoptPtr(
+ new CallResultAndFiveArgumentsSlowPathGenerator<
+ JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
+ ArgumentType3, ArgumentType4, ArgumentType5>(
+ from, jit, function, spillMode, result, argument1, argument2,
+ argument3, argument4, argument5));
}
template<typename JumpType, typename DestinationType, typename SourceType, unsigned numberOfAssignments>
@@ -450,31 +451,37 @@ private:
};
template<typename JumpType, typename DestinationType, typename SourceType, unsigned numberOfAssignments>
-inline std::unique_ptr<SlowPathGenerator> slowPathMove(
+inline PassOwnPtr<SlowPathGenerator> slowPathMove(
JumpType from, SpeculativeJIT* jit, SourceType source[numberOfAssignments], DestinationType destination[numberOfAssignments])
{
- return std::make_unique<AssigningSlowPathGenerator<JumpType, DestinationType, SourceType, numberOfAssignments>>(
- from, jit, destination, source);
+ return adoptPtr(
+ new AssigningSlowPathGenerator<
+ JumpType, DestinationType, SourceType, numberOfAssignments>(
+ from, jit, destination, source));
}
template<typename JumpType, typename DestinationType, typename SourceType>
-inline std::unique_ptr<SlowPathGenerator> slowPathMove(
+inline PassOwnPtr<SlowPathGenerator> slowPathMove(
JumpType from, SpeculativeJIT* jit, SourceType source, DestinationType destination)
{
SourceType sourceArray[1] = { source };
DestinationType destinationArray[1] = { destination };
- return std::make_unique<AssigningSlowPathGenerator<JumpType, DestinationType, SourceType, 1>>(
- from, jit, destinationArray, sourceArray);
+ return adoptPtr(
+ new AssigningSlowPathGenerator<
+ JumpType, DestinationType, SourceType, 1>(
+ from, jit, destinationArray, sourceArray));
}
template<typename JumpType, typename DestinationType, typename SourceType>
-inline std::unique_ptr<SlowPathGenerator> slowPathMove(
+inline PassOwnPtr<SlowPathGenerator> slowPathMove(
JumpType from, SpeculativeJIT* jit, SourceType source1, DestinationType destination1, SourceType source2, DestinationType destination2)
{
SourceType sourceArray[2] = { source1, source2 };
DestinationType destinationArray[2] = { destination1, destination2 };
- return std::make_unique<AssigningSlowPathGenerator<JumpType, DestinationType, SourceType, 2>>(
- from, jit, destinationArray, sourceArray);
+ return adoptPtr(
+ new AssigningSlowPathGenerator<
+ JumpType, DestinationType, SourceType, 2>(
+ from, jit, destinationArray, sourceArray));
}
} } // namespace JSC::DFG