⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 281485 in webkit


Ignore:
Timestamp:
Aug 23, 2021, 7:59:56 PM (5 years ago)
Author:
sbarati@apple.com
Message:

Disable peephole optimizations in the byte code generator after rewriting instructions for for-in
https://bugs.webkit.org/show_bug.cgi?id=229420
<rdar://82020528>

Reviewed by Keith Miller.

JSTests:

  • stress/for-in-disable-bytecode-generator-peephole-optimizations-after-rewrite.js: Added.

(foo):

Source/JavaScriptCore:

The final instruction in a for-in loop might be the get by val that
we're rewriting because there was an escape. We won't ever actually
do peephole optimizations on this get_by_val today, but it breaks
some bookkeeping that the bytecode generator does. This patch makes
sure the bookkeeping is up to date.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::ForInContext::finalize):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r281473 r281485  
     12021-08-23  Saam Barati  <sbarati@apple.com>
     2
     3        Disable peephole optimizations in the byte code generator after rewriting instructions for for-in
     4        https://bugs.webkit.org/show_bug.cgi?id=229420
     5        <rdar://82020528>
     6
     7        Reviewed by Keith Miller.
     8
     9        * stress/for-in-disable-bytecode-generator-peephole-optimizations-after-rewrite.js: Added.
     10        (foo):
     11
    1122021-08-23  Saam Barati  <sbarati@apple.com>
    213
  • trunk/Source/JavaScriptCore/ChangeLog

    r281473 r281485  
     12021-08-23  Saam Barati  <sbarati@apple.com>
     2
     3        Disable peephole optimizations in the byte code generator after rewriting instructions for for-in
     4        https://bugs.webkit.org/show_bug.cgi?id=229420
     5        <rdar://82020528>
     6
     7        Reviewed by Keith Miller.
     8
     9        The final instruction in a for-in loop might be the get by val that
     10        we're rewriting because there was an escape. We won't ever actually
     11        do peephole optimizations on this get_by_val today, but it breaks
     12        some bookkeeping that the bytecode generator does. This patch makes
     13        sure the bookkeeping is up to date.
     14
     15        * bytecompiler/BytecodeGenerator.cpp:
     16        (JSC::ForInContext::finalize):
     17
    1182021-08-23  Saam Barati  <sbarati@apple.com>
    219
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r281429 r281485  
    53705370        return;
    53715371
    5372     OpcodeID lastOpcodeID = generator.m_lastOpcodeID;
    5373     InstructionStream::MutableRef lastInstruction = generator.m_lastInstruction;
    5374 
    53755372    for (const auto& instTuple : m_getInsts)
    53765373        rewriteOp<OpEnumeratorGetByVal, OpGetByVal>(generator, instTuple);
     
    53915388        generator.m_writer.seek(branchInstIndex);
    53925389
    5393         generator.disablePeepholeOptimization();
    5394 
    53955390        OpJmp::emit(&generator, BoundLabel(static_cast<int>(newBranchTarget) - static_cast<int>(branchInstIndex)));
    53965391
     
    53995394    }
    54005395
     5396    generator.disablePeepholeOptimization(); // We might've just changed the last bytecode that was emitted.
     5397
    54015398    generator.m_writer.seek(generator.m_writer.size());
    5402     if (generator.m_lastInstruction.offset() + generator.m_lastInstruction->size() != generator.m_writer.size()) {
    5403         generator.m_lastOpcodeID = lastOpcodeID;
    5404         generator.m_lastInstruction = lastInstruction;
    5405     }
    54065399}
    54075400
Note: See TracChangeset for help on using the changeset viewer.