1. 14 Oct, 2013 1 commit
    • oliver@apple.com's avatar
      Separate out array iteration intrinsics · edfb3181
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=122656
      
      Reviewed by Michael Saboff.
      
      Separate out the intrinsics for key and values iteration
      of arrays.
      
      This requires moving moving array iteration into the iterator
      instance, rather than the prototype, but this is essentially
      unobservable so we'll live with it for now.
      
      * jit/ThunkGenerators.cpp:
      (JSC::arrayIteratorNextThunkGenerator):
      (JSC::arrayIteratorNextKeyThunkGenerator):
      (JSC::arrayIteratorNextValueThunkGenerator):
      * jit/ThunkGenerators.h:
      * runtime/ArrayIteratorPrototype.cpp:
      (JSC::ArrayIteratorPrototype::finishCreation):
      * runtime/Intrinsic.h:
      * runtime/JSArrayIterator.cpp:
      (JSC::JSArrayIterator::finishCreation):
      (JSC::createIteratorResult):
      (JSC::arrayIteratorNext):
      (JSC::arrayIteratorNextKey):
      (JSC::arrayIteratorNextValue):
      (JSC::arrayIteratorNextGeneric):
      * runtime/VM.cpp:
      (JSC::thunkGeneratorForIntrinsic):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      edfb3181
  2. 11 Oct, 2013 2 commits
    • commit-queue@webkit.org's avatar
      Unreviewed, rolling out r157307. · 85404d8e
      commit-queue@webkit.org authored
      http://trac.webkit.org/changeset/157307
      https://bugs.webkit.org/show_bug.cgi?id=122671
      
      Many assertion failures (Requested by ap on #webkit).
      
      * jit/ThunkGenerators.cpp:
      (JSC::arrayIteratorNextThunkGenerator):
      * jit/ThunkGenerators.h:
      * runtime/ArrayIteratorPrototype.cpp:
      (JSC::ArrayIteratorPrototype::finishCreation):
      (JSC::createIteratorResult):
      (JSC::arrayIteratorPrototypeNext):
      * runtime/Intrinsic.h:
      * runtime/JSArrayIterator.cpp:
      (JSC::JSArrayIterator::finishCreation):
      * runtime/VM.cpp:
      (JSC::thunkGeneratorForIntrinsic):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      85404d8e
    • oliver@apple.com's avatar
      Separate out array iteration intrinsics · 9bec8d3f
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=122656
      
      Reviewed by Michael Saboff.
      
      Separate out the intrinsics for key and values iteration
      of arrays.
      
      This requires moving moving array iteration into the iterator
      instance, rather than the prototype, but this is essentially
      unobservable so we'll live with it for now.
      
      * jit/ThunkGenerators.cpp:
      (JSC::arrayIteratorNextThunkGenerator):
      (JSC::arrayIteratorNextKeyThunkGenerator):
      (JSC::arrayIteratorNextValueThunkGenerator):
      * jit/ThunkGenerators.h:
      * runtime/ArrayIteratorPrototype.cpp:
      (JSC::ArrayIteratorPrototype::finishCreation):
      * runtime/Intrinsic.h:
      * runtime/JSArrayIterator.cpp:
      (JSC::JSArrayIterator::finishCreation):
      (JSC::createIteratorResult):
      (JSC::arrayIteratorNext):
      (JSC::arrayIteratorNextKey):
      (JSC::arrayIteratorNextValue):
      (JSC::arrayIteratorNextGeneric):
      * runtime/VM.cpp:
      (JSC::thunkGeneratorForIntrinsic):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9bec8d3f
  3. 10 Oct, 2013 1 commit
    • oliver@apple.com's avatar
      Further improve ArrayIterator performance · 585c400c
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=122575
      
      Reviewed by Mark Hahnenberg.
      
      Source/JavaScriptCore:
      
      Add an assembly thunk for ArrayIterator.@@next so that we
      can avoid marshalling costs when iterating arrays.
      
      * jit/SpecializedThunkJIT.h:
      (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
      (JSC::SpecializedThunkJIT::loadSpecificClassArgument):
      * jit/ThunkGenerators.cpp:
      (JSC::arrayIteratorNextThunkGenerator):
      * jit/ThunkGenerators.h:
      * runtime/ArrayIteratorPrototype.cpp:
      (JSC::ArrayIteratorPrototype::finishCreation):
      * runtime/Intrinsic.h:
      * runtime/JSArrayIterator.h:
      (JSC::JSArrayIterator::offsetOfIterationKind):
      (JSC::JSArrayIterator::offsetOfIteratedObject):
      (JSC::JSArrayIterator::offsetOfNextIndex):
      * runtime/JSCJSValue.h:
      (JSC::JSValue::offsetOfPayload):
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      * runtime/JSGlobalObject.h:
      (JSC::JSGlobalObject::iteratorResultStructureOffset):
      * runtime/VM.cpp:
      (JSC::thunkGeneratorForIntrinsic):
      
      LayoutTests:
      
      Add a few new tests to make sure the new asm thunk correctly
      handles non-arrays.
      
      * js/array-iterators-expected.txt:
      * js/script-tests/array-iterators.js:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      585c400c
  4. 09 Oct, 2013 1 commit
    • oliver@apple.com's avatar
      Convert for-of iteration to in-band signalling so we can trivially avoid... · 393e9af9
      oliver@apple.com authored
      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):
      * runtime/JSObject.h:
      (JSC::JSFinalObject::create):
      * runtime/VM.cpp:
      (JSC::VM::VM):
      * runtime/VM.h:
      
      LayoutTests:
      
      Update tests to reflect our non-exposure of .next()
      
      * js/array-iterators-expected.txt:
      * js/script-tests/array-iterators.js:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      393e9af9
  5. 04 Oct, 2013 1 commit
    • oliver@apple.com's avatar
      Support for-of syntax · 20a9bf08
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=122339
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore:
      
      Add support for for-of syntax to JSC.  As part of doing this I had to make
      us support unique empty strings as identifiers.  In a follow on patch i'm
      going to remove the distinction entirely as it's purely a complicating
      separation.
      
      Otherwise the logic here is fairly self-explanatory.
      
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::BytecodeGenerator::addConstant):
      (JSC::BytecodeGenerator::emitCall):
      * bytecompiler/BytecodeGenerator.h:
      * bytecompiler/NodesCodegen.cpp:
      (JSC::CallArguments::CallArguments):
      (JSC::ForOfNode::emitBytecode):
      * jit/JITOperations.cpp:
      * parser/ASTBuilder.h:
      (JSC::ASTBuilder::createForOfLoop):
      * parser/NodeConstructors.h:
      (JSC::EnumerationNode::EnumerationNode):
      (JSC::ForInNode::ForInNode):
      (JSC::ForOfNode::ForOfNode):
      * parser/Nodes.h:
      * parser/Parser.cpp:
      (JSC::::parseVarDeclarationList):
      (JSC::::parseForStatement):
      * parser/Parser.h:
      (JSC::Parser::isofToken):
      * parser/SyntaxChecker.h:
      (JSC::SyntaxChecker::createForOfLoop):
      * runtime/ArrayIteratorPrototype.cpp:
      (JSC::ArrayIteratorPrototype::finishCreation):
      (JSC::arrayIteratorPrototypeIterate):
      * runtime/ArrayPrototype.cpp:
      (JSC::ArrayPrototype::create):
      (JSC::ArrayPrototype::finishCreation):
      * runtime/ArrayPrototype.h:
      * runtime/CommonIdentifiers.cpp:
      (JSC::CommonIdentifiers::CommonIdentifiers):
      * runtime/CommonIdentifiers.h:
      * runtime/Identifier.h:
      (JSC::Identifier::from):
      * runtime/JSCJSValue.cpp:
      (JSC::JSValue::dumpInContext):
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      * runtime/JSObject.cpp:
      (JSC::JSObject::putDirectNativeFunction):
      * runtime/PrivateName.h:
      (JSC::PrivateName::PrivateName):
      * runtime/PropertyName.h:
      (JSC::PropertyName::PropertyName):
      
      Source/WTF:
      
      Update assertions and add a helper function to StringImpl
      to save repeated unique or identifier calls.
      
      * wtf/text/StringImpl.h:
      (WTF::StringImpl::isIdentifierOrUnique):
      (WTF::StringImpl::setIsIdentifier):
      (WTF::StringImpl::setIsAtomic):
      
      LayoutTests:
      
      Add test cases for the one type that supports for-of so far
      
      * js/basic-for-of-expected.txt: Added.
      * js/basic-for-of.html: Added.
      * js/regress/for-of-iterate-array-entries.html: Added.
      * js/regress/for-of-iterate-array-keys.html: Added.
      * js/regress/for-of-iterate-array-values.html: Added.
      * js/regress/script-tests/for-of-iterate-array-entries.js: Added.
      (foo):
      * js/regress/script-tests/for-of-iterate-array-keys.js: Added.
      (foo):
      * js/regress/script-tests/for-of-iterate-array-values.js: Added.
      (foo):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      20a9bf08
  6. 02 Oct, 2013 1 commit
    • oliver@apple.com's avatar
      Implement Array key, value and entries iterators · 9719b8c9
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=122195
      
      Reviewed by Filip Pizlo.
      
      Source/JavaScriptCore:
      
      Add implementation of ES6 Array iterators for keys(), values() and entries()
      
      Fairly self explanatory as we just need a simple implementation so that we can
      implement and test other features.
      
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * runtime/ArrayIteratorConstructor.cpp: Added.
      (JSC::ArrayIteratorConstructor::finishCreation):
      * runtime/ArrayIteratorConstructor.h: Added.
      (JSC::ArrayIteratorConstructor::create):
      (JSC::ArrayIteratorConstructor::createStructure):
      (JSC::ArrayIteratorConstructor::ArrayIteratorConstructor):
      * runtime/ArrayIteratorPrototype.cpp: Added.
      (JSC::ArrayIteratorPrototype::finishCreation):
      (JSC::createIteratorResult):
      (JSC::arrayIteratorPrototypeNext):
      * runtime/ArrayIteratorPrototype.h: Added.
      (JSC::ArrayIteratorPrototype::create):
      (JSC::ArrayIteratorPrototype::createStructure):
      (JSC::ArrayIteratorPrototype::ArrayIteratorPrototype):
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncValues):
      (JSC::arrayProtoFuncEntries):
      (JSC::arrayProtoFuncKeys):
      * runtime/CommonIdentifiers.h:
      * runtime/Identifier.h:
      (JSC::Identifier::createEmptyUnique):
      * runtime/JSArrayIterator.cpp: Added.
      (JSC::JSArrayIterator::finishCreation):
      * runtime/JSArrayIterator.h: Added.
      (JSC::JSArrayIterator::createStructure):
      (JSC::JSArrayIterator::create):
      (JSC::JSArrayIterator::iterationKind):
      (JSC::JSArrayIterator::iteratedObject):
      (JSC::JSArrayIterator::nextIndex):
      (JSC::JSArrayIterator::setNextIndex):
      (JSC::JSArrayIterator::finish):
      (JSC::JSArrayIterator::JSArrayIterator):
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      * runtime/JSGlobalObject.h:
      (JSC::JSGlobalObject::iteratorResultStructure):
      
      LayoutTests:
      
      Add tests
      
      * js/Object-getOwnPropertyNames-expected.txt:
      * js/array-iterators-expected.txt: Added.
      * js/array-iterators.html: Added.
      * js/script-tests/Object-getOwnPropertyNames.js:
      * js/script-tests/array-iterators.js: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9719b8c9