Changeset 244287 in webkit
- Timestamp:
- Apr 15, 2019 1:44:33 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r244286 r244287 1 2019-04-15 Saam barati <sbarati@apple.com> 2 3 mergeOSREntryValue is wrong when the incoming value does not match up with the flush format 4 https://bugs.webkit.org/show_bug.cgi?id=196918 5 6 Reviewed by Yusuke Suzuki. 7 8 r244238 lead to some debug failures because we were calling checkConsistency() 9 before doing fixTypeForRepresentation when merging in must handle values in 10 CFA. This patch fixes that. 11 12 However, as I was reading over mergeOSREntryValue, I realized it was wrong. It 13 was possible it could merge in a value/type outside of the variable's flushed type. 14 Once the flush format types are locked in, we can't introduce a type out of 15 that range. This probably never lead to any crashes as our profiling injection 16 and speculation decision code is solid. However, what we were doing is clearly 17 wrong, and something a fuzzer could have found if we fuzzed the must handle 18 values inside prediction injection. We should do that fuzzing: 19 https://bugs.webkit.org/show_bug.cgi?id=196924 20 21 * dfg/DFGAbstractValue.cpp: 22 (JSC::DFG::AbstractValue::mergeOSREntryValue): 23 * dfg/DFGAbstractValue.h: 24 * dfg/DFGCFAPhase.cpp: 25 (JSC::DFG::CFAPhase::injectOSR): 26 1 27 2019-04-15 Robin Morisset <rmorisset@apple.com> 2 28 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp
r244079 r244287 181 181 } 182 182 183 bool AbstractValue::mergeOSREntryValue(Graph& graph, JSValue value) 184 { 183 bool AbstractValue::mergeOSREntryValue(Graph& graph, JSValue value, VariableAccessData* variable, Node* node) 184 { 185 FlushFormat flushFormat = variable->flushFormat(); 186 187 { 188 if (flushFormat == FlushedDouble && value.isNumber()) 189 value = jsDoubleNumber(value.asNumber()); 190 SpeculatedType incomingType = resultFor(flushFormat) == NodeResultInt52 ? int52AwareSpeculationFromValue(value) : speculationFromValue(value); 191 SpeculatedType requiredType = typeFilterFor(flushFormat); 192 if (incomingType & ~requiredType) 193 return false; 194 } 195 185 196 AbstractValue oldMe = *this; 186 197 … … 208 219 } 209 220 210 checkConsistency();211 221 assertIsRegistered(graph); 222 223 fixTypeForRepresentation(graph, resultFor(flushFormat), node); 224 225 checkConsistency(); 212 226 213 227 return oldMe != *this; -
trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.h
r244185 r244287 49 49 class Graph; 50 50 struct Node; 51 class VariableAccessData; 51 52 52 53 struct AbstractValue { … … 304 305 } 305 306 306 bool mergeOSREntryValue(Graph&, JSValue );307 bool mergeOSREntryValue(Graph&, JSValue, VariableAccessData*, Node*); 307 308 308 309 void merge(SpeculatedType type) -
trunk/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp
r244088 r244287 189 189 190 190 AbstractValue& target = block->valuesAtHead.operand(operand); 191 changed |= target.mergeOSREntryValue(m_graph, value.value()); 192 target.fixTypeForRepresentation( 193 m_graph, resultFor(node->variableAccessData()->flushFormat()), node); 191 changed |= target.mergeOSREntryValue(m_graph, value.value(), node->variableAccessData(), node); 194 192 } 195 193
Note: See TracChangeset
for help on using the changeset viewer.