haikuwebkit/LayoutTests/js/arguments-iterator-expected...

61 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

Support iteration of the Arguments object https://bugs.webkit.org/show_bug.cgi?id=123835 Reviewed by Mark Lam. Source/JavaScriptCore: Add an ArgumentsIterator object, and associated classes so that we can support iteration of the arguments object. This is a largely mechanical patch. The only gnarliness is in the logic to avoid reifying the Arguments object in for(... of arguments) scenarios. * GNUmakefile.list.am: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitEnumeration): * runtime/Arguments.cpp: (JSC::Arguments::getOwnPropertySlot): (JSC::argumentsFuncIterator): * runtime/Arguments.h: * runtime/ArgumentsIteratorConstructor.cpp: Added. (JSC::ArgumentsIteratorConstructor::finishCreation): * runtime/ArgumentsIteratorConstructor.h: Added. (JSC::ArgumentsIteratorConstructor::create): (JSC::ArgumentsIteratorConstructor::createStructure): (JSC::ArgumentsIteratorConstructor::ArgumentsIteratorConstructor): * runtime/ArgumentsIteratorPrototype.cpp: Added. (JSC::ArgumentsIteratorPrototype::finishCreation): (JSC::argumentsIteratorPrototypeFuncIterator): (JSC::argumentsIteratorPrototypeFuncNext): * runtime/ArgumentsIteratorPrototype.h: Added. (JSC::ArgumentsIteratorPrototype::create): (JSC::ArgumentsIteratorPrototype::createStructure): (JSC::ArgumentsIteratorPrototype::ArgumentsIteratorPrototype): * runtime/CommonIdentifiers.h: * runtime/JSArgumentsIterator.cpp: Added. (JSC::JSArgumentsIterator::finishCreation): * runtime/JSArgumentsIterator.h: Added. (JSC::JSArgumentsIterator::createStructure): (JSC::JSArgumentsIterator::create): (JSC::JSArgumentsIterator::next): (JSC::JSArgumentsIterator::JSArgumentsIterator): * runtime/JSArrayIterator.cpp: (JSC::createIteratorResult): * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: LayoutTests: Add test cases * js/arguments-iterator-expected.txt: Added. * js/arguments-iterator.html: Added. * js/script-tests/arguments-iterator.js: Added. (shouldThrow.test): (testAlias): (testStrict): (testReifiedArguments): (testOverwrittenArguments): (testNullArguments): (testNonArrayLikeArguments): Canonical link: https://commits.webkit.org/142111@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-06 22:37:46 +00:00
This test checks the behavior of Arguments object iteration.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS (function (arguments) { for (var argument of arguments) {}})() threw exception TypeError: undefined is not an object (evaluating 'argument of arguments').
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
REGRESSION (r174226): Header on huffingtonpost.com is too large https://bugs.webkit.org/show_bug.cgi?id=140306 Reviewed by Filip Pizlo. Source/JavaScriptCore: BytecodeGenerator::willResolveToArguments() is used to check to see if we can use the arguments register or whether we need to resolve "arguments". If the arguments have been captured, then they are stored in the lexical environment and the arguments register is not used. Changed BytecodeGenerator::willResolveToArguments() to also check to see if the arguments register is captured. Renamed the function to willResolveToArgumentsRegister() to better indicate what we are checking. Aligned 32 and 64 bit paths in ArgumentsRecoveryGenerator::generateFor() for creating an arguments object that was optimized out of an inlined callFrame. The 32 bit path incorrectly calculated the location of the reified callee frame. This alignment resulted in the removal of operationCreateInlinedArgumentsDuringOSRExit() * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::willResolveToArgumentsRegister): (JSC::BytecodeGenerator::uncheckedLocalArgumentsRegister): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitEnumeration): (JSC::BytecodeGenerator::willResolveToArguments): Deleted. * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::BracketAccessorNode::emitBytecode): (JSC::DotAccessorNode::emitBytecode): (JSC::getArgumentByVal): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::ArrayPatternNode::emitDirectBinding): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::ArgumentsRecoveryGenerator::generateFor): * dfg/DFGOperations.cpp: (JSC::operationCreateInlinedArgumentsDuringOSRExit): Deleted. * dfg/DFGOperations.h: (JSC::operationCreateInlinedArgumentsDuringOSRExit): Deleted. LayoutTests: Updated js/arguments-iterator to test changing argument to array values. Removed tests that changed arguments to a string and an object as they were bogus and didn't test what the appeared to test. for .. of works on iterable objects only. Added new regression test, js/regress-140306. * js/arguments-iterator-expected.txt: * js/regress-140306-expected.txt: Added. * js/regress-140306.html: Added. * js/script-tests/arguments-iterator.js: (testEmptyArrayArguments): (testArrayArguments): (testOverwrittenArguments): Deleted. (testNullArguments): Deleted. (testNonArrayLikeArguments): Deleted. * js/script-tests/regress-140306.js: Added. (checkArgs): (applyToArgs): Canonical link: https://commits.webkit.org/158525@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-01-16 20:40:22 +00:00
PASS testEmptyArrayArguments('a') is true
PASS testEmptyArrayArguments() is true
Support iteration of the Arguments object https://bugs.webkit.org/show_bug.cgi?id=123835 Reviewed by Mark Lam. Source/JavaScriptCore: Add an ArgumentsIterator object, and associated classes so that we can support iteration of the arguments object. This is a largely mechanical patch. The only gnarliness is in the logic to avoid reifying the Arguments object in for(... of arguments) scenarios. * GNUmakefile.list.am: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitEnumeration): * runtime/Arguments.cpp: (JSC::Arguments::getOwnPropertySlot): (JSC::argumentsFuncIterator): * runtime/Arguments.h: * runtime/ArgumentsIteratorConstructor.cpp: Added. (JSC::ArgumentsIteratorConstructor::finishCreation): * runtime/ArgumentsIteratorConstructor.h: Added. (JSC::ArgumentsIteratorConstructor::create): (JSC::ArgumentsIteratorConstructor::createStructure): (JSC::ArgumentsIteratorConstructor::ArgumentsIteratorConstructor): * runtime/ArgumentsIteratorPrototype.cpp: Added. (JSC::ArgumentsIteratorPrototype::finishCreation): (JSC::argumentsIteratorPrototypeFuncIterator): (JSC::argumentsIteratorPrototypeFuncNext): * runtime/ArgumentsIteratorPrototype.h: Added. (JSC::ArgumentsIteratorPrototype::create): (JSC::ArgumentsIteratorPrototype::createStructure): (JSC::ArgumentsIteratorPrototype::ArgumentsIteratorPrototype): * runtime/CommonIdentifiers.h: * runtime/JSArgumentsIterator.cpp: Added. (JSC::JSArgumentsIterator::finishCreation): * runtime/JSArgumentsIterator.h: Added. (JSC::JSArgumentsIterator::createStructure): (JSC::JSArgumentsIterator::create): (JSC::JSArgumentsIterator::next): (JSC::JSArgumentsIterator::JSArgumentsIterator): * runtime/JSArrayIterator.cpp: (JSC::createIteratorResult): * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: LayoutTests: Add test cases * js/arguments-iterator-expected.txt: Added. * js/arguments-iterator.html: Added. * js/script-tests/arguments-iterator.js: Added. (shouldThrow.test): (testAlias): (testStrict): (testReifiedArguments): (testOverwrittenArguments): (testNullArguments): (testNonArrayLikeArguments): Canonical link: https://commits.webkit.org/142111@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-06 22:37:46 +00:00
PASS arg === realArg is true
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS arg === realArg is true
PASS arg === realArg is true
PASS arg === realArg is true
PASS actualArgumentsLength is iteratedArgumentsLength
PASS successfullyParsed is true
TEST COMPLETE