Changeset 284690 in webkit
- Timestamp:
- Oct 22, 2021, 9:36:49 AM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
bytecompiler/BytecodeGenerator.cpp (modified) (2 diffs)
-
bytecompiler/BytecodeGenerator.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r284668 r284690 1 2021-10-22 Robin Morisset <rmorisset@apple.com> 2 3 --reportBytecodeCompileTimes=1 should correctly report the bytecode size 4 https://bugs.webkit.org/show_bug.cgi?id=232118 5 6 Reviewed by Michael Saboff. 7 8 generate() calls m_writer.finalize() which moves m_instructions, so when we later query its size we get 0. 9 The solution is simply to put the size in an out-parameter just before calling finalize(). 10 11 * bytecompiler/BytecodeGenerator.cpp: 12 (JSC::BytecodeGenerator::generate): 13 * bytecompiler/BytecodeGenerator.h: 14 (JSC::BytecodeGenerator::generate): 15 1 16 2021-10-22 Mark Lam <mark.lam@apple.com> 2 17 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r283168 r284690 149 149 } 150 150 151 ParserError BytecodeGenerator::generate( )151 ParserError BytecodeGenerator::generate(unsigned& size) 152 152 { 153 153 if (UNLIKELY(m_outOfMemoryDuringConstruction)) … … 286 286 287 287 RELEASE_ASSERT(m_codeBlock->numCalleeLocals() < static_cast<unsigned>(FirstConstantRegisterIndex)); 288 size = instructions().size(); 288 289 m_codeBlock->finalize(m_writer.finalize()); 289 290 if (m_expressionTooDeep) -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r284435 r284690 385 385 DeferGC deferGC(vm.heap); 386 386 auto bytecodeGenerator = makeUnique<BytecodeGenerator>(vm, node, unlinkedCodeBlock, codeGenerationMode, parentScopeTDZVariables, privateNameEnvironment); 387 auto result = bytecodeGenerator->generate(); 387 unsigned size; 388 auto result = bytecodeGenerator->generate(size); 388 389 389 390 if (UNLIKELY(Options::reportBytecodeCompileTimes())) { 390 391 MonotonicTime after = MonotonicTime::now(); 391 dataLogLn(result.isValid() ? "Failed to compile #" : "Compiled #", CodeBlockHash(sourceCode, unlinkedCodeBlock->isConstructor() ? CodeForConstruct : CodeForCall), " into bytecode ", bytecodeGenerator->instructions().size(), " instructions in ", (after - before).milliseconds(), " ms.");392 dataLogLn(result.isValid() ? "Failed to compile #" : "Compiled #", CodeBlockHash(sourceCode, unlinkedCodeBlock->isConstructor() ? CodeForConstruct : CodeForCall), " into bytecode ", size, " instructions in ", (after - before).milliseconds(), " ms."); 392 393 } 393 394 return result; … … 1075 1076 1076 1077 private: 1077 ParserError generate( );1078 ParserError generate(unsigned&); 1078 1079 Variable variableForLocalEntry(const Identifier&, const SymbolTableEntry&, int symbolTableConstantIndex, bool isLexicallyScoped); 1079 1080
Note:
See TracChangeset
for help on using the changeset viewer.