Unreviewed, rolling out r156464 and r156480.

http://trac.webkit.org/changeset/156464
http://trac.webkit.org/changeset/156480
https://bugs.webkit.org/show_bug.cgi?id=121981

Leaking too much and killi
ng buildbot. (Requested by xenon on
#webkit).

Source/JavaScriptCore:

* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedFunctionExecutable::paramString):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitExpressionInfo):
* bytecompiler/NodesCodegen.cpp:
(JSC::ForInNode::emitBytecode):
(JSC::FuncExprNode::emitBytecode):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createFormalParameterList):
(JSC::ASTBuilder::createForInLoop):
(JSC::ASTBuilder::addVar):
* parser/NodeConstructors.h:
(JSC::CommaNode::CommaNode):
(JSC::ParameterNode::ParameterNode):
(JSC::ForInNode::ForInNode):
* parser/Nodes.cpp:
(JSC::FunctionParameters::create):
(JSC::FunctionParameters::FunctionParameters):
(JSC::FunctionParameters::~FunctionParameters):
* parser/Nodes.h:
(JSC::CommaNode::append):
(JSC::ParameterNode::ident):
(JSC::FunctionParameters::at):
(JSC::FunctionParameters::identifiers):
* parser/Parser.cpp:
(JSC::::Parser):
(JSC::::parseVarDeclaration):
(JSC::::parseVarDeclarationList):
(JSC::::parseForStatement):
(JSC::::parseFormalParameters):
(JSC::::parseAssignmentExpression):
* parser/Parser.h:
(JSC::Scope::declareParameter):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createFormalParameterList):
(JSC::SyntaxChecker::createForInLoop):
(JSC::SyntaxChecker::operatorStackPop):
* runtime/JSONObject.cpp:
* runtime/JSONObject.h:

LayoutTests:

* js/destructuring-assignment-expected.txt: Removed.
* js/destructuring-assignment.html: Removed.
* js/mozilla/strict/13.1-expected.txt:
* js/mozilla/strict/regress-532254-expected.txt:
* js/mozilla/strict/script-tests/13.1.js:
* js/regress/destructuring-arguments-expected.txt: Removed.
* js/regress/destructuring-arguments-length-expected.txt: Removed.
* js/regress/destructuring-arguments-length.html: Removed.
* js/regress/destructuring-arguments.html: Removed.
* js/regress/destructuring-swap-expected.txt: Removed.
* js/regress/destructuring-swap.html: Removed.
* js/regress/script-tests/destructuring-arguments-length.js: Removed.
* js/regress/script-tests/destructuring-arguments.js: Removed.
* js/regress/script-tests/destructuring-swap.js: Removed.
* js/script-tests/destructuring-assignment.js: Removed.
* sputnik/Conformance/13_Function_Definition/S13_A5.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3fd53c55
2013-09-26 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r156464 and r156480.
http://trac.webkit.org/changeset/156464
http://trac.webkit.org/changeset/156480
https://bugs.webkit.org/show_bug.cgi?id=121981
Leaking too much and killing buildbot. (Requested by xenon on
#webkit).
* js/destructuring-assignment-expected.txt: Removed.
* js/destructuring-assignment.html: Removed.
* js/mozilla/strict/13.1-expected.txt:
* js/mozilla/strict/regress-532254-expected.txt:
* js/mozilla/strict/script-tests/13.1.js:
* js/regress/destructuring-arguments-expected.txt: Removed.
* js/regress/destructuring-arguments-length-expected.txt: Removed.
* js/regress/destructuring-arguments-length.html: Removed.
* js/regress/destructuring-arguments.html: Removed.
* js/regress/destructuring-swap-expected.txt: Removed.
* js/regress/destructuring-swap.html: Removed.
* js/regress/script-tests/destructuring-arguments-length.js: Removed.
* js/regress/script-tests/destructuring-arguments.js: Removed.
* js/regress/script-tests/destructuring-swap.js: Removed.
* js/script-tests/destructuring-assignment.js: Removed.
* sputnik/Conformance/13_Function_Definition/S13_A5.html:
2013-09-26 Alexey Proskuryakov <ap@apple.com>
Layout Test plugins/access-after-page-destroyed.html is flaky
basic tests for destructuring assignment
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS var [a,b]=['1','2']; var r=a+b; r is '12'
Function as String: (function([a,b]) { return a+b;})
PASS (function([a,b]) { return a+b;})(['1','2']) is '12'
PASS (function ([a,b]) { return a+b;})(['1','2']) is '12'
PASS var {a,b}={a:'1',b:'2'}; var r=a+b; r is '12'
Function as String: (function({a,b}) { return a+b;})
PASS (function({a,b}) { return a+b;})({a:'1',b:'2'}) is '12'
PASS (function ({a:a,b:b}) { return a+b;})({a:'1',b:'2'}) is '12'
PASS var {c:a,d:b}={c:'1',d:'2'}; var r=a+b; r is '12'
Function as String: (function({c:a,d:b}) { return a+b;})
PASS (function({c:a,d:b}) { return a+b;})({c:'1',d:'2'}) is '12'
PASS (function ({c:a,d:b}) { return a+b;})({c:'1',d:'2'}) is '12'
PASS var {c:b,d:a}={c:'1',d:'2'}; var r=a+b; r is '21'
Function as String: (function({c:b,d:a}) { return a+b;})
PASS (function({c:b,d:a}) { return a+b;})({c:'1',d:'2'}) is '21'
PASS (function ({c:b,d:a}) { return a+b;})({c:'1',d:'2'}) is '21'
PASS var {true:a,false:b,undefined:c,null:d,in:e,for:f,1.5:g,'foo bar':h}={true:'a',false:'b',undefined:'c',null:'d',in:'e',for:'f',1.5:'g','foo bar':'h'}; var r=a+b+c+d+e+f+g+h; r is 'abcdefgh'
Function as String: (function({true:a,false:b,undefined:c,null:d,in:e,for:f,1.5:g,'foo bar':h}) { return a+b+c+d+e+f+g+h;})
PASS (function({true:a,false:b,undefined:c,null:d,in:e,for:f,1.5:g,'foo bar':h}) { return a+b+c+d+e+f+g+h;})({true:'a',false:'b',undefined:'c',null:'d',in:'e',for:'f',1.5:'g','foo bar':'h'}) is 'abcdefgh'
PASS (function ({true:a,false:b,undefined:c,null:d,in:e,for:f,1.5:g,"foo bar":h}) { return a+b+c+d+e+f+g+h;})({true:'a',false:'b',undefined:'c',null:'d',in:'e',for:'f',1.5:'g','foo bar':'h'}) is 'abcdefgh'
PASS var [{c:a,d:b}]=[{c:'1',d:'2'}]; var r=a+b; r is '12'
Function as String: (function([{c:a,d:b}]) { return a+b;})
PASS (function([{c:a,d:b}]) { return a+b;})([{c:'1',d:'2'}]) is '12'
PASS (function ([{c:a,d:b}]) { return a+b;})([{c:'1',d:'2'}]) is '12'
PASS var {x:[{c:a,d:b}]}={x:[{c:'1',d:'2'}]}; var r=a+b; r is '12'
Function as String: (function({x:[{c:a,d:b}]}) { return a+b;})
PASS (function({x:[{c:a,d:b}]}) { return a+b;})({x:[{c:'1',d:'2'}]}) is '12'
PASS (function ({x:[{c:a,d:b}]}) { return a+b;})({x:[{c:'1',d:'2'}]}) is '12'
PASS var [a,b]=anArray; var r=a+b; r is '12'
Function as String: (function([a,b]) { return a+b;})
PASS (function([a,b]) { return a+b;})(anArray) is '12'
PASS (function ([a,b]) { return a+b;})(anArray) is '12'
PASS var {a,b}=anArray; var r=a+b; r is '34'
Function as String: (function({a,b}) { return a+b;})
PASS (function({a,b}) { return a+b;})(anArray) is '34'
PASS (function ({a:a,b:b}) { return a+b;})(anArray) is '34'
PASS var {a:a,b:b}=anArray; var r=a+b; r is '34'
Function as String: (function({a:a,b:b}) { return a+b;})
PASS (function({a:a,b:b}) { return a+b;})(anArray) is '34'
PASS (function ({a:a,b:b}) { return a+b;})(anArray) is '34'
PASS var {a,b}=anObject; var r=a+b; r is '12'
Function as String: (function({a,b}) { return a+b;})
PASS (function({a,b}) { return a+b;})(anObject) is '12'
PASS (function ({a:a,b:b}) { return a+b;})(anObject) is '12'
PASS var {a:a,b:b}=anObject; var r=a+b; r is '12'
Function as String: (function({a:a,b:b}) { return a+b;})
PASS (function({a:a,b:b}) { return a+b;})(anObject) is '12'
PASS (function ({a:a,b:b}) { return a+b;})(anObject) is '12'
PASS var {0:a,1:b}=anObject; var r=a+b; r is '34'
Function as String: (function({0:a,1:b}) { return a+b;})
PASS (function({0:a,1:b}) { return a+b;})(anObject) is '34'
PASS (function ({0:a,1:b}) { return a+b;})(anObject) is '34'
PASS var {'a':a,'b':b}=anObject; var r=a+b; r is '12'
Function as String: (function({'a':a,'b':b}) { return a+b;})
PASS (function({'a':a,'b':b}) { return a+b;})(anObject) is '12'
PASS (function ({"a":a,"b":b}) { return a+b;})(anObject) is '12'
PASS a+b is '1122'
PASS a+b is '2211'
PASS testDeconstructArgs('1', '2') is '12'
PASS testDeconstructArgLength('1', '2') is 2
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/destructuring-assignment.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
......@@ -10,8 +10,8 @@ PASS true === true
PASS Function("'use strict'; function f(a,b,c,d,e,f,g,h,d) {}") threw exception of type SyntaxError.
PASS !!Function("function f(a,b,c,d,e,f,g,h,d) {}") is true
PASS true === true
PASS !!Function("'use strict'; function f([x,y]) {}") is true
PASS !!Function("function f([x,y]) {}") is true
PASS Function("'use strict'; function f([x,y]) {}") threw exception of type SyntaxError.
PASS Function("function f([x,y]) {}") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; function f([x,x]){}") threw exception of type SyntaxError.
PASS Function("function f([x,x]){}") threw exception of type SyntaxError.
......@@ -38,10 +38,10 @@ PASS Function("'use strict'; function f(eval){}") threw exception of type Syntax
PASS !!Function("function f(eval){}") is true
PASS true === true
PASS Function("'use strict'; function f([eval]){}") threw exception of type SyntaxError.
PASS !!Function("function f([eval]){}") is true
PASS Function("function f([eval]){}") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; function f({x:eval}){}") threw exception of type SyntaxError.
PASS !!Function("function f({x:eval}){}") is true
PASS Function("function f({x:eval}){}") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; function eval(){}") threw exception of type SyntaxError.
PASS !!Function("function eval(){}") is true
......@@ -62,10 +62,10 @@ PASS Function("'use strict'; (function f(eval){})") threw exception of type Synt
PASS !!Function("(function f(eval){})") is true
PASS true === true
PASS Function("'use strict'; (function f([eval]){})") threw exception of type SyntaxError.
PASS !!Function("(function f([eval]){})") is true
PASS Function("(function f([eval]){})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; (function f({x:eval}){})") threw exception of type SyntaxError.
PASS !!Function("(function f({x:eval}){})") is true
PASS Function("(function f({x:eval}){})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; (function eval(){})") threw exception of type SyntaxError.
PASS !!Function("(function eval(){})") is true
......@@ -98,10 +98,10 @@ PASS Function("'use strict'; ({set x(eval){}})") threw exception of type SyntaxE
PASS !!Function("({set x(eval){}})") is true
PASS true === true
PASS Function("'use strict'; ({set x([eval]){}})") threw exception of type SyntaxError.
PASS !!Function("({set x([eval]){}})") is true
PASS Function("({set x([eval]){}})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; ({set x({x:eval}){}})") threw exception of type SyntaxError.
PASS !!Function("({set x({x:eval}){}})") is true
PASS Function("({set x({x:eval}){}})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; ({set x(eval){\"use strict\";}})") threw exception of type SyntaxError.
PASS Function("({set x(eval){\"use strict\";}})") threw exception of type SyntaxError.
......@@ -116,10 +116,10 @@ PASS Function("'use strict'; function f(arguments){}") threw exception of type S
PASS !!Function("function f(arguments){}") is true
PASS true === true
PASS Function("'use strict'; function f([arguments]){}") threw exception of type SyntaxError.
PASS !!Function("function f([arguments]){}") is true
PASS Function("function f([arguments]){}") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; function f({x:arguments}){}") threw exception of type SyntaxError.
PASS !!Function("function f({x:arguments}){}") is true
PASS Function("function f({x:arguments}){}") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; function arguments(){}") threw exception of type SyntaxError.
PASS !!Function("function arguments(){}") is true
......@@ -140,10 +140,10 @@ PASS Function("'use strict'; (function f(arguments){})") threw exception of type
PASS !!Function("(function f(arguments){})") is true
PASS true === true
PASS Function("'use strict'; (function f([arguments]){})") threw exception of type SyntaxError.
PASS !!Function("(function f([arguments]){})") is true
PASS Function("(function f([arguments]){})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; (function f({x:arguments}){})") threw exception of type SyntaxError.
PASS !!Function("(function f({x:arguments}){})") is true
PASS Function("(function f({x:arguments}){})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; (function arguments(){})") threw exception of type SyntaxError.
PASS !!Function("(function arguments(){})") is true
......@@ -176,10 +176,10 @@ PASS Function("'use strict'; ({set x(arguments){}})") threw exception of type Sy
PASS !!Function("({set x(arguments){}})") is true
PASS true === true
PASS Function("'use strict'; ({set x([arguments]){}})") threw exception of type SyntaxError.
PASS !!Function("({set x([arguments]){}})") is true
PASS Function("({set x([arguments]){}})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; ({set x({x:arguments}){}})") threw exception of type SyntaxError.
PASS !!Function("({set x({x:arguments}){}})") is true
PASS Function("({set x({x:arguments}){}})") threw exception of type SyntaxError.
PASS true === true
PASS Function("'use strict'; ({set x(arguments){\"use strict\";}})") threw exception of type SyntaxError.
PASS Function("({set x(arguments){\"use strict\";}})") threw exception of type SyntaxError.
......
PASS Function("'use strict'; function f(eval,[x]){}") threw exception of type SyntaxError.
PASS !!Function("function f(eval,[x]){}") is true
FAIL !!Function("function f(eval,[x]){}") should be true. Threw exception SyntaxError: Expected an identifier but found '[' instead
PASS true === true
PASSED!
PASS successfullyParsed is true
......
......@@ -39,8 +39,8 @@ assertEq(testLenientAndStrict('function f(a,b,c,d,e,f,g,h,d) {}',
*/
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('function f([x,y]) {}',
parsesSuccessfully,
parsesSuccessfully),
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('function f([x,x]){}',
parseRaisesException(SyntaxError),
......@@ -118,12 +118,12 @@ assertEq(testLenientAndStrict('function f(eval){}',
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('function f([eval]){}',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('function f({x:eval}){}',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('function eval(){}',
......@@ -154,12 +154,12 @@ assertEq(testLenientAndStrict('(function f(eval){})',
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('(function f([eval]){})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('(function f({x:eval}){})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('(function eval(){})',
......@@ -208,12 +208,12 @@ assertEq(testLenientAndStrict('({set x(eval){}})',
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('({set x([eval]){}})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('({set x({x:eval}){}})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({set x(eval){"use strict";}})',
......@@ -234,12 +234,12 @@ assertEq(testLenientAndStrict('function f(arguments){}',
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('function f([arguments]){}',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('function f({x:arguments}){}',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('function arguments(){}',
......@@ -269,12 +269,12 @@ assertEq(testLenientAndStrict('(function f(arguments){})',
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('(function f([arguments]){})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('(function f({x:arguments}){})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('(function arguments(){})',
......@@ -323,12 +323,12 @@ assertEq(testLenientAndStrict('({set x(arguments){}})',
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('({set x([arguments]){}})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
// Destructuring is not valid ES5 syntax.
assertEq(testLenientAndStrict('({set x({x:arguments}){}})',
parsesSuccessfully,
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({set x(arguments){"use strict";}})',
......
JSRegress/destructuring-arguments
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS no exception thrown
PASS successfullyParsed is true
TEST COMPLETE
JSRegress/destructuring-arguments-length
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS no exception thrown
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="resources/regress-pre.js"></script>
<script src="script-tests/destructuring-arguments-length.js"></script>
<script src="resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="resources/regress-pre.js"></script>
<script src="script-tests/destructuring-arguments.js"></script>
<script src="resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
JSRegress/destructuring-swap
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS no exception thrown
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="resources/regress-pre.js"></script>
<script src="script-tests/destructuring-swap.js"></script>
<script src="resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
//@ runDefault
function foo() {
var {0: i, 1: j, length} = arguments;
return i + j + length;
}
var result = 0;
for (var i = 0; i < 1000000; ++i)
result += foo(i, 1);
if (result != 500002500000)
throw "Bad result: " + result;
//@ runDefault
function foo() {
var [a, b] = arguments;
return a - b;
}
var result = 0;
for (var i = 0; i < 1000000; ++i)
result += foo(42, i);
if (result != -499957500000)
throw "Bad result: " + result;
//@ runDefault
function foo(a, b) {
var [a, b] = [b, a];
return a - b;
}
var result = 0;
for (var i = 0; i < 1000000; ++i)
result += foo(42, i);
if (result != 499957500000)
throw "Bad result: " + result;
description("basic tests for destructuring assignment");
function testDestructuring(pattern, expression, result, expr) {
if (!expr) expr = "a+b"
shouldBe("var " + pattern + "=" + expression + "; var r="+expr+"; r", result);
var functionString = "(function(" + pattern + ") { return "+expr+";})";
debug("Function as String: " + functionString);
shouldBe(functionString + "(" + expression + ")", result);
shouldBe("(" + eval(functionString) + ")(" + expression + ")", result);
}
testDestructuring("[a,b]", "['1','2']", "'12'");
testDestructuring("{a,b}", "{a:'1',b:'2'}", "'12'");
testDestructuring("{c:a,d:b}", "{c:'1',d:'2'}", "'12'");
testDestructuring("{c:b,d:a}", "{c:'1',d:'2'}", "'21'");
testDestructuring("{true:a,false:b,undefined:c,null:d,in:e,for:f,1.5:g,'foo bar':h}", "{true:'a',false:'b',undefined:'c',null:'d',in:'e',for:'f',1.5:'g','foo bar':'h'}", "'abcdefgh'", "a+b+c+d+e+f+g+h");
testDestructuring("[{c:a,d:b}]", "[{c:'1',d:'2'}]", "'12'");
testDestructuring("{x:[{c:a,d:b}]}", "{x:[{c:'1',d:'2'}]}", "'12'");
var anArray = ['1', '2'];
anArray.a = '3'
anArray.b = '4'
var anObject = {a:'1', b:'2', 0:'3',1:'4'}
testDestructuring("[a,b]", "anArray", "'12'");
testDestructuring("{a,b}", "anArray", "'34'");
testDestructuring("{a:a,b:b}", "anArray", "'34'");
testDestructuring("{a,b}", "anObject", "'12'");
testDestructuring("{a:a,b:b}", "anObject", "'12'");
testDestructuring("{0:a,1:b}", "anObject", "'34'");
testDestructuring("{'a':a,'b':b}", "anObject", "'12'");
var [a,b] = ['11','22']
shouldBe("a+b", "'1122'")
var [b,a] = [a,b];
shouldBe("a+b", "'2211'")
function testDeconstructArgs() {
var [a,b] = arguments;
return a+b;
}
function testDeconstructArgLength() {
var {length} = arguments;
return length;
}
shouldBe("testDeconstructArgs('1', '2')", "'12'");
shouldBe("testDeconstructArgLength('1', '2')", "2");
......@@ -76,6 +76,7 @@ try {
//CHECK#1
try{
eval("function __func([arg1, arg2, arg3]){return arguments.length;}");
testFailed('#1: eval("function __func([arg1, arg2, arg3]){return arguments.length;}") lead to throwing exception');
} catch(e){
if(!(e instanceof SyntaxError)){
testFailed('#1.1: eval("function __func([arg1, arg2, arg3]){return arguments.length;}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
......
2013-09-26 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r156464 and r156480.
http://trac.webkit.org/changeset/156464
http://trac.webkit.org/changeset/156480
https://bugs.webkit.org/show_bug.cgi?id=121981
Leaking too much and killing buildbot. (Requested by xenon on
#webkit).
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedFunctionExecutable::paramString):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitExpressionInfo):
* bytecompiler/NodesCodegen.cpp:
(JSC::ForInNode::emitBytecode):
(JSC::FuncExprNode::emitBytecode):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createFormalParameterList):
(JSC::ASTBuilder::createForInLoop):
(JSC::ASTBuilder::addVar):
* parser/NodeConstructors.h:
(JSC::CommaNode::CommaNode):
(JSC::ParameterNode::ParameterNode):
(JSC::ForInNode::ForInNode):
* parser/Nodes.cpp:
(JSC::FunctionParameters::create):
(JSC::FunctionParameters::FunctionParameters):
(JSC::FunctionParameters::~FunctionParameters):
* parser/Nodes.h:
(JSC::CommaNode::append):
(JSC::ParameterNode::ident):
(JSC::FunctionParameters::at):
(JSC::FunctionParameters::identifiers):
* parser/Parser.cpp:
(JSC::::Parser):
(JSC::::parseVarDeclaration):
(JSC::::parseVarDeclarationList):
(JSC::::parseForStatement):
(JSC::::parseFormalParameters):
(JSC::::parseAssignmentExpression):
* parser/Parser.h:
(JSC::Scope::declareParameter):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createFormalParameterList):
(JSC::SyntaxChecker::createForInLoop):
(JSC::SyntaxChecker::operatorStackPop):
* runtime/JSONObject.cpp:
* runtime/JSONObject.h:
2013-09-26 Anders Carlsson <andersca@apple.com>
Try to fix the Windows build.
......@@ -183,7 +183,7 @@ String UnlinkedFunctionExecutable::paramString() const
for (size_t pos = 0; pos < parameters.size(); ++pos) {
if (!builder.isEmpty())
builder.appendLiteral(", ");
parameters.at(pos)->toString(builder);
builder.append(parameters.at(pos).string());
}
return builder.toString();
}
......
......@@ -180,7 +180,7 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, ProgramNode* programNode, UnlinkedP
}
for (size_t i = 0; i < varStack.size(); ++i)
codeBlock->addVariableDeclaration(varStack[i].first, !!(varStack[i].second & DeclarationStacks::IsConstant));
codeBlock->addVariableDeclaration(*varStack[i].first, !!(varStack[i].second & DeclarationStacks::IsConstant));
}
......@@ -215,15 +215,6 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionBodyNode* functionBody, Unl
m_codeBlock->setNeedsFullScopeChain(true);
m_symbolTable->setUsesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode());
Vector<Identifier> boundParameterProperties;
FunctionParameters& parameters = *functionBody->parameters();
for (size_t i = 0; i < parameters.size(); i++) {
auto pattern = parameters.at(i);
if (pattern->isBindingNode())
continue;
pattern->collectBoundIdentifiers(boundParameterProperties);
continue;
}
m_symbolTable->setParameterCountIncludingThis(functionBody->parameters()->size() + 1);
emitOpcode(op_enter);
......@@ -263,11 +254,7 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionBodyNode* functionBody, Unl
capturedArguments.resize(parameters.size());
for (size_t i = 0; i < parameters.size(); ++i) {
capturedArguments[i] = 0;
auto pattern = parameters.at(i);
if (!pattern->isBindingNode())
continue;
const Identifier& ident = static_cast<const BindingNode*>(pattern)->boundProperty();
if (!functionBody->captures(ident) && !shouldCaptureAllTheThings)
if (!functionBody->captures(parameters.at(i)) && !shouldCaptureAllTheThings)
continue;
capturesAnyArgumentByName = true;
capturedArguments[i] = addVar();
......@@ -312,7 +299,7 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionBodyNode* functionBody, Unl
}
}
for (size_t i = 0; i < varStack.size(); ++i) {
const Identifier& ident = varStack[i].first;
const Identifier& ident = *varStack[i].first;
if (functionBody->captures(ident))
addVar(ident, varStack[i].second & DeclarationStacks::IsConstant);
}
......@@ -345,7 +332,7 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionBodyNode* functionBody, Unl
}
m_lastLazyFunction = canLazilyCreateFunctions ? codeBlock->m_numVars : m_firstLazyFunction;
for (size_t i = 0; i < varStack.size(); ++i) {
const Identifier& ident = varStack[i].first;
const Identifier& ident = *varStack[i].first;
if (!functionBody->captures(ident))
addVar(ident, varStack[i].second & DeclarationStacks::IsConstant);
}
......@@ -353,31 +340,23 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionBodyNode* functionBody, Unl
if (shouldCaptureAllTheThings)
m_symbolTable->setCaptureEnd(localToOperand(codeBlock->m_numVars));
FunctionParameters& parameters = *functionBody->parameters();
m_parameters.grow(parameters.size() + 1); // reserve space for "this"
// Add "this" as a parameter
int nextParameterIndex = CallFrame::thisArgumentOffset();
m_thisRegister.setIndex(nextParameterIndex++);
m_codeBlock->addParameter();
Vector<std::pair<RegisterID*, const DeconstructionPatternNode*>> deconstructedParameters;
for (size_t i = 0; i < parameters.size(); ++i, ++nextParameterIndex) {
int index = nextParameterIndex;
auto pattern = parameters.at(i);
if (!pattern->isBindingNode()) {