REGRESSION(156464): 50% regression on SunSpider/string-fasta
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 02:19:34 +0000 (02:19 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 02:19:34 +0000 (02:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122202

Source/JavaScriptCore:

Unreviewed, roll out r156464.

This is a progression on string-fasta, since it fixes the regression.

* 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::ExpressionNode::isDotAccessorNode):
(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):
(JSC::Parser::declareParameter):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createFormalParameterList):
(JSC::SyntaxChecker::createForInLoop):
(JSC::SyntaxChecker::operatorStackPop):
* runtime/JSONObject.cpp:
* runtime/JSONObject.h:

LayoutTests:

Unreviewed, roll out r156464.

* 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: https://svn.webkit.org/repository/webkit/trunk@156757 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
LayoutTests/ChangeLog
LayoutTests/js/destructuring-assignment-expected.txt [deleted file]
LayoutTests/js/destructuring-assignment.html [deleted file]
LayoutTests/js/mozilla/strict/13.1-expected.txt
LayoutTests/js/mozilla/strict/regress-532254-expected.txt
LayoutTests/js/mozilla/strict/script-tests/13.1.js
LayoutTests/js/regress/destructuring-arguments-expected.txt [deleted file]
LayoutTests/js/regress/destructuring-arguments-length-expected.txt [deleted file]
LayoutTests/js/regress/destructuring-arguments-length.html [deleted file]
LayoutTests/js/regress/destructuring-arguments.html [deleted file]
LayoutTests/js/regress/destructuring-swap-expected.txt [deleted file]
LayoutTests/js/regress/destructuring-swap.html [deleted file]
LayoutTests/js/regress/script-tests/destructuring-arguments-length.js [deleted file]
LayoutTests/js/regress/script-tests/destructuring-arguments.js [deleted file]
LayoutTests/js/regress/script-tests/destructuring-swap.js [deleted file]
LayoutTests/js/script-tests/destructuring-assignment.js [deleted file]
LayoutTests/sputnik/Conformance/13_Function_Definition/S13_A5.html
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Source/JavaScriptCore/parser/ASTBuilder.h
Source/JavaScriptCore/parser/NodeConstructors.h
Source/JavaScriptCore/parser/Nodes.cpp
Source/JavaScriptCore/parser/Nodes.h
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/parser/SyntaxChecker.h
Source/JavaScriptCore/runtime/JSONObject.cpp
Source/JavaScriptCore/runtime/JSONObject.h

index 865d281..038d163 100644 (file)
@@ -1,3 +1,27 @@
+2013-10-01  Filip Pizlo  <fpizlo@apple.com>
+
+        REGRESSION(156464): 50% regression on SunSpider/string-fasta
+        https://bugs.webkit.org/show_bug.cgi?id=122202
+
+        Unreviewed, roll out r156464.
+
+        * 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-10-01  Tim Horton  <timothy_horton@apple.com>
 
         Tiled drawing GraphicsLayer tree dumps should match non-tiled more closely
diff --git a/LayoutTests/js/destructuring-assignment-expected.txt b/LayoutTests/js/destructuring-assignment-expected.txt
deleted file mode 100644 (file)
index c73ad63..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-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
-
diff --git a/LayoutTests/js/destructuring-assignment.html b/LayoutTests/js/destructuring-assignment.html
deleted file mode 100644 (file)
index a5ffe5b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<!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>
index 8177751..c236524 100644 (file)
@@ -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.
index 184e589..8d40268 100644 (file)
@@ -1,5 +1,5 @@
 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
index c1c5e6e..e7e1b09 100644 (file)
@@ -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";}})',
diff --git a/LayoutTests/js/regress/destructuring-arguments-expected.txt b/LayoutTests/js/regress/destructuring-arguments-expected.txt
deleted file mode 100644 (file)
index 308229b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-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
-
diff --git a/LayoutTests/js/regress/destructuring-arguments-length-expected.txt b/LayoutTests/js/regress/destructuring-arguments-length-expected.txt
deleted file mode 100644 (file)
index 4138f83..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-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
-
diff --git a/LayoutTests/js/regress/destructuring-arguments-length.html b/LayoutTests/js/regress/destructuring-arguments-length.html
deleted file mode 100644 (file)
index 7419ce8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!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>
diff --git a/LayoutTests/js/regress/destructuring-arguments.html b/LayoutTests/js/regress/destructuring-arguments.html
deleted file mode 100644 (file)
index 7fda8d8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!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>
diff --git a/LayoutTests/js/regress/destructuring-swap-expected.txt b/LayoutTests/js/regress/destructuring-swap-expected.txt
deleted file mode 100644 (file)
index 513f630..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-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
-
diff --git a/LayoutTests/js/regress/destructuring-swap.html b/LayoutTests/js/regress/destructuring-swap.html
deleted file mode 100644 (file)
index 1505860..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!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>
diff --git a/LayoutTests/js/regress/script-tests/destructuring-arguments-length.js b/LayoutTests/js/regress/script-tests/destructuring-arguments-length.js
deleted file mode 100644 (file)
index 967e340..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ 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;
diff --git a/LayoutTests/js/regress/script-tests/destructuring-arguments.js b/LayoutTests/js/regress/script-tests/destructuring-arguments.js
deleted file mode 100644 (file)
index 5c6dbee..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ 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;
diff --git a/LayoutTests/js/regress/script-tests/destructuring-swap.js b/LayoutTests/js/regress/script-tests/destructuring-swap.js
deleted file mode 100644 (file)
index 6f764c1..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ 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;
diff --git a/LayoutTests/js/script-tests/destructuring-assignment.js b/LayoutTests/js/script-tests/destructuring-assignment.js
deleted file mode 100644 (file)
index 9a860ef..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-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");
-
-
-
index 2aa0a5d..66cc1ea 100644 (file)
@@ -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);
index d05bb0a..31471c9 100644 (file)
@@ -1,5 +1,58 @@
 2013-10-01  Filip Pizlo  <fpizlo@apple.com>
 
+        REGRESSION(156464): 50% regression on SunSpider/string-fasta
+        https://bugs.webkit.org/show_bug.cgi?id=122202
+
+        Unreviewed, roll out r156464.
+        
+        This is a progression on string-fasta, since it fixes the regression.
+
+        * 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::ExpressionNode::isDotAccessorNode):
+        (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):
+        (JSC::Parser::declareParameter):
+        * parser/SyntaxChecker.h:
+        (JSC::SyntaxChecker::createFormalParameterList):
+        (JSC::SyntaxChecker::createForInLoop):
+        (JSC::SyntaxChecker::operatorStackPop):
+        * runtime/JSONObject.cpp:
+        * runtime/JSONObject.h:
+
+2013-10-01  Filip Pizlo  <fpizlo@apple.com>
+
         Variable event stream (for DFG OSR exit) should be explicit about where on the stack a SetLocal put a value
         https://bugs.webkit.org/show_bug.cgi?id=122178
 
index d13aa65..c4067e3 100644 (file)
@@ -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();
 }
index c9632eb..be0fcb3 100644 (file)
@@ -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(virtualRegisterForLocal(codeBlock->m_numVars).offset());
 
+    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()) {
-            m_codeBlock->addParameter();
-            RegisterID& parameter = registerFor(index);
-            parameter.setIndex(index);
-            deconstructedParameters.append(make_pair(&parameter, pattern));
-            continue;
-        }
-        auto simpleParameter = static_cast<const BindingNode*>(pattern);
         if (capturedArguments.size() && capturedArguments[i]) {
-            ASSERT((functionBody->hasCapturedVariables() && functionBody->captures(simpleParameter->boundProperty())) || shouldCaptureAllTheThings);
+            ASSERT((functionBody->hasCapturedVariables() && functionBody->captures(parameters.at(i))) || shouldCaptureAllTheThings);
             index = capturedArguments[i]->index();
             RegisterID original(nextParameterIndex);
             emitMove(capturedArguments[i], &original);
         }
-        addParameter(simpleParameter->boundProperty(), index);
+        addParameter(parameters.at(i), index);
     }
     preserveLastVar();
 
@@ -391,10 +370,6 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionBodyNode* functionBody, Unl
         instructions().append(kill(&m_thisRegister));
         instructions().append(0);
     }
-    for (size_t i = 0; i < deconstructedParameters.size(); i++) {
-        auto& entry = deconstructedParameters[i];
-        entry.second->emitBytecode(*this, entry.first);
-    }
 }
 
 BytecodeGenerator::BytecodeGenerator(VM& vm, EvalNode* evalNode, UnlinkedEvalCodeBlock* codeBlock, DebuggerMode debuggerMode, ProfilerMode profilerMode)
@@ -439,10 +414,8 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, EvalNode* evalNode, UnlinkedEvalCod
     unsigned numVariables = varStack.size();
     Vector<Identifier, 0, UnsafeVectorOverflow> variables;
     variables.reserveCapacity(numVariables);
-    for (size_t i = 0; i < numVariables; ++i) {
-        ASSERT(varStack[i].first.impl()->isIdentifier());
-        variables.append(varStack[i].first);
-    }
+    for (size_t i = 0; i < numVariables; ++i)
+        variables.append(*varStack[i].first);
     codeBlock->adoptVariables(variables);
     preserveLastVar();
 }
index fcc17df..06c0fe4 100644 (file)
@@ -286,10 +286,7 @@ namespace JSC {
                 lineStart -= sourceOffset;
             else
                 lineStart = 0;
-
-            if (divotOffset < lineStart)
-                return;
-
+            ASSERT(divotOffset >= lineStart);
             unsigned column = divotOffset - lineStart;
 
             unsigned instructionOffset = instructions().size();
index e85fec5..633b296 100644 (file)
@@ -35,7 +35,6 @@
 #include "JSFunction.h"
 #include "JSGlobalObject.h"
 #include "JSNameScope.h"
-#include "JSONObject.h"
 #include "LabelScope.h"
 #include "Lexer.h"
 #include "Operations.h"
@@ -1714,7 +1713,8 @@ void ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
 
         generator.emitExpressionInfo(assignNode->divot(), assignNode->divotStart(), assignNode->divotEnd());
         generator.emitPutById(base, ident, propertyName);
-    } else if (m_lexpr->isBracketAccessorNode()) {
+    } else {
+        ASSERT(m_lexpr->isBracketAccessorNode());
         BracketAccessorNode* assignNode = static_cast<BracketAccessorNode*>(m_lexpr);
         propertyName = generator.newTemporary();
         RefPtr<RegisterID> protect = propertyName;
@@ -1723,13 +1723,7 @@ void ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
         
         generator.emitExpressionInfo(assignNode->divot(), assignNode->divotStart(), assignNode->divotEnd());
         generator.emitPutByVal(base.get(), subscript, propertyName);
-    } else {
-        ASSERT(m_lexpr->isDeconstructionNode());
-        DeconstructingAssignmentNode* assignNode = static_cast<DeconstructingAssignmentNode*>(m_lexpr);
-        propertyName = generator.newTemporary();
-        RefPtr<RegisterID> protect(propertyName);
-        assignNode->bindings()->emitBytecode(generator, propertyName);
-    }
+    }   
 
     generator.emitNode(dst, m_statement);
 
@@ -2185,157 +2179,5 @@ RegisterID* FuncExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID*
 {
     return generator.emitNewFunctionExpression(generator.finalDestination(dst), this);
 }
-    
-// ------------------------------ DeconstructingAssignmentNode -----------------
-RegisterID* DeconstructingAssignmentNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
-{
-    if (RegisterID* result = m_bindings->emitDirectBinding(generator, dst, m_initializer))
-        return result;
-    RefPtr<RegisterID> initializer = generator.tempDestination(dst);
-    generator.emitNode(initializer.get(), m_initializer);
-    m_bindings->emitBytecode(generator, initializer.get());
-    return generator.moveToDestinationIfNeeded(dst, initializer.get());
-}
-
-DeconstructionPatternNode::~DeconstructionPatternNode()
-{
-}
-    
-void ArrayPatternNode::emitBytecode(BytecodeGenerator& generator, RegisterID* rhs) const
-{
-    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-        auto target = m_targetPatterns[i];
-        if (!target)
-            continue;
-        RefPtr<RegisterID> temp = generator.newTemporary();
-        generator.emitLoad(temp.get(), jsNumber(i));
-        generator.emitGetByVal(temp.get(), rhs, temp.get());
-        target->emitBytecode(generator, temp.get());
-    }
-}
-
-RegisterID* ArrayPatternNode::emitDirectBinding(BytecodeGenerator& generator, RegisterID* dst, ExpressionNode* rhs)
-{
-    if (rhs->isResolveNode()
-        && generator.willResolveToArguments(static_cast<ResolveNode*>(rhs)->identifier())
-        && !generator.symbolTable().slowArguments()) {
-        for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-            auto target = m_targetPatterns[i];
-            if (!target)
-                continue;
-            
-            RefPtr<RegisterID> temp = generator.newTemporary();
-            generator.emitLoad(temp.get(), jsNumber(i));
-            generator.emitGetArgumentByVal(generator.finalDestination(dst), generator.uncheckedRegisterForArguments(), temp.get());
-            target->emitBytecode(generator, temp.get());
-        }
-    }
-    if (!rhs->isSimpleArray())
-        return 0;
-    ElementNode* elementNodes = static_cast<ArrayNode*>(rhs)->elements();
-    Vector<ExpressionNode*> elements;
-    for (; elementNodes; elementNodes = elementNodes->next())
-        elements.append(elementNodes->value());
-    if (m_targetPatterns.size() != elements.size())
-        return 0;
-    Vector<RefPtr<RegisterID>> registers;
-    registers.reserveCapacity(m_targetPatterns.size());
-    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-        registers.uncheckedAppend(generator.newTemporary());
-        generator.emitNode(registers.last().get(), elements[i]);
-    }
-    
-    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-        if (m_targetPatterns[i])
-            m_targetPatterns[i]->emitBytecode(generator, registers[i].get());
-    }
-    RefPtr<RegisterID> result = generator.finalDestination(dst);
-    return generator.emitLoad(result.get(), jsUndefined());
-}
-
-void ArrayPatternNode::toString(StringBuilder& builder) const
-{
-    builder.append('[');
-    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-        if (!m_targetPatterns[i]) {
-            builder.append(',');
-            continue;
-        }
-        m_targetPatterns[i]->toString(builder);
-        if (i < m_targetPatterns.size() - 1)
-            builder.append(',');
-    }
-    builder.append(']');
-}
-
-void ArrayPatternNode::collectBoundIdentifiers(Vector<Identifier>& identifiers) const
-{
-    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-        if (DeconstructionPatternNode* node = m_targetPatterns[i].get())
-            node->collectBoundIdentifiers(identifiers);
-    }
-}
-
-void ObjectPatternNode::toString(StringBuilder& builder) const
-{
-    builder.append('{');
-    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-        if (m_targetPatterns[i].wasString) {
-            builder.append('"');
-            escapeStringToBuilder(builder, m_targetPatterns[i].propertyName.string());
-            builder.append('"');
-        } else
-            builder.append(m_targetPatterns[i].propertyName.string());
-        builder.append(":");
-        m_targetPatterns[i].pattern->toString(builder);
-        if (i < m_targetPatterns.size() - 1)
-            builder.append(',');
-    }
-    builder.append('}');
-}
-    
-void ObjectPatternNode::emitBytecode(BytecodeGenerator& generator, RegisterID* rhs) const
-{
-    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
-        auto& target = m_targetPatterns[i];
-        RefPtr<RegisterID> temp = generator.newTemporary();
-        generator.emitGetById(temp.get(), rhs, target.propertyName);
-        target.pattern->emitBytecode(generator, temp.get());
-    }
-}
-
-void ObjectPatternNode::collectBoundIdentifiers(Vector<Identifier>& identifiers) const
-{
-    for (size_t i = 0; i < m_targetPatterns.size(); i++)
-        m_targetPatterns[i].pattern->collectBoundIdentifiers(identifiers);
-}
-
-void BindingNode::emitBytecode(BytecodeGenerator& generator, RegisterID* value) const
-{
-    if (Local local = generator.local(m_boundProperty)) {
-        if (local.isReadOnly()) {
-            generator.emitReadOnlyExceptionIfNeeded();
-            return;
-        }
-        generator.emitMove(local.get(), value);
-        return;
-    }
-    if (generator.isStrictMode())
-        generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
-    RegisterID* scope = generator.emitResolveScope(generator.newTemporary(), m_boundProperty);
-    generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
-    generator.emitPutToScope(scope, m_boundProperty, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound);
-    return;
-}
-
-void BindingNode::toString(StringBuilder& builder) const
-{
-    builder.append(m_boundProperty.string());
-}
-
-void BindingNode::collectBoundIdentifiers(Vector<Identifier>& identifiers) const
-{
-    identifiers.append(m_boundProperty);
-}
 
 } // namespace JSC
index a37cdc7..95c98d0 100644 (file)
@@ -90,7 +90,6 @@ public:
         UnaryExprContext(ASTBuilder&) {}
     };
 
-
     typedef SyntaxChecker FunctionBodyBuilder;
 
     typedef ExpressionNode* Expression;
@@ -108,10 +107,7 @@ public:
     typedef CaseClauseNode* Clause;
     typedef ConstDeclNode* ConstDeclList;
     typedef std::pair<ExpressionNode*, BinaryOpInfo> BinaryOperand;
-    typedef RefPtr<DeconstructionPatternNode> DeconstructionPattern;
-    typedef RefPtr<ArrayPatternNode> ArrayPattern;
-    typedef RefPtr<ObjectPatternNode> ObjectPattern;
-    typedef RefPtr<BindingNode> BindingPattern;
+    
     static const bool CreatesAST = true;
     static const bool NeedsFreeVariableInfo = true;
     static const bool CanUseFunctionCache = true;
@@ -318,8 +314,8 @@ public:
     ElementNode* createElementList(int elisions, ExpressionNode* expr) { return new (m_vm) ElementNode(elisions, expr); }
     ElementNode* createElementList(ElementNode* elems, int elisions, ExpressionNode* expr) { return new (m_vm) ElementNode(elems, elisions, expr); }
 
-    ParameterNode* createFormalParameterList(DeconstructionPattern pattern) { return new (m_vm) ParameterNode(pattern); }
-    ParameterNode* createFormalParameterList(ParameterNode* list, DeconstructionPattern pattern) { return new (m_vm) ParameterNode(list, pattern); }
+    ParameterNode* createFormalParameterList(const Identifier& ident) { return new (m_vm) ParameterNode(ident); }
+    ParameterNode* createFormalParameterList(ParameterNode* list, const Identifier& ident) { return new (m_vm) ParameterNode(list, ident); }
 
     CaseClauseNode* createClause(ExpressionNode* expr, JSC::SourceElements* statements) { return new (m_vm) CaseClauseNode(expr, statements); }
     ClauseListNode* createClauseList(CaseClauseNode* clause) { return new (m_vm) ClauseListNode(clause); }
@@ -365,17 +361,17 @@ public:
         return result;
     }
 
-    StatementNode* createForInLoop(const JSTokenLocation& location, ExpressionNode* lhs, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& eStart, const JSTextPosition& eDivot, const JSTextPosition& eEnd, int start, int end)
+    StatementNode* createForInLoop(const JSTokenLocation& location, const Identifier* ident, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& start, const JSTextPosition& divot, const JSTextPosition& end, int startLine, int endLine)
     {
-        ForInNode* result = new (m_vm) ForInNode(location, lhs, iter, statements);
-        result->setLoc(start, end, location.startOffset, location.lineStartOffset);
-        setExceptionLocation(result, eStart, eDivot, eEnd);
+        ForInNode* result = new (m_vm) ForInNode(m_vm, location, *ident, iter, statements, start);
+        result->setLoc(startLine, endLine, location.startOffset, location.lineStartOffset);
+        setExceptionLocation(result, start, divot + 1, end);
         return result;
     }
-    
-    StatementNode* createForInLoop(const JSTokenLocation& location, PassRefPtr<DeconstructionPatternNode> pattern, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& eStart, const JSTextPosition& eDivot, const JSTextPosition& eEnd, int start, int end)
+
+    StatementNode* createForInLoop(const JSTokenLocation& location, ExpressionNode* lhs, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& eStart, const JSTextPosition& eDivot, const JSTextPosition& eEnd, int start, int end)
     {
-        ForInNode* result = new (m_vm) ForInNode(m_vm, location, pattern.get(), iter, statements);
+        ForInNode* result = new (m_vm) ForInNode(location, lhs, iter, statements);
         result->setLoc(start, end, location.startOffset, location.lineStartOffset);
         setExceptionLocation(result, eStart, eDivot, eEnd);
         return result;
@@ -519,8 +515,7 @@ public:
     {
         if (m_vm->propertyNames->arguments == *ident)
             usesArguments();
-        ASSERT(ident->impl()->isIdentifier());
-        m_scope.m_varDeclarations->data.append(std::make_pair(*ident, attrs));
+        m_scope.m_varDeclarations->data.append(std::make_pair(ident, attrs));
     }
 
     ExpressionNode* combineCommaNodes(const JSTokenLocation& location, ExpressionNode* list, ExpressionNode* init)
@@ -620,41 +615,6 @@ public:
 
     bool isResolve(ExpressionNode* expr) const { return expr->isResolveNode(); }
 
-    ExpressionNode* createDeconstructingAssignment(const JSTokenLocation& location, PassRefPtr<DeconstructionPatternNode> pattern, ExpressionNode* initializer)
-    {
-        return new (m_vm) DeconstructingAssignmentNode(location, pattern.get(), initializer);
-    }
-    
-    ArrayPattern createArrayPattern(const JSTokenLocation&)
-    {
-        return ArrayPatternNode::create(m_vm);
-    }
-    
-    void appendArrayPatternSkipEntry(ArrayPattern node, const JSTokenLocation& location)
-    {
-        node->appendIndex(location, 0);
-    }
-
-    void appendArrayPatternEntry(ArrayPattern node, const JSTokenLocation& location, DeconstructionPattern pattern)
-    {
-        node->appendIndex(location, pattern.get());
-    }
-    
-    ObjectPattern createObjectPattern(const JSTokenLocation&)
-    {
-        return ObjectPatternNode::create(m_vm);
-    }
-    
-    void appendObjectPatternEntry(ObjectPattern node, const JSTokenLocation& location, bool wasString, const Identifier& identifier, DeconstructionPattern pattern)
-    {
-        node->appendEntry(location, identifier, wasString, pattern.get());
-    }
-    
-    BindingPattern createBindingLocation(const JSTokenLocation&, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
-    {
-        return BindingNode::create(m_vm, boundProperty, divot, start, end);
-    }
-    
 private:
     struct Scope {
         Scope(VM* vm)
index 0ce20eb..5ccc779 100644 (file)
@@ -603,8 +603,6 @@ inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifie
     inline CommaNode::CommaNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2)
         : ExpressionNode(location)
     {
-        ASSERT(expr1);
-        ASSERT(expr2);
         m_expressions.append(expr1);
         m_expressions.append(expr2);
     }
@@ -734,20 +732,17 @@ inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifie
     {
     }
 
-    inline ParameterNode::ParameterNode(PassRefPtr<DeconstructionPatternNode> pattern)
-        : m_pattern(pattern)
+    inline ParameterNode::ParameterNode(const Identifier& ident)
+        : m_ident(ident)
         , m_next(0)
     {
-        ASSERT(m_pattern);
     }
 
-    inline ParameterNode::ParameterNode(ParameterNode* l, PassRefPtr<DeconstructionPatternNode> pattern)
-        : m_pattern(pattern)
+    inline ParameterNode::ParameterNode(ParameterNode* l, const Identifier& ident)
+        : m_ident(ident)
         , m_next(0)
     {
         l->m_next = this;
-        ASSERT(m_pattern);
-        ASSERT(l->m_pattern);
     }
 
     inline FuncExprNode::FuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
@@ -817,61 +812,16 @@ inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifie
         , m_expr(expr)
         , m_statement(statement)
     {
-        ASSERT(l);
     }
-    
-    inline ForInNode::ForInNode(VM* vm, const JSTokenLocation& location, DeconstructionPatternNode* pattern, ExpressionNode* expr, StatementNode* statement)
+
+    inline ForInNode::ForInNode(VM* vm, const JSTokenLocation& location, const Identifier& ident, ExpressionNode* expr, StatementNode* statement, const JSTextPosition& divotStart)
         : StatementNode(location)
-        , m_lexpr(new (vm) DeconstructingAssignmentNode(location, pattern, 0))
+        , m_lexpr(new (vm) ResolveNode(location, ident, divotStart))
         , m_expr(expr)
         , m_statement(statement)
     {
-        ASSERT(pattern);
-    }
-    
-    inline DeconstructionPatternNode::DeconstructionPatternNode(VM*)
-    {
     }
 
-    inline ArrayPatternNode::ArrayPatternNode(VM* vm)
-        : DeconstructionPatternNode(vm)
-    {
-    }
-    
-    inline PassRefPtr<ArrayPatternNode> ArrayPatternNode::create(VM* vm)
-    {
-        return adoptRef(new ArrayPatternNode(vm));
-    }
-    
-    inline ObjectPatternNode::ObjectPatternNode(VM* vm)
-        : DeconstructionPatternNode(vm)
-    {
-    }
-    
-    inline PassRefPtr<ObjectPatternNode> ObjectPatternNode::create(VM* vm)
-    {
-        return adoptRef(new ObjectPatternNode(vm));
-    }
-
-    inline PassRefPtr<BindingNode> BindingNode::create(VM* vm, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
-    {
-        return adoptRef(new BindingNode(vm, boundProperty, divot, start, end));
-    }
-    
-    inline BindingNode::BindingNode(VM* vm, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
-        : DeconstructionPatternNode(vm)
-        , ThrowableExpressionData(divot, start, end)
-        , m_boundProperty(boundProperty)
-    {
-    }
-    
-    inline DeconstructingAssignmentNode::DeconstructingAssignmentNode(const JSTokenLocation& location, PassRefPtr<DeconstructionPatternNode> bindings, ExpressionNode* initializer)
-        : ExpressionNode(location)
-        , m_bindings(bindings)
-        , m_initializer(initializer)
-    {
-    }
-    
 } // namespace JSC
 
 #endif // NodeConstructors_h
index d8ddeaf..36ded38 100644 (file)
@@ -157,7 +157,7 @@ PassRefPtr<FunctionParameters> FunctionParameters::create(ParameterNode* firstPa
     for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam())
         ++parameterCount;
 
-    size_t objectSize = sizeof(FunctionParameters) - sizeof(void*) + sizeof(DeconstructionPatternNode*) * parameterCount;
+    size_t objectSize = sizeof(FunctionParameters) - sizeof(void*) + sizeof(StringImpl*) * parameterCount;
     void* slot = fastMalloc(objectSize);
     return adoptRef(new (slot) FunctionParameters(firstParameter, parameterCount));
 }
@@ -166,17 +166,14 @@ FunctionParameters::FunctionParameters(ParameterNode* firstParameter, unsigned s
     : m_size(size)
 {
     unsigned i = 0;
-    for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam()) {
-        auto pattern = parameter->pattern();
-        pattern->ref();
-        patterns()[i++] = pattern;
-    }
+    for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam())
+        new (&identifiers()[i++]) Identifier(parameter->ident());
 }
 
 FunctionParameters::~FunctionParameters()
 {
     for (unsigned i = 0; i < m_size; ++i)
-        patterns()[i]->deref();
+        identifiers()[i].~Identifier();
 }
 
 inline FunctionBodyNode::FunctionBodyNode(VM* vm, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, bool inStrictContext)
index e702e3f..d7bf28e 100644 (file)
@@ -80,7 +80,7 @@ namespace JSC {
 
     namespace DeclarationStacks {
         enum VarAttrs { IsConstant = 1, HasInitializer = 2 };
-        typedef Vector<std::pair<Identifier, unsigned> > VarStack;
+        typedef Vector<std::pair<const Identifier*, unsigned> > VarStack;
         typedef Vector<FunctionBodyNode*> FunctionStack;
     }
 
@@ -154,7 +154,6 @@ namespace JSC {
         virtual bool isResolveNode() const { return false; }
         virtual bool isBracketAccessorNode() const { return false; }
         virtual bool isDotAccessorNode() const { return false; }
-        virtual bool isDeconstructionNode() const { return false; }
         virtual bool isFuncExprNode() const { return false; }
         virtual bool isCommaNode() const { return false; }
         virtual bool isSimpleArray() const { return false; }
@@ -462,7 +461,6 @@ namespace JSC {
 
         ArgumentListNode* toArgumentList(VM*, int, int) const;
 
-        ElementNode* elements() const { ASSERT(isSimpleArray()); return m_element; }
     private:
         virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
 
@@ -1082,7 +1080,7 @@ namespace JSC {
 
         using ParserArenaDeletable::operator new;
 
-        void append(ExpressionNode* expr) { ASSERT(expr); m_expressions.append(expr); }
+        void append(ExpressionNode* expr) { m_expressions.append(expr); }
 
     private:
         virtual bool isCommaNode() const { return true; }
@@ -1240,13 +1238,11 @@ namespace JSC {
         ExpressionNode* m_expr3;
         StatementNode* m_statement;
     };
-    
-    class DeconstructionPatternNode;
 
     class ForInNode : public StatementNode, public ThrowableExpressionData {
     public:
         ForInNode(const JSTokenLocation&, ExpressionNode*, ExpressionNode*, StatementNode*);
-        ForInNode(VM*, const JSTokenLocation&, DeconstructionPatternNode*, ExpressionNode*, StatementNode*);
+        ForInNode(VM*, const JSTokenLocation&, const Identifier&, ExpressionNode*, StatementNode*, const JSTextPosition& divotStart);
 
     private:
         virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0);
@@ -1345,14 +1341,14 @@ namespace JSC {
 
     class ParameterNode : public ParserArenaDeletable {
     public:
-        ParameterNode(PassRefPtr<DeconstructionPatternNode>);
-        ParameterNode(ParameterNode*, PassRefPtr<DeconstructionPatternNode>);
+        ParameterNode(const Identifier&);
+        ParameterNode(ParameterNode*, const Identifier&);
 
-        DeconstructionPatternNode* pattern() const { return m_pattern.get(); }
+        const Identifier& ident() const { return m_ident; }
         ParameterNode* nextParam() const { return m_next; }
 
     private:
-        RefPtr<DeconstructionPatternNode> m_pattern;
+        const Identifier& m_ident;
         ParameterNode* m_next;
     };
 
@@ -1464,21 +1460,21 @@ namespace JSC {
 
     class FunctionParameters : public RefCounted<FunctionParameters> {
         WTF_MAKE_FAST_ALLOCATED;
-        WTF_MAKE_NONCOPYABLE(FunctionParameters);
     public:
         static PassRefPtr<FunctionParameters> create(ParameterNode*);
         ~FunctionParameters();
 
         unsigned size() const { return m_size; }
-        DeconstructionPatternNode* at(unsigned index) { ASSERT(index < m_size); return patterns()[index]; }
+        const Identifier& at(unsigned index) const { ASSERT(index < m_size); return identifiers()[index]; }
 
     private:
         FunctionParameters(ParameterNode*, unsigned size);
 
-        DeconstructionPatternNode** patterns() { return &m_storage; }
+        Identifier* identifiers() { return reinterpret_cast<Identifier*>(&m_storage); }
+        const Identifier* identifiers() const { return reinterpret_cast<const Identifier*>(&m_storage); }
 
         unsigned m_size;
-        DeconstructionPatternNode* m_storage;
+        void* m_storage;
     };
 
     class FunctionBodyNode : public ScopeNode {
@@ -1534,102 +1530,6 @@ namespace JSC {
         FunctionBodyNode* m_body;
     };
 
-    class DeconstructionPatternNode : public RefCounted<DeconstructionPatternNode> {
-        WTF_MAKE_NONCOPYABLE(DeconstructionPatternNode);
-        WTF_MAKE_FAST_ALLOCATED;
-
-    public:
-        virtual void collectBoundIdentifiers(Vector<Identifier>&) const = 0;
-        virtual void emitBytecode(BytecodeGenerator&, RegisterID* source) const = 0;
-        virtual void toString(StringBuilder&) const = 0;
-
-        virtual bool isBindingNode() const { return false; }
-        virtual RegisterID* emitDirectBinding(BytecodeGenerator&, RegisterID*, ExpressionNode*) { return 0; }
-        
-        virtual ~DeconstructionPatternNode() = 0;
-        
-    protected:
-        DeconstructionPatternNode(VM*);
-    };
-
-    class ArrayPatternNode : public DeconstructionPatternNode {
-    public:
-        static PassRefPtr<ArrayPatternNode> create(VM*);
-        void appendIndex(const JSTokenLocation&, DeconstructionPatternNode* node)
-        {
-            m_targetPatterns.append(node);
-        }
-
-    private:
-        ArrayPatternNode(VM*);
-        void collectBoundIdentifiers(Vector<Identifier>&) const;
-        void emitBytecode(BytecodeGenerator&, RegisterID*) const;
-        RegisterID* emitDirectBinding(BytecodeGenerator&, RegisterID* dst, ExpressionNode*);
-        void toString(StringBuilder&) const;
-
-        Vector<RefPtr<DeconstructionPatternNode>> m_targetPatterns;
-    };
-    
-    class ObjectPatternNode : public DeconstructionPatternNode {
-    public:
-        static PassRefPtr<ObjectPatternNode> create(VM*);
-        void appendEntry(const JSTokenLocation&, const Identifier& identifier, bool wasString, DeconstructionPatternNode* pattern)
-        {
-            m_targetPatterns.append(Entry(identifier, wasString, pattern));
-        }
-        
-    private:
-        ObjectPatternNode(VM*);
-        void collectBoundIdentifiers(Vector<Identifier>&) const;
-        void emitBytecode(BytecodeGenerator&, RegisterID*) const;
-        void toString(StringBuilder&) const;
-        struct Entry {
-            Entry(const Identifier& propertyName, bool wasString, DeconstructionPatternNode* pattern)
-                : propertyName(propertyName)
-                , wasString(wasString)
-                , pattern(pattern)
-            {
-            }
-            Identifier propertyName;
-            bool wasString;
-            RefPtr<DeconstructionPatternNode> pattern;
-        };
-        Vector<Entry> m_targetPatterns;
-    };
-
-    class BindingNode : public DeconstructionPatternNode, ThrowableExpressionData {
-    public:
-        static PassRefPtr<BindingNode> create(VM*, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end);
-        const Identifier& boundProperty() const { return m_boundProperty; }
-        
-    private:
-        BindingNode(VM*, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end);
-
-        void collectBoundIdentifiers(Vector<Identifier>&) const;
-        void emitBytecode(BytecodeGenerator&, RegisterID*) const;
-        void toString(StringBuilder&) const;
-        
-        virtual bool isBindingNode() const { return true; }
-        
-        Identifier m_boundProperty;
-    };
-
-    class DeconstructingAssignmentNode : public ExpressionNode, public ParserArenaDeletable {
-    public:
-        DeconstructingAssignmentNode(const JSTokenLocation&, PassRefPtr<DeconstructionPatternNode>, ExpressionNode*);
-        DeconstructionPatternNode* bindings() { return m_bindings.get(); }
-        
-        using ParserArenaDeletable::operator new;
-
-    private:
-        virtual bool isLocation() const { return true; }
-        virtual bool isDeconstructionNode() const { return true; }
-        virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
-
-        RefPtr<DeconstructionPatternNode> m_bindings;
-        ExpressionNode* m_initializer;
-    };
-
     class FuncDeclNode : public StatementNode {
     public:
         FuncDeclNode(const JSTokenLocation&, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0);
index 2619834..6b90539 100644 (file)
@@ -84,6 +84,7 @@ Parser<LexerType>::Parser(VM* vm, const SourceCode& source, FunctionParameters*
     m_token.m_location.startOffset = source.startOffset();
     m_token.m_location.endOffset = source.startOffset();
     m_token.m_location.lineStartOffset = source.startOffset();
+
     m_functionCache = vm->addSourceProviderCache(source.provider());
     ScopeRef scope = pushScope();
     if (parserMode == JSParseFunctionCode)
@@ -91,12 +92,8 @@ Parser<LexerType>::Parser(VM* vm, const SourceCode& source, FunctionParameters*
     if (strictness == JSParseStrict)
         scope->setStrictMode();
     if (parameters) {
-        for (unsigned i = 0; i < parameters->size(); i++) {
-            auto parameter = parameters->at(i);
-            if (!parameter->isBindingNode())
-                continue;
-            scope->declareParameter(&static_cast<BindingNode*>(parameter)->boundProperty());
-        }
+        for (unsigned i = 0; i < parameters->size(); i++)
+            scope->declareParameter(&parameters->at(i));
     }
     if (!name.isNull())
         scope->declareCallee(&name);
@@ -206,7 +203,7 @@ template <class TreeBuilder> TreeStatement Parser<LexerType>::parseVarDeclaratio
     int start = tokenLine();
     int end = 0;
     int scratch;
-    TreeDeconstructionPattern scratch1 = 0;
+    const Identifier* scratch1 = 0;
     TreeExpression scratch2 = 0;
     JSTextPosition scratch3;
     TreeExpression varDecls = parseVarDeclarationList(context, scratch, scratch1, scratch2, scratch3, scratch3, scratch3);
@@ -274,170 +271,43 @@ template <class TreeBuilder> TreeStatement Parser<LexerType>::parseWhileStatemen
 }
 
 template <typename LexerType>
-template <class TreeBuilder> TreeExpression Parser<LexerType>::parseVarDeclarationList(TreeBuilder& context, int& declarations, TreeDeconstructionPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd)
+template <class TreeBuilder> TreeExpression Parser<LexerType>::parseVarDeclarationList(TreeBuilder& context, int& declarations, const Identifier*& lastIdent, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd)
 {
     TreeExpression varDecls = 0;
-    const Identifier* lastIdent;
     do {
-        lastIdent = 0;
-        lastPattern = 0;
+        declarations++;
         JSTokenLocation location(tokenLocation());
         next();
-        TreeExpression node = 0;
-        declarations++;
-        bool hasInitializer = false;
-        if (match(IDENT)) {
-            JSTextPosition varStart = tokenStartPosition();
-            identStart = varStart;
-            const Identifier* name = m_token.m_data.ident;
-            lastIdent = name;
-            next();
-            hasInitializer = match(EQUAL);
-            failIfFalseIfStrictWithNameAndMessage(declareVariable(name), "Cannot declare a variable named", name->impl(), "in strict mode.");
-            context.addVar(name, (hasInitializer || (!m_allowsIn && match(INTOKEN))) ? DeclarationStacks::HasInitializer : 0);
-            if (hasInitializer) {
-                JSTextPosition varDivot = tokenStartPosition() + 1;
-                initStart = tokenStartPosition();
-                next(TreeBuilder::DontBuildStrings); // consume '='
-                TreeExpression initializer = parseAssignmentExpression(context);
-                initEnd = lastTokenEndPosition();
-                lastInitializer = initializer;
-                failIfFalse(initializer);
-                
-                node = context.createAssignResolve(location, *name, initializer, varStart, varDivot, lastTokenEndPosition());
-            }
-        } else {
-            lastIdent = 0;
-            auto pattern = parseDeconstructionPattern<DeconstructToVariables>(context);
-            failIfFalse(pattern);
-            hasInitializer = match(EQUAL);
-            lastPattern = pattern;
-            if (hasInitializer) {
-                next(TreeBuilder::DontBuildStrings); // consume '='
-                TreeExpression rhs = parseExpression(context);
-                node = context.createDeconstructingAssignment(location, pattern, rhs);
-            }
-            ASSERT(node);
-        }
+        matchOrFail(IDENT);
         
+        JSTextPosition varStart = tokenStartPosition();
+        identStart = varStart;
+        const Identifier* name = m_token.m_data.ident;
+        lastIdent = name;
+        next();
+        bool hasInitializer = match(EQUAL);
+        failIfFalseIfStrictWithNameAndMessage(declareVariable(name), "Cannot declare a variable named", name->impl(), "in strict mode.");
+        context.addVar(name, (hasInitializer || (!m_allowsIn && match(INTOKEN))) ? DeclarationStacks::HasInitializer : 0);
         if (hasInitializer) {
+            JSTextPosition varDivot = tokenStartPosition() + 1;
+            initStart = tokenStartPosition();
+            next(TreeBuilder::DontBuildStrings); // consume '='
+            TreeExpression initializer = parseAssignmentExpression(context);
+            initEnd = lastTokenEndPosition();
+            lastInitializer = initializer;
+            failIfFalse(initializer);
+            
+            TreeExpression node = context.createAssignResolve(location, *name, initializer, varStart, varDivot, lastTokenEndPosition());
             if (!varDecls)
                 varDecls = node;
             else
                 varDecls = context.combineCommaNodes(location, varDecls, node);
         }
     } while (match(COMMA));
-    if (lastIdent)
-        lastPattern = createBindingPattern<DeconstructToVariables>(context, *lastIdent, 0);
     return varDecls;
 }
 
 template <typename LexerType>
-template <DeconstructionKind kind, class TreeBuilder> TreeDeconstructionPattern Parser<LexerType>::createBindingPattern(TreeBuilder& context, const Identifier& name, int depth)
-{
-    ASSERT(!name.isEmpty());
-    ASSERT(!name.isNull());
-    
-    ASSERT(name.impl()->isIdentifier());
-    if (depth) {
-        if (kind == DeconstructToVariables)
-            failIfFalseIfStrictWithNameAndMessage(declareVariable(&name), "Cannot deconstruct to a variable named", name.impl(), ".");
-        if (kind == DeconstructToParameters) {
-            auto bindingResult = declareBoundParameter(&name);
-            failIfFalseIfStrictWithNameAndMessage(bindingResult != Scope::StrictBindingFailed, "Cannot deconstruct to a parameter named", name.impl(), "in strict mode.");
-            failIfFalseWithNameAndMessage(bindingResult != Scope::BindingFailed, "Cannot deconstruct to a parameter named", name.impl(), ".");
-        }
-        context.addVar(&name, kind == DeconstructToParameters ? 0 : DeclarationStacks::HasInitializer);
-    } else {
-        if (kind == DeconstructToVariables) {
-            failIfFalseIfStrictWithNameAndMessage(declareVariable(&name), "Cannot declare a variable named", name.impl(), "in strict mode.");
-            context.addVar(&name, DeclarationStacks::HasInitializer);
-        }
-        
-        if (kind == DeconstructToParameters)
-            failIfFalseIfStrictWithNameAndMessage(declareParameter(&name), "Cannot declare a parameter named", name.impl(), "in strict mode.");
-    }
-    return context.createBindingLocation(m_token.m_location, name, m_token.m_endPosition, m_token.m_startPosition, m_token.m_endPosition);
-}
-
-template <typename LexerType>
-template <DeconstructionKind kind, class TreeBuilder> TreeDeconstructionPattern Parser<LexerType>::parseDeconstructionPattern(TreeBuilder& context, int depth)
-{
-    failIfStackOverflow();
-    int nonLHSCount = m_nonLHSCount;
-    TreeDeconstructionPattern pattern;
-    switch (m_token.m_type) {
-    case OPENBRACKET: {
-        auto arrayPattern = context.createArrayPattern(m_token.m_location);
-        next();
-        do {
-            while (match(COMMA)) {
-                context.appendArrayPatternSkipEntry(arrayPattern, m_token.m_location);
-                next();
-            }
-            failIfTrue(hasError());
-            JSTokenLocation location = m_token.m_location;
-            auto innerPattern = parseDeconstructionPattern<kind>(context, depth + 1);
-            failIfFalse(innerPattern);
-            context.appendArrayPatternEntry(arrayPattern, location, innerPattern);
-        } while (consume(COMMA));
-        consumeOrFail(CLOSEBRACKET);
-        pattern = arrayPattern;
-        break;
-    }
-    case OPENBRACE: {
-        next();
-        auto objectPattern = context.createObjectPattern(m_token.m_location);
-        bool wasString = false;
-        do {
-            Identifier propertyName;
-            TreeDeconstructionPattern innerPattern = 0;
-            JSTokenLocation location = m_token.m_location;
-            if (match(IDENT)) {
-                propertyName = *m_token.m_data.ident;
-                next();
-                if (consume(COLON))
-                    innerPattern = parseDeconstructionPattern<kind>(context, depth + 1);
-                else
-                    innerPattern = createBindingPattern<kind>(context, propertyName, depth);
-            } else {
-                switch (m_token.m_type) {
-                case NUMBER:
-                    propertyName = Identifier::from(m_vm, m_token.m_data.doubleValue);
-                    break;
-                case STRING:
-                    propertyName = *m_token.m_data.ident;
-                    wasString = true;
-                    break;
-                default:
-                    failIfTrue(!(m_token.m_type & KeywordTokenFlag));
-                    propertyName = *m_token.m_data.ident;
-                    break;
-                }
-                next();
-                consumeOrFail(COLON);
-                innerPattern = parseDeconstructionPattern<kind>(context, depth + 1);
-            }
-            failIfFalse(innerPattern);
-            context.appendObjectPatternEntry(objectPattern, location, wasString, propertyName, innerPattern);
-        } while (consume(COMMA));
-        consumeOrFail(CLOSEBRACE);
-        pattern = objectPattern;
-        break;
-    }
-
-    default: {
-        matchOrFail(IDENT);
-        pattern = createBindingPattern<kind>(context, *m_token.m_data.ident, depth);
-        next();
-        break;
-    }
-    }
-    m_nonLHSCount = nonLHSCount;
-    return pattern;
-}
-
-template <typename LexerType>
 template <class TreeBuilder> TreeConstDeclList Parser<LexerType>::parseConstDeclarationList(TreeBuilder& context)
 {
     failIfTrue(strictMode());
@@ -481,9 +351,10 @@ template <class TreeBuilder> TreeStatement Parser<LexerType>::parseForStatement(
     if (match(VAR)) {
         /*
          for (var IDENT in expression) statement
+         for (var IDENT = expression in expression) statement
          for (var varDeclarationList; expressionOpt; expressionOpt)
          */
-        TreeDeconstructionPattern forInTarget = 0;
+        const Identifier* forInTarget = 0;
         TreeExpression forInInitializer = 0;
         m_allowsIn = false;
         JSTextPosition initStart;
@@ -498,7 +369,7 @@ template <class TreeBuilder> TreeStatement Parser<LexerType>::parseForStatement(
         
         failIfFalse(declarations == 1);
         failIfTrueWithMessage(forInInitializer, "Cannot use initialiser syntax in a for-in loop");
-        
+
         // Handle for-in with var declaration
         JSTextPosition inLocation = tokenStartPosition();
         consumeOrFail(INTOKEN);
@@ -515,6 +386,7 @@ template <class TreeBuilder> TreeStatement Parser<LexerType>::parseForStatement(
         TreeStatement statement = parseStatement(context, unused);
         endLoop();
         failIfFalse(statement);
+        
         return context.createForInLoop(location, forInTarget, expr, statement, declsStart, inLocation, exprEnd, startLine, endLine);
     }
     
@@ -900,14 +772,18 @@ template <class TreeBuilder> TreeStatement Parser<LexerType>::parseStatement(Tre
 template <typename LexerType>
 template <class TreeBuilder> TreeFormalParameterList Parser<LexerType>::parseFormalParameters(TreeBuilder& context)
 {
-    auto parameter = parseDeconstructionPattern<DeconstructToParameters>(context);
-    failIfFalse(parameter);
-    TreeFormalParameterList list = context.createFormalParameterList(parameter);
+    matchOrFail(IDENT);
+    failIfFalseIfStrictWithNameAndMessage(declareParameter(m_token.m_data.ident), "Cannot declare a parameter named", m_token.m_data.ident->impl(), " in strict mode");
+    TreeFormalParameterList list = context.createFormalParameterList(*m_token.m_data.ident);
     TreeFormalParameterList tail = list;
-    while (consume(COMMA)) {
-        parameter = parseDeconstructionPattern<DeconstructToParameters>(context);
-        failIfFalse(parameter);
-        tail = context.createFormalParameterList(tail, parameter);
+    next();
+    while (match(COMMA)) {
+        next();
+        matchOrFail(IDENT);
+        const Identifier* ident = m_token.m_data.ident;
+        failIfFalseIfStrictWithNameAndMessage(declareParameter(ident), "Cannot declare a parameter named", ident->impl(), "in strict mode");
+        next();
+        tail = context.createFormalParameterList(tail, *ident);
     }
     return list;
 }
@@ -1279,7 +1155,7 @@ template <typename TreeBuilder> TreeExpression Parser<LexerType>::parseAssignmen
             declareWrite(m_lastIdentifier);
             m_lastIdentifier = 0;
         }
-        lhs = parseAssignmentExpression(context);
+        lhs = parseConditionalExpression(context);
         failIfFalse(lhs);
         if (initialNonLHSCount != m_nonLHSCount)
             break;
index 818948b..d72ae17 100644 (file)
@@ -73,7 +73,6 @@ class SourceCode;
 #define TreeFunctionBody typename TreeBuilder::FunctionBody
 #define TreeProperty typename TreeBuilder::Property
 #define TreePropertyList typename TreeBuilder::PropertyList
-#define TreeDeconstructionPattern typename TreeBuilder::DeconstructionPattern
 
 COMPILE_ASSERT(LastUntaggedToken < 64, LessThan64UntaggedTokens);
 
@@ -229,26 +228,6 @@ struct Scope {
             m_shadowsArguments = true;
         return isValidStrictMode;
     }
-    
-    enum BindingResult {
-        BindingFailed,
-        StrictBindingFailed,
-        BindingSucceeded
-    };
-    BindingResult declareBoundParameter(const Identifier* ident)
-    {
-        bool isArguments = m_vm->propertyNames->arguments == *ident;
-        bool newEntry = m_declaredVariables.add(ident->string().impl()).isNewEntry;
-        bool isValidStrictMode = newEntry && m_vm->propertyNames->eval != *ident && !isArguments;
-        m_isValidStrictMode = m_isValidStrictMode && isValidStrictMode;
-    
-        if (isArguments)
-            m_shadowsArguments = true;
-        if (!newEntry)
-            return BindingFailed;
-        return isValidStrictMode ? BindingSucceeded : StrictBindingFailed;
-    }
-
 
     void useVariable(const Identifier* ident, bool isEval)
     {
@@ -882,7 +861,6 @@ private:
     bool strictMode() { return currentScope()->strictMode(); }
     bool isValidStrictMode() { return currentScope()->isValidStrictMode(); }
     bool declareParameter(const Identifier* ident) { return currentScope()->declareParameter(ident); }
-    Scope::BindingResult declareBoundParameter(const Identifier* ident) { return currentScope()->declareBoundParameter(ident); }
     bool breakIsValid()
     {
         ScopeRef current = currentScope();
@@ -953,11 +931,8 @@ private:
     template <bool strict, class TreeBuilder> ALWAYS_INLINE TreeProperty parseProperty(TreeBuilder&);
     template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&);
     template <class TreeBuilder> ALWAYS_INLINE TreeFormalParameterList parseFormalParameters(TreeBuilder&);
-    template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseVarDeclarationList(TreeBuilder&, int& declarations, TreeDeconstructionPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd);
-    template <class TreeBuilder> ALWAYS_INLINE TreeConstDeclList parseConstDeclarationList(TreeBuilder&);
-
-    template <DeconstructionKind, class TreeBuilder> ALWAYS_INLINE TreeDeconstructionPattern createBindingPattern(TreeBuilder&, const Identifier&, int depth);
-    template <DeconstructionKind, class TreeBuilder> TreeDeconstructionPattern parseDeconstructionPattern(TreeBuilder&, int depth = 0);
+    template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseVarDeclarationList(TreeBuilder&, int& declarations, const Identifier*& lastIdent, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd);
+    template <class TreeBuilder> ALWAYS_INLINE TreeConstDeclList parseConstDeclarationList(TreeBuilder& context);
     template <FunctionRequirements, bool nameIsInContainingScope, class TreeBuilder> bool parseFunctionInfo(TreeBuilder&, const Identifier*&, TreeFormalParameterList&, TreeFunctionBody&, unsigned& openBraceOffset, unsigned& closeBraceOffset, int& bodyStartLine, unsigned& bodyStartColumn);
     ALWAYS_INLINE int isBinaryOperator(JSTokenType);
     bool allowAutomaticSemicolon();
index 965ff0d..9929caf 100644 (file)
@@ -111,10 +111,7 @@ public:
     typedef int Clause;
     typedef int ConstDeclList;
     typedef int BinaryOperand;
-    typedef int DeconstructionPattern;
-    typedef int ArrayPattern;
-    typedef int ObjectPattern;
-
+    
     static const bool CreatesAST = false;
     static const bool NeedsFreeVariableInfo = false;
     static const bool CanUseFunctionCache = true;
@@ -176,8 +173,8 @@ public:
     int createPropertyList(const JSTokenLocation&, Property, int) { return 1; }
     int createElementList(int, int) { return 1; }
     int createElementList(int, int, int) { return 1; }
-    int createFormalParameterList(DeconstructionPattern) { return 1; }
-    int createFormalParameterList(int, DeconstructionPattern) { return 1; }
+    int createFormalParameterList(const Identifier&) { return 1; }
+    int createFormalParameterList(int, const Identifier&) { return 1; }
     int createClause(int, int) { return 1; }
     int createClauseList(int) { return 1; }
     int createClauseList(int, int) { return 1; }
@@ -188,6 +185,7 @@ public:
     int createIfStatement(const JSTokenLocation&, int, int, int, int) { return 1; }
     int createIfStatement(const JSTokenLocation&, int, int, int, int, int) { return 1; }
     int createForLoop(const JSTokenLocation&, int, int, int, int, int, int) { return 1; }
+    int createForInLoop(const JSTokenLocation&, const Identifier*, int, int, int, int, int, int, int) { return 1; }
     int createForInLoop(const JSTokenLocation&, int, int, int, int, int, int, int, int) { return 1; }
     int createEmptyStatement(const JSTokenLocation&) { return 1; }
     int createVarStatement(const JSTokenLocation&, int, int, int) { return 1; }
@@ -252,32 +250,7 @@ public:
     const Identifier& getName(const Property& property) const { ASSERT(property.name); return *property.name; }
     PropertyNode::Type getType(const Property& property) const { return property.type; }
     bool isResolve(ExpressionType expr) const { return expr == ResolveExpr || expr == ResolveEvalExpr; }
-    ExpressionType createDeconstructingAssignment(const JSTokenLocation&, int, ExpressionType)
-    {
-        return 1;
-    }
     
-    ArrayPattern createArrayPattern(const JSTokenLocation&)
-    {
-        return 1;
-    }
-    void appendArrayPatternSkipEntry(ArrayPattern, const JSTokenLocation&)
-    {
-    }
-    void appendArrayPatternEntry(ArrayPattern, const JSTokenLocation&, DeconstructionPattern)
-    {
-    }
-    ObjectPattern createObjectPattern(const JSTokenLocation&)
-    {
-        return 1;
-    }
-    void appendObjectPatternEntry(ArrayPattern, const JSTokenLocation&, bool, const Identifier&, DeconstructionPattern)
-    {
-    }
-    DeconstructionPattern createBindingLocation(const JSTokenLocation&, const Identifier&, const JSTextPosition&, const JSTextPosition&, const JSTextPosition&)
-    {
-        return 1;
-    }
 private:
     int m_topBinaryExpr;
     int m_topUnaryToken;
index 4f00d1f..1e14f3a 100644 (file)
@@ -302,15 +302,7 @@ static void appendStringToStringBuilder(StringBuilder& builder, const CharType*
         }
     }
 }
-
-void escapeStringToBuilder(StringBuilder& builder, const String& message)
-{
-    if (message.is8Bit())
-        appendStringToStringBuilder(builder, message.characters8(), message.length());
-    else
-        appendStringToStringBuilder(builder, message.characters16(), message.length());
-}
-
+    
 void Stringifier::appendQuotedString(StringBuilder& builder, const String& value)
 {
     int length = value.length();
index 732fe4d..59f19c1 100644 (file)
@@ -63,8 +63,6 @@ namespace JSC {
     JS_EXPORT_PRIVATE JSValue JSONParse(ExecState*, const String&);
     String JSONStringify(ExecState*, JSValue, unsigned indent);
 
-    void escapeStringToBuilder(StringBuilder&, const String&);
-    
 } // namespace JSC
 
 #endif // JSONObject_h