Ignore:
Timestamp:
Sep 22, 2017, 7:08:04 PM (8 years ago)
Author:
[email protected]
Message:

Speculatively change iteration protocall to use the same next function
https://bugs.webkit.org/show_bug.cgi?id=175653

Reviewed by Saam Barati.

JSTests:

Change test to match the new iteration behavior.

  • stress/spread-optimized-properly.js:

Source/JavaScriptCore:

This patch speculatively makes a change to the iteration protocall to fetch the next
property immediately after calling the Symbol.iterator function. This is, in theory,
a breaking change, so we will see if this breaks things (most likely it won't as this
is a relatively subtle point).

See: https://github.com/tc39/ecma262/issues/976

  • builtins/IteratorHelpers.js:

(performIteration):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitEnumeration):
(JSC::BytecodeGenerator::emitIteratorNext):
(JSC::BytecodeGenerator::emitIteratorNextWithValue):
(JSC::BytecodeGenerator::emitDelegateYield):

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::ArrayPatternNode::bindValue const):

  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::iteratorEntries):

  • runtime/IteratorOperations.cpp:

(JSC::iteratorNext):
(JSC::iteratorStep):
(JSC::iteratorClose):
(JSC::iteratorForIterable):

  • runtime/IteratorOperations.h:

(JSC::forEachInIterable):

  • runtime/JSGenericTypedArrayViewConstructorInlines.h:

(JSC::constructGenericTypedArrayViewFromIterator):
(JSC::constructGenericTypedArrayViewWithArguments):

LayoutTests:

Change test to match the new iteration behavior.

  • js/sequence-iterator-protocol-2-expected.txt:
  • js/sequence-iterator-protocol-2.html:
File:
1 edited

Legend:

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

    r222115 r222421  
    39453945        generator.emitCall(iterator.get(), iterator.get(), NoExpectedFunction, args, divot(), divotStart(), divotEnd(), DebuggableCall::No);
    39463946    }
     3947    RefPtr<RegisterID> nextMethod = generator.emitGetById(generator.newTemporary(), iterator.get(), generator.propertyNames().next);
    39473948
    39483949    if (m_targetPatterns.isEmpty()) {
     
    39633964
    39643965            RefPtr<RegisterID> value = generator.newTemporary();
    3965             generator.emitIteratorNext(value.get(), iterator.get(), this);
     3966            generator.emitIteratorNext(value.get(), nextMethod.get(), iterator.get(), this);
    39663967            generator.emitGetById(done.get(), value.get(), generator.propertyNames().done);
    39673968            generator.emitJumpIfTrue(done.get(), iterationSkipped.get());
     
    39994000
    40004001            RefPtr<RegisterID> value = generator.newTemporary();
    4001             generator.emitIteratorNext(value.get(), iterator.get(), this);
     4002            generator.emitIteratorNext(value.get(), nextMethod.get(), iterator.get(), this);
    40024003            generator.emitGetById(done.get(), value.get(), generator.propertyNames().done);
    40034004            generator.emitJumpIfTrue(done.get(), iterationDone.get());
Note: See TracChangeset for help on using the changeset viewer.