Changeset 239009 in webkit
- Timestamp:
- Dec 8, 2018 6:57:51 AM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r238997 r239009 1 2018-12-08 Dominik Infuehr <dinfuehr@igalia.com> 2 3 Record right offset with aligned wide instructions 4 https://bugs.webkit.org/show_bug.cgi?id=192006 5 6 Reviewed by Yusuke Suzuki. 7 8 Aligning bytecode instructions inserts nops into the instruction stream. 9 Emitting an instruction did not record the actual start of the instruction with 10 aligned instructions, but the nop just before the actual instruction. This was 11 problematic with the StaticPropertyAnalyzer that used the wrong instruction offset. 12 13 * bytecode/InstructionStream.h: 14 (JSC::InstructionStream::MutableRef::clone): 15 * bytecompiler/BytecodeGenerator.cpp: 16 (JSC::BytecodeGenerator::alignWideOpcode): 17 (JSC::BytecodeGenerator::emitCreateThis): 18 (JSC::BytecodeGenerator::emitNewObject): 19 * generator/Opcode.rb: 20 1 21 2018-12-07 Tadeu Zagallo <tzagallo@apple.com> 2 22 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r238543 r239009 1324 1324 { 1325 1325 #if CPU(NEEDS_ALIGNED_ACCESS) 1326 OpcodeID lastOpcodeID = m_lastOpcodeID;1327 m_lastOpcodeID = op_end;1328 1326 while ((m_writer.position() + 1) % OpcodeSize::Wide) 1329 1327 OpNop::emit<OpcodeSize::Narrow>(this); 1330 recordOpcode(lastOpcodeID);1331 1328 #endif 1332 1329 } … … 2785 2782 RegisterID* BytecodeGenerator::emitCreateThis(RegisterID* dst) 2786 2783 { 2787 m_staticPropertyAnalyzer.createThis(dst, m_writer.ref());2788 2789 2784 OpCreateThis::emit(this, dst, dst, 0); 2785 m_staticPropertyAnalyzer.createThis(dst, m_lastInstruction); 2786 2790 2787 m_codeBlock->addPropertyAccessInstruction(m_lastInstruction.offset()); 2791 2788 return dst; … … 2894 2891 RegisterID* BytecodeGenerator::emitNewObject(RegisterID* dst) 2895 2892 { 2896 m_staticPropertyAnalyzer.newObject(dst, m_writer.ref());2897 2898 2893 OpNewObject::emit(this, dst, 0); 2894 m_staticPropertyAnalyzer.newObject(dst, m_lastInstruction); 2895 2899 2896 return dst; 2900 2897 } -
trunk/Source/JavaScriptCore/bytecompiler/StaticPropertyAnalyzer.h
r237547 r239009 36 36 class StaticPropertyAnalyzer { 37 37 public: 38 void createThis(RegisterID* dst, InstructionStream::MutableRef &&instructionRef);39 void newObject(RegisterID* dst, InstructionStream::MutableRef &&instructionRef);38 void createThis(RegisterID* dst, InstructionStream::MutableRef instructionRef); 39 void newObject(RegisterID* dst, InstructionStream::MutableRef instructionRef); 40 40 void putById(RegisterID* dst, unsigned propertyIndex); // propertyIndex is an index into a uniqued set of strings. 41 41 void mov(RegisterID* dst, RegisterID* src); … … 51 51 }; 52 52 53 inline void StaticPropertyAnalyzer::createThis(RegisterID* dst, InstructionStream::MutableRef &&instructionRef)53 inline void StaticPropertyAnalyzer::createThis(RegisterID* dst, InstructionStream::MutableRef instructionRef) 54 54 { 55 55 AnalysisMap::AddResult addResult = m_analyses.add( … … 58 58 } 59 59 60 inline void StaticPropertyAnalyzer::newObject(RegisterID* dst, InstructionStream::MutableRef &&instructionRef)60 inline void StaticPropertyAnalyzer::newObject(RegisterID* dst, InstructionStream::MutableRef instructionRef) 61 61 { 62 62 RefPtr<StaticPropertyAnalysis> analysis = StaticPropertyAnalysis::create(WTFMove(instructionRef)); -
trunk/Source/JavaScriptCore/generator/Opcode.rb
r238804 r239009 115 115 static void emit(BytecodeGenerator* gen#{typed_args}) 116 116 { 117 gen->recordOpcode(opcodeID);#{@metadata.create_emitter_local}118 emit<OpcodeSize::Narrow, NoAssert, false>(gen#{untyped_args}#{metadata_arg})119 || emit<OpcodeSize::Wide, Assert, false>(gen#{untyped_args}#{metadata_arg});117 #{@metadata.create_emitter_local} 118 emit<OpcodeSize::Narrow, NoAssert, true>(gen#{untyped_args}#{metadata_arg}) 119 || emit<OpcodeSize::Wide, Assert, true>(gen#{untyped_args}#{metadata_arg}); 120 120 } 121 121 #{%{ … … 129 129 static bool emit(BytecodeGenerator* gen#{typed_args}#{metadata_param}) 130 130 { 131 if (recordOpcode) 132 gen->recordOpcode(opcodeID); 133 bool didEmit = emitImpl<size>(gen#{untyped_args}#{metadata_arg}); 131 bool didEmit = emitImpl<size, recordOpcode>(gen#{untyped_args}#{metadata_arg}); 134 132 if (shouldAssert == Assert) 135 133 ASSERT(didEmit); … … 138 136 139 137 private: 140 template<OpcodeSize size >138 template<OpcodeSize size, bool recordOpcode> 141 139 static bool emitImpl(BytecodeGenerator* gen#{typed_args}#{metadata_param}) 142 140 { … … 145 143 if (#{map_fields_with_size("", "size", &:fits_check).join "\n && "} 146 144 && (size == OpcodeSize::Wide ? #{op_wide.fits_check(Size::Narrow)} : true)) { 145 if (recordOpcode) 146 gen->recordOpcode(opcodeID); 147 147 if (size == OpcodeSize::Wide) 148 148 #{op_wide.fits_write Size::Narrow}
Note: See TracChangeset
for help on using the changeset viewer.