Changeset 166440 in webkit
- Timestamp:
- Mar 28, 2014 5:37:10 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r166439 r166440 1 2014-03-28 Mark Lam <mark.lam@apple.com> 2 3 mandreel throws a checksum error on 32-bit x86. 4 <https://webkit.org/b/125706> 5 6 Reviewed by Filip Pizlo. 7 8 The 32-bit DFG can emit code that loads double constants from its 9 CodeBlock's m_constantRegisters vector. The emitted instruction will 10 embed the address of the constant from the vector's backing store. 11 Subsequently, while inserting new constants, the DFG may resize the 12 vector, thereby reallocating the backing store. This renders the 13 previously embedded constant addresses stale. 14 15 The fix is to use a dedicated doubles constant pool stored in the DFG 16 CommonData instead. This constant pool won't be reallocated, and 17 hence will not manifest this issue. 18 19 * dfg/DFGCommonData.h: 20 * dfg/DFGGraph.h: 21 * dfg/DFGJITCompiler.cpp: 22 (JSC::DFG::JITCompiler::link): 23 (JSC::DFG::JITCompiler::addressOfDoubleConstant): 24 * dfg/DFGJITCompiler.h: 25 (JSC::DFG::JITCompiler::addressOfDoubleConstant): Deleted. 26 1 27 2014-03-28 Joseph Pecoraro <pecoraro@apple.com> 2 28 -
trunk/Source/JavaScriptCore/dfg/DFGCommonData.h
r164424 r166440 36 36 #include "ProfilerCompilation.h" 37 37 #include "SymbolTable.h" 38 #include <wtf/Bag.h> 38 39 #include <wtf/Noncopyable.h> 39 40 … … 106 107 int machineCaptureStart; 107 108 std::unique_ptr<SlowArgument[]> slowArguments; 109 110 #if USE(JSVALUE32_64) 111 std::unique_ptr<Bag<double>> doubleConstants; 112 #endif 108 113 109 114 unsigned frameRegisterCount; -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r165995 r166440 847 847 int m_machineCaptureStart; 848 848 std::unique_ptr<SlowArgument[]> m_slowArguments; 849 850 #if USE(JSVALUE32_64) 851 HashMap<double, double*> m_doubleConstantsMap; 852 std::unique_ptr<Bag<double>> m_doubleConstants; 853 #endif 849 854 850 855 OptimizationFixpointState m_fixpointState; -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r166135 r166440 160 160 m_jitCode->common.slowArguments = std::move(m_graph.m_slowArguments); 161 161 162 #if USE(JSVALUE32_64) 163 m_jitCode->common.doubleConstants = std::move(m_graph.m_doubleConstants); 164 #endif 165 162 166 BitVector usedJumpTables; 163 167 for (Bag<SwitchData>::iterator iter = m_graph.m_switchData.begin(); !!iter; ++iter) { … … 433 437 } 434 438 439 #if USE(JSVALUE32_64) 440 void* JITCompiler::addressOfDoubleConstant(Node* node) 441 { 442 ASSERT(m_graph.isNumberConstant(node)); 443 JSValue jsvalue = node->valueOfJSConstant(codeBlock()); 444 ASSERT(jsvalue.isDouble()); 445 446 double value = jsvalue.asDouble(); 447 auto it = m_graph.m_doubleConstantsMap.find(value); 448 if (it != m_graph.m_doubleConstantsMap.end()) 449 return it->value; 450 451 if (!m_graph.m_doubleConstants) 452 m_graph.m_doubleConstants = std::make_unique<Bag<double>>(); 453 454 double* addressInConstantPool = m_graph.m_doubleConstants->add(); 455 *addressInConstantPool = value; 456 m_graph.m_doubleConstantsMap.add(value, addressInConstantPool); 457 return addressInConstantPool; 458 } 459 #endif 460 435 461 } } // namespace JSC::DFG 436 462 -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h
r166135 r166440 199 199 200 200 #if USE(JSVALUE32_64) 201 void* addressOfDoubleConstant(Node* node) 202 { 203 ASSERT(m_graph.isNumberConstant(node)); 204 unsigned constantIndex = node->constantNumber(); 205 return &(codeBlock()->constantRegister(FirstConstantRegisterIndex + constantIndex)); 206 } 201 void* addressOfDoubleConstant(Node*); 207 202 #endif 208 203
Note: See TracChangeset
for help on using the changeset viewer.