Ignore:
Timestamp:
Aug 11, 2014, 11:59:44 AM (11 years ago)
Author:
[email protected]
Message:

for-in optimization should also make sure the base matches the object being iterated
https://bugs.webkit.org/show_bug.cgi?id=135782

Reviewed by Geoffrey Garen.

If we access a different base object with the same index, we shouldn't try to randomly
load from that object's backing store.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitGetByVal):
(JSC::BytecodeGenerator::pushIndexedForInScope):
(JSC::BytecodeGenerator::pushStructureForInScope):

  • bytecompiler/BytecodeGenerator.h:

(JSC::ForInContext::ForInContext):
(JSC::ForInContext::base):
(JSC::StructureForInContext::StructureForInContext):
(JSC::IndexedForInContext::IndexedForInContext):

  • bytecompiler/NodesCodegen.cpp:

(JSC::ForInNode::emitMultiLoopBytecode):

  • tests/stress/for-in-tests.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r172176 r172401  
    20452045        this->emitLoopHeader(generator, propertyName.get());
    20462046
    2047         generator.pushIndexedForInScope(local.get(), i.get());
     2047        generator.pushIndexedForInScope(base.get(), local.get(), i.get());
    20482048        generator.emitNode(dst, m_statement);
    20492049        generator.popIndexedForInScope(local.get());
     
    20792079        this->emitLoopHeader(generator, propertyName.get());
    20802080
    2081         generator.pushStructureForInScope(local.get(), i.get(), propertyName.get(), structureEnumerator.get());
     2081        generator.pushStructureForInScope(base.get(), local.get(), i.get(), propertyName.get(), structureEnumerator.get());
    20822082        generator.emitNode(dst, m_statement);
    20832083        generator.popStructureForInScope(local.get());
Note: See TracChangeset for help on using the changeset viewer.