Convert for-of iteration to in-band signalling so we can trivially avoid unnecessary object allocation
https://bugs.webkit.org/show_bug.cgi?id=122532
Reviewed by Michael Saboff.
Source/JavaScriptCore:
Switch for-of enumeration to use in band signalling to determine the end
of iteration. This allows us to trivially remove an otherwise unnecessary
object allocation, and paves the way for optimised thunks in future.
We can re-add explicit .next() functions in future that would marshall
the true iteration functions, but for now we'll ignore them.
This results in a huge improvement in the performance of for-of (in the order
of 2x) but there's still a long way to go in order to get the performance to
a satisfactory level.
- bytecompiler/NodesCodegen.cpp:
(JSC::ForOfNode::emitBytecode):
- runtime/ArrayIteratorPrototype.cpp:
(JSC::ArrayIteratorPrototype::finishCreation):
(JSC::createIteratorResult):
- runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::CommonIdentifiers):
- runtime/CommonIdentifiers.h:
- runtime/Identifier.cpp:
(JSC::Identifier::addSlowCase):
(JSC::JSFinalObject::create):
(JSC::VM::VM):
LayoutTests:
Update tests to reflect our non-exposure of .next()
- js/array-iterators-expected.txt:
- js/script-tests/array-iterators.js: