FTL should fully support Switch (it currently lacks the SwitchString variant)
https://bugs.webkit.org/show_bug.cgi?id=144348
Reviewed by Benjamin Poulain.
This adds SwitchString support to the FTL. This is already tested by switch microbenchmarks
in LayoutTests/js/regress.
* dfg/DFGCommon.cpp:
(JSC::DFG::stringLessThan):
* dfg/DFGCommon.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::StringSwitchCase::operator<): Deleted.
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::StringSwitchCase::operator<):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileSwitch):
(JSC::FTL::LowerDFGToLLVM::switchString):
(JSC::FTL::LowerDFGToLLVM::StringSwitchCase::StringSwitchCase):
(JSC::FTL::LowerDFGToLLVM::StringSwitchCase::operator<):
(JSC::FTL::LowerDFGToLLVM::CharacterCase::CharacterCase):
(JSC::FTL::LowerDFGToLLVM::CharacterCase::operator<):
(JSC::FTL::LowerDFGToLLVM::switchStringRecurse):
(JSC::FTL::LowerDFGToLLVM::switchStringSlow):
(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
* ftl/FTLOutput.cpp:
(JSC::FTL::Output::check):
* ftl/FTLOutput.h:
* ftl/FTLWeight.h:
(JSC::FTL::Weight::inverse):
* jit/JITOperations.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@183525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ftl/FTLOutput.cpp b/Source/JavaScriptCore/ftl/FTLOutput.cpp
index 55b30ec..30d5fbd 100644
--- a/Source/JavaScriptCore/ftl/FTLOutput.cpp
+++ b/Source/JavaScriptCore/ftl/FTLOutput.cpp
@@ -138,6 +138,18 @@
constInt32(notTakenWeight.scaleToTotal(total))));
}
+void Output::check(LValue condition, WeightedTarget taken, Weight notTakenWeight)
+{
+ LBasicBlock continuation = FTL_NEW_BLOCK(*this, ("Output::check continuation"));
+ branch(condition, taken, WeightedTarget(continuation, notTakenWeight));
+ appendTo(continuation);
+}
+
+void Output::check(LValue condition, WeightedTarget taken)
+{
+ check(condition, taken, taken.weight().inverse());
+}
+
} } // namespace JSC::FTL
#endif // ENABLE(FTL_JIT)