Title: [194185] trunk/Source/_javascript_Core
- Revision
- 194185
- Author
- [email protected]
- Date
- 2015-12-16 15:59:13 -0800 (Wed, 16 Dec 2015)
Log Message
FTL B3 should support switches
https://bugs.webkit.org/show_bug.cgi?id=152360
Reviewed by Geoffrey Garen.
I implemented this because I was hoping it would less us run V8/crypto, but instead it just led
me to file a fun bug: https://bugs.webkit.org/show_bug.cgi?id=152365.
* ftl/FTLB3Output.h:
(JSC::FTL::Output::check):
(JSC::FTL::Output::switchInstruction):
(JSC::FTL::Output::ret):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::ftlUnreachable):
(JSC::FTL::DFG::LowerDFGToLLVM::crash):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (194184 => 194185)
--- trunk/Source/_javascript_Core/ChangeLog 2015-12-16 23:41:05 UTC (rev 194184)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-12-16 23:59:13 UTC (rev 194185)
@@ -1,3 +1,21 @@
+2015-12-16 Filip Pizlo <[email protected]>
+
+ FTL B3 should support switches
+ https://bugs.webkit.org/show_bug.cgi?id=152360
+
+ Reviewed by Geoffrey Garen.
+
+ I implemented this because I was hoping it would less us run V8/crypto, but instead it just led
+ me to file a fun bug: https://bugs.webkit.org/show_bug.cgi?id=152365.
+
+ * ftl/FTLB3Output.h:
+ (JSC::FTL::Output::check):
+ (JSC::FTL::Output::switchInstruction):
+ (JSC::FTL::Output::ret):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::DFG::ftlUnreachable):
+ (JSC::FTL::DFG::LowerDFGToLLVM::crash):
+
2015-12-16 Alex Christensen <[email protected]>
Fix internal Windows build
Modified: trunk/Source/_javascript_Core/ftl/FTLB3Output.h (194184 => 194185)
--- trunk/Source/_javascript_Core/ftl/FTLB3Output.h 2015-12-16 23:41:05 UTC (rev 194184)
+++ trunk/Source/_javascript_Core/ftl/FTLB3Output.h 2015-12-16 23:59:13 UTC (rev 194185)
@@ -413,7 +413,16 @@
void check(LValue condition, WeightedTarget taken) { CRASH(); }
template<typename VectorType>
- void switchInstruction(LValue value, const VectorType& cases, LBasicBlock fallThrough, Weight fallThroughWeight) { CRASH(); }
+ void switchInstruction(LValue value, const VectorType& cases, LBasicBlock fallThrough, Weight fallThroughWeight)
+ {
+ B3::SwitchValue* switchValue = m_block->appendNew<B3::SwitchValue>(
+ m_proc, origin(), value, B3::FrequentedBlock(fallThrough));
+ for (const SwitchCase& switchCase : cases) {
+ int64_t value = switchCase.value()->asInt();
+ B3::FrequentedBlock target(switchCase.target(), switchCase.weight().frequencyClass());
+ switchValue->appendCase(B3::SwitchCase(value, target));
+ }
+ }
void ret(LValue value) { m_block->appendNew<B3::ControlValue>(m_proc, B3::Return, origin(), value); }
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (194184 => 194185)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-12-16 23:41:05 UTC (rev 194184)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-12-16 23:59:13 UTC (rev 194185)
@@ -80,7 +80,7 @@
{
CRASH();
}
-#elif !FTL_USES_B3
+#else
NO_RETURN_DUE_TO_CRASH static void ftlUnreachable(
CodeBlock* codeBlock, BlockIndex blockIndex, unsigned nodeIndex)
{
@@ -10065,23 +10065,20 @@
UNUSED_PARAM(blockIndex);
UNUSED_PARAM(nodeIndex);
#else
-#if FTL_USES_B3
- UNUSED_PARAM(blockIndex);
- UNUSED_PARAM(nodeIndex);
- if (verboseCompilationEnabled() || !verboseCompilationEnabled())
- CRASH();
-#else
m_out.call(
m_out.voidType,
+#if FTL_USES_B3
+ m_out.constIntPtr(ftlUnreachable),
+#else // FTL_USES_B3
m_out.intToPtr(
m_out.constIntPtr(ftlUnreachable),
pointerType(
functionType(
m_out.voidType, m_out.intPtr, m_out.int32, m_out.int32))),
+#endif // FTL_USES_B3
m_out.constIntPtr(codeBlock()), m_out.constInt32(blockIndex),
m_out.constInt32(nodeIndex));
#endif
-#endif
m_out.unreachable();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes