Changeset 103292 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Dec 19, 2011, 6:42:06 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r103287 r103292 1 2011-12-19 Filip Pizlo <[email protected]> 2 3 If we detect that we can use the JIT, don't use computed opcode lookups 4 https://bugs.webkit.org/show_bug.cgi?id=74899 5 <rdar://problem/10604551> 6 7 Reviewed by Gavin Barraclough. 8 9 * interpreter/Interpreter.cpp: 10 (JSC::Interpreter::Interpreter): 11 (JSC::Interpreter::initialize): 12 (JSC::Interpreter::privateExecute): 13 * interpreter/Interpreter.h: 14 (JSC::Interpreter::getOpcode): 15 (JSC::Interpreter::getOpcodeID): 16 * runtime/JSGlobalData.cpp: 17 (JSC::JSGlobalData::JSGlobalData): 18 1 19 2011-12-19 Geoffrey Garen <[email protected]> 2 20 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r103083 r103292 541 541 : m_sampleEntryDepth(0) 542 542 , m_reentryDepth(0) 543 #if !ASSERT_DISABLED 544 , m_initialized(false) 545 #endif 546 , m_enabled(false) 547 { 548 } 549 550 void Interpreter::initialize(bool canUseJIT) 543 551 { 544 552 #if ENABLE(COMPUTED_GOTO_INTERPRETER) 545 privateExecute(InitializeAndReturn, 0, 0); 546 547 for (int i = 0; i < numOpcodeIDs; ++i) 548 m_opcodeIDTable.add(m_opcodeTable[i], static_cast<OpcodeID>(i)); 553 if (canUseJIT) { 554 // If the JIT is present, don't use jump destinations for opcodes. 555 556 for (int i = 0; i < numOpcodeIDs; ++i) { 557 Opcode opcode = bitwise_cast<void*>(static_cast<uintptr_t>(i)); 558 m_opcodeTable[i] = opcode; 559 m_opcodeIDTable.add(opcode, static_cast<OpcodeID>(i)); 560 } 561 } else { 562 privateExecute(InitializeAndReturn, 0, 0); 563 564 for (int i = 0; i < numOpcodeIDs; ++i) 565 m_opcodeIDTable.add(m_opcodeTable[i], static_cast<OpcodeID>(i)); 566 567 m_enabled = true; 568 } 569 #else 570 UNUSED_PARAM(canUseJIT); 571 #if ENABLE(INTERPRETER) 572 m_enabled = true; 573 #else 574 m_enabled = false; 575 #endif 549 576 #endif // ENABLE(COMPUTED_GOTO_INTERPRETER) 577 #if !ASSERT_DISABLED 578 m_initialized = true; 579 #endif 550 580 551 581 #if ENABLE(OPCODE_SAMPLING) … … 1654 1684 } 1655 1685 1686 ASSERT(m_initialized); 1687 ASSERT(m_enabled); 1688 1656 1689 #if ENABLE(JIT) 1657 1690 #if ENABLE(INTERPRETER) -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r102545 r103292 95 95 public: 96 96 Interpreter(); 97 98 void initialize(bool canUseJIT); 97 99 98 100 RegisterFile& registerFile() { return m_registerFile; } … … 100 102 Opcode getOpcode(OpcodeID id) 101 103 { 102 #if ENABLE(COMPUTED_GOTO_INTERPRETER) 103 return m_opcodeTable[id]; 104 #else 105 return id; 106 #endif 104 ASSERT(m_initialized); 105 #if ENABLE(COMPUTED_GOTO_INTERPRETER) 106 return m_opcodeTable[id]; 107 #else 108 return id; 109 #endif 107 110 } 108 111 109 112 OpcodeID getOpcodeID(Opcode opcode) 110 113 { 111 #if ENABLE(COMPUTED_GOTO_INTERPRETER) 112 ASSERT(isOpcode(opcode)); 113 return m_opcodeIDTable.get(opcode); 114 #else 115 return opcode; 116 #endif 114 ASSERT(m_initialized); 115 #if ENABLE(COMPUTED_GOTO_INTERPRETER) 116 ASSERT(isOpcode(opcode)); 117 if (!m_enabled) { 118 OpcodeID result = static_cast<OpcodeID>(bitwise_cast<uintptr_t>(opcode)); 119 ASSERT(result == m_opcodeIDTable.get(opcode)); 120 return result; 121 } 122 return m_opcodeIDTable.get(opcode); 123 #else 124 return opcode; 125 #endif 117 126 } 118 127 … … 187 196 HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling 188 197 #endif 198 199 #if !ASSERT_DISABLED 200 bool m_initialized; 201 #endif 202 bool m_enabled; 189 203 }; 190 204 -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r103083 r103292 228 228 #endif 229 229 230 interpreter->initialize(this->canUseJIT()); 231 230 232 heap.notifyIsSafeToCollect(); 231 233 }
Note:
See TracChangeset
for help on using the changeset viewer.