Changeset 170109 in webkit
- Timestamp:
- Jun 18, 2014 11:57:12 AM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r170107 r170109 1 2014-06-18 Mark Lam <mark.lam@apple.com> 2 3 DFGGraph::m_doubleConstantMap will not map 0 values correctly. 4 <https://webkit.org/b/133994> 5 6 Reviewed by Geoffrey Garen. 7 8 DFGGraph::m_doubleConstantsMap should not use a double as a key to its HashMap, 9 because it means two unfortunate things: 10 - It will probably break for zero. 11 - It will think that -0 is the same as +0 under some circumstances, size 12 -0==+0 even though they are distinct values (for example 1/-0 != 1/+0). 13 14 The fix is to use std::unordered_map which does not require special empty 15 and deleted values, and to use the raw bits instead of the double value as 16 the key. 17 18 * dfg/DFGGraph.h: 19 * dfg/DFGJITCompiler.cpp: 20 (JSC::DFG::JITCompiler::addressOfDoubleConstant): 21 1 22 2014-06-18 Alex Christensen <achristensen@webkit.org> 2 23 -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r170086 r170109 42 42 #include "JSStack.h" 43 43 #include "MethodOfGettingAValueProfile.h" 44 #include <unordered_map> 44 45 #include <wtf/BitVector.h> 45 46 #include <wtf/HashMap.h> … … 855 856 856 857 #if USE(JSVALUE32_64) 857 HashMap<double, double*> m_doubleConstantsMap;858 std::unordered_map<int64_t, double*> m_doubleConstantsMap; 858 859 std::unique_ptr<Bag<double>> m_doubleConstants; 859 860 #endif -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r170086 r170109 445 445 446 446 double value = jsvalue.asDouble(); 447 auto it = m_graph.m_doubleConstantsMap.find(value); 447 int64_t valueBits = bitwise_cast<int64_t>(value); 448 auto it = m_graph.m_doubleConstantsMap.find(valueBits); 448 449 if (it != m_graph.m_doubleConstantsMap.end()) 449 return it-> value;450 return it->second; 450 451 451 452 if (!m_graph.m_doubleConstants) … … 454 455 double* addressInConstantPool = m_graph.m_doubleConstants->add(); 455 456 *addressInConstantPool = value; 456 m_graph.m_doubleConstantsMap .add(value, addressInConstantPool);457 m_graph.m_doubleConstantsMap[valueBits] = addressInConstantPool; 457 458 return addressInConstantPool; 458 459 }
Note: See TracChangeset
for help on using the changeset viewer.