Changeset 195488 in webkit
- Timestamp:
- Jan 22, 2016 3:30:07 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r195484 r195488 1 2016-01-22 Mark Lam <mark.lam@apple.com> 2 3 We should OSR exit with Int52Overflow when we fail to make an Int52 where we expect one. 4 https://bugs.webkit.org/show_bug.cgi?id=153379 5 6 Reviewed by Filip Pizlo. 7 8 In DFG::Graph::addShouldSpeculateMachineInt(), we check 9 !hasExitSite(add, Int52Overflow) when determining whether it's ok to speculate 10 that an operand is of type Int52 or not. However, the Int52Rep code that 11 converts a double to Int52 will OSR exit with exit kind BadType instead. 12 This renders the hasExitSite() check in addShouldSpeculateMachineInt() useless. 13 This patch fixes this by changing Int52Rep to OSR exit with exit kind 14 Int52Overflow instead when it fails to convert a double to an Int52. 15 16 * dfg/DFGSpeculativeJIT.cpp: 17 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): 18 (JSC::DFG::SpeculativeJIT::typeCheck): 19 (JSC::DFG::SpeculativeJIT::usedRegisters): 20 * dfg/DFGSpeculativeJIT.h: 21 (JSC::DFG::SpeculativeJIT::needsTypeCheck): 22 (JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure): 23 * dfg/DFGSpeculativeJIT64.cpp: 24 (JSC::DFG::SpeculativeJIT::compile): 25 * ftl/FTLLowerDFGToLLVM.cpp: 26 (JSC::FTL::DFG::LowerDFGToLLVM::typeCheck): 27 (JSC::FTL::DFG::LowerDFGToLLVM::appendTypeCheck): 28 (JSC::FTL::DFG::LowerDFGToLLVM::doubleToStrictInt52): 29 1 30 2016-01-22 Saam barati <sbarati@apple.com> 2 31 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r194996 r195488 299 299 } 300 300 301 void SpeculativeJIT::typeCheck(JSValueSource source, Edge edge, SpeculatedType typesPassedThrough, MacroAssembler::Jump jumpToFail )301 void SpeculativeJIT::typeCheck(JSValueSource source, Edge edge, SpeculatedType typesPassedThrough, MacroAssembler::Jump jumpToFail, ExitKind exitKind) 302 302 { 303 303 ASSERT(needsTypeCheck(edge, typesPassedThrough)); 304 304 m_interpreter.filter(edge, typesPassedThrough); 305 speculationCheck( BadType, source, edge.node(), jumpToFail);305 speculationCheck(exitKind, source, edge.node(), jumpToFail); 306 306 } 307 307 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r194996 r195488 2448 2448 // Helpers for performing type checks on an edge stored in the given registers. 2449 2449 bool needsTypeCheck(Edge edge, SpeculatedType typesPassedThrough) { return m_interpreter.needsTypeCheck(edge, typesPassedThrough); } 2450 void typeCheck(JSValueSource, Edge, SpeculatedType typesPassedThrough, MacroAssembler::Jump jumpToFail );2450 void typeCheck(JSValueSource, Edge, SpeculatedType typesPassedThrough, MacroAssembler::Jump jumpToFail, ExitKind = BadType); 2451 2451 2452 2452 void speculateCellTypeWithoutTypeFiltering(Edge, GPRReg cellGPR, JSType); … … 3380 3380 } 3381 3381 3382 #define DFG_TYPE_CHECK (source, edge, typesPassedThrough, jumpToFail) do { \3382 #define DFG_TYPE_CHECK_WITH_EXIT_KIND(exitKind, source, edge, typesPassedThrough, jumpToFail) do { \ 3383 3383 JSValueSource _dtc_source = (source); \ 3384 3384 Edge _dtc_edge = (edge); \ … … 3386 3386 if (!needsTypeCheck(_dtc_edge, _dtc_typesPassedThrough)) \ 3387 3387 break; \ 3388 typeCheck(_dtc_source, _dtc_edge, _dtc_typesPassedThrough, (jumpToFail) ); \3388 typeCheck(_dtc_source, _dtc_edge, _dtc_typesPassedThrough, (jumpToFail), exitKind); \ 3389 3389 } while (0) 3390 3390 3391 #define DFG_TYPE_CHECK(source, edge, typesPassedThrough, jumpToFail) \ 3392 DFG_TYPE_CHECK_WITH_EXIT_KIND(BadType, source, edge, typesPassedThrough, jumpToFail) 3393 3391 3394 } } // namespace JSC::DFG 3392 3395 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r194863 r195488 2212 2212 callOperation(operationConvertDoubleToInt52, resultGPR, valueFPR); 2213 2213 2214 DFG_TYPE_CHECK (2214 DFG_TYPE_CHECK_WITH_EXIT_KIND(Int52Overflow, 2215 2215 JSValueRegs(), node->child1(), SpecInt52AsDouble, 2216 2216 m_jit.branch64( -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r195298 r195488 110 110 // Using this instead of typeCheck() helps to reduce the load on LLVM, by creating 111 111 // significantly less dead code. 112 #define FTL_TYPE_CHECK (lowValue, highValue, typesPassedThrough, failCondition) do { \112 #define FTL_TYPE_CHECK_WITH_EXIT_KIND(exitKind, lowValue, highValue, typesPassedThrough, failCondition) do { \ 113 113 FormattedValue _ftc_lowValue = (lowValue); \ 114 114 Edge _ftc_highValue = (highValue); \ … … 116 116 if (!m_interpreter.needsTypeCheck(_ftc_highValue, _ftc_typesPassedThrough)) \ 117 117 break; \ 118 typeCheck(_ftc_lowValue, _ftc_highValue, _ftc_typesPassedThrough, (failCondition) ); \118 typeCheck(_ftc_lowValue, _ftc_highValue, _ftc_typesPassedThrough, (failCondition), exitKind); \ 119 119 } while (false) 120 121 #define FTL_TYPE_CHECK(lowValue, highValue, typesPassedThrough, failCondition) \ 122 FTL_TYPE_CHECK_WITH_EXIT_KIND(BadType, lowValue, highValue, typesPassedThrough, failCondition) 120 123 121 124 class LowerDFGToLLVM { … … 8975 8978 void typeCheck( 8976 8979 FormattedValue lowValue, Edge highValue, SpeculatedType typesPassedThrough, 8977 LValue failCondition )8978 { 8979 appendTypeCheck(lowValue, highValue, typesPassedThrough, failCondition );8980 LValue failCondition, ExitKind exitKind = BadType) 8981 { 8982 appendTypeCheck(lowValue, highValue, typesPassedThrough, failCondition, exitKind); 8980 8983 } 8981 8984 8982 8985 void appendTypeCheck( 8983 8986 FormattedValue lowValue, Edge highValue, SpeculatedType typesPassedThrough, 8984 LValue failCondition )8987 LValue failCondition, ExitKind exitKind) 8985 8988 { 8986 8989 if (!m_interpreter.needsTypeCheck(highValue, typesPassedThrough)) 8987 8990 return; 8988 8991 ASSERT(mayHaveTypeCheck(highValue.useKind())); 8989 appendOSRExit( BadType, lowValue, highValue.node(), failCondition, m_origin);8992 appendOSRExit(exitKind, lowValue, highValue.node(), failCondition, m_origin); 8990 8993 m_interpreter.filter(highValue, typesPassedThrough); 8991 8994 } … … 9400 9403 LValue possibleResult = m_out.call( 9401 9404 m_out.int64, m_out.operation(operationConvertDoubleToInt52), value); 9402 FTL_TYPE_CHECK (9405 FTL_TYPE_CHECK_WITH_EXIT_KIND(Int52Overflow, 9403 9406 doubleValue(value), edge, SpecInt52AsDouble, 9404 9407 m_out.equal(possibleResult, m_out.constInt64(JSValue::notInt52)));
Note: See TracChangeset
for help on using the changeset viewer.