Diff
Modified: trunk/LayoutTests/ChangeLog (196703 => 196704)
--- trunk/LayoutTests/ChangeLog 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/LayoutTests/ChangeLog 2016-02-17 19:18:12 UTC (rev 196704)
@@ -1,3 +1,18 @@
+2016-02-17 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r196675.
+ https://bugs.webkit.org/show_bug.cgi?id=154344
+
+ "Causes major slowdowns on deltablue-varargs" (Requested by
+ keith_miller on #webkit).
+
+ Reverted changeset:
+
+ "Spread operator should be allowed when not the first argument
+ of parameter list"
+ https://bugs.webkit.org/show_bug.cgi?id=152721
+ http://trac.webkit.org/changeset/196675
+
2016-02-17 Nan Wang <n_w...@apple.com>
AX: Implement sentence related text marker functions using TextIterator
Modified: trunk/LayoutTests/js/basic-spread-expected.txt (196703 => 196704)
--- trunk/LayoutTests/js/basic-spread-expected.txt 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/LayoutTests/js/basic-spread-expected.txt 2016-02-17 19:18:12 UTC (rev 196704)
@@ -43,6 +43,46 @@
PASS args[1] is undefined
PASS args[2] is null
PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
+PASS passedThis is o
+PASS args[0] is 1
+PASS args[1] is undefined
+PASS args[2] is null
+PASS args[3] is 4
PASS a is [1,2,3]
PASS [...a] is [1,2,3]
PASS [...a] is [1,2,3]
Modified: trunk/LayoutTests/js/parser-syntax-check-expected.txt (196703 => 196704)
--- trunk/LayoutTests/js/parser-syntax-check-expected.txt 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/LayoutTests/js/parser-syntax-check-expected.txt 2016-02-17 19:18:12 UTC (rev 196704)
@@ -757,18 +757,18 @@
PASS Invalid: "function f() { o.foo(bar...) }"
PASS Invalid: "o[foo](bar...)"
PASS Invalid: "function f() { o[foo](bar...) }"
-PASS Valid: "foo(a,...bar)" with ReferenceError
-PASS Valid: "function f() { foo(a,...bar) }"
-PASS Valid: "o.foo(a,...bar)" with ReferenceError
-PASS Valid: "function f() { o.foo(a,...bar) }"
-PASS Valid: "o[foo](a,...bar)" with ReferenceError
-PASS Valid: "function f() { o[foo](a,...bar) }"
-PASS Valid: "foo(...bar, a)" with ReferenceError
-PASS Valid: "function f() { foo(...bar, a) }"
-PASS Valid: "o.foo(...bar, a)" with ReferenceError
-PASS Valid: "function f() { o.foo(...bar, a) }"
-PASS Valid: "o[foo](...bar, a)" with ReferenceError
-PASS Valid: "function f() { o[foo](...bar, a) }"
+PASS Invalid: "foo(a,...bar)"
+PASS Invalid: "function f() { foo(a,...bar) }"
+PASS Invalid: "o.foo(a,...bar)"
+PASS Invalid: "function f() { o.foo(a,...bar) }"
+PASS Invalid: "o[foo](a,...bar)"
+PASS Invalid: "function f() { o[foo](a,...bar) }"
+PASS Invalid: "foo(...bar, a)"
+PASS Invalid: "function f() { foo(...bar, a) }"
+PASS Invalid: "o.foo(...bar, a)"
+PASS Invalid: "function f() { o.foo(...bar, a) }"
+PASS Invalid: "o[foo](...bar, a)"
+PASS Invalid: "function f() { o[foo](...bar, a) }"
PASS Valid: "[...bar]" with ReferenceError
PASS Valid: "function f() { [...bar] }"
PASS Valid: "[a, ...bar]" with ReferenceError
Modified: trunk/LayoutTests/js/script-tests/basic-spread.js (196703 => 196704)
--- trunk/LayoutTests/js/script-tests/basic-spread.js 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/LayoutTests/js/script-tests/basic-spread.js 2016-02-17 19:18:12 UTC (rev 196704)
@@ -17,12 +17,18 @@
o.f = f;
var test1 = [1, undefined, null, 4]
var test2 = [1, , null, 4]
+var test3 = {length: 4, 0: 1, 2: null, 3: 4}
+var test4 = {length: 4, 0: 1, 1: undefined, 2: null, 3: 4}
o.f(...test1)
o.f(...test2)
+o.f(...test3)
+o.f(...test4)
var h=eval('"f"')
o[h](...test1)
o[h](...test2)
+o[h](...test3)
+o[h](...test4)
function g()
{
@@ -31,9 +37,13 @@
g.apply(null, test1)
g.apply(null, test2)
+g.apply(null, test3)
+g.apply(null, test4)
g(...test1)
g(...test2)
+g(...test3)
+g(...test4)
var a=[1,2,3]
Modified: trunk/LayoutTests/js/script-tests/parser-syntax-check.js (196703 => 196704)
--- trunk/LayoutTests/js/script-tests/parser-syntax-check.js 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/LayoutTests/js/script-tests/parser-syntax-check.js 2016-02-17 19:18:12 UTC (rev 196704)
@@ -471,12 +471,12 @@
invalid("foo(bar...)")
invalid("o.foo(bar...)")
invalid("o[foo](bar...)")
-valid("foo(a,...bar)")
-valid("o.foo(a,...bar)")
-valid("o[foo](a,...bar)")
-valid("foo(...bar, a)")
-valid("o.foo(...bar, a)")
-valid("o[foo](...bar, a)")
+invalid("foo(a,...bar)")
+invalid("o.foo(a,...bar)")
+invalid("o[foo](a,...bar)")
+invalid("foo(...bar, a)")
+invalid("o.foo(...bar, a)")
+invalid("o[foo](...bar, a)")
valid("[...bar]")
valid("[a, ...bar]")
valid("[...bar, a]")
Modified: trunk/Source/_javascript_Core/ChangeLog (196703 => 196704)
--- trunk/Source/_javascript_Core/ChangeLog 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-02-17 19:18:12 UTC (rev 196704)
@@ -1,3 +1,18 @@
+2016-02-17 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r196675.
+ https://bugs.webkit.org/show_bug.cgi?id=154344
+
+ "Causes major slowdowns on deltablue-varargs" (Requested by
+ keith_miller on #webkit).
+
+ Reverted changeset:
+
+ "Spread operator should be allowed when not the first argument
+ of parameter list"
+ https://bugs.webkit.org/show_bug.cgi?id=152721
+ http://trac.webkit.org/changeset/196675
+
2016-02-17 Gavin Barraclough <barraclo...@apple.com>
JSDOMWindow::put should not do the same thing twice
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (196703 => 196704)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2016-02-17 19:18:12 UTC (rev 196704)
@@ -247,7 +247,7 @@
void loadVarargs(CallFrame* callFrame, VirtualRegister firstElementDest, JSValue arguments, uint32_t offset, uint32_t length)
{
- if (UNLIKELY(!arguments.isCell()) || !length)
+ if (UNLIKELY(!arguments.isCell()))
return;
JSCell* cell = arguments.asCell();
Modified: trunk/Source/_javascript_Core/parser/ASTBuilder.h (196703 => 196704)
--- trunk/Source/_javascript_Core/parser/ASTBuilder.h 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/parser/ASTBuilder.h 2016-02-17 19:18:12 UTC (rev 196704)
@@ -441,17 +441,6 @@
ElementNode* createElementList(int elisions, ExpressionNode* expr) { return new (m_parserArena) ElementNode(elisions, expr); }
ElementNode* createElementList(ElementNode* elems, int elisions, ExpressionNode* expr) { return new (m_parserArena) ElementNode(elems, elisions, expr); }
- ElementNode* createElementList(ArgumentListNode* elems)
- {
- ElementNode* head = new (m_parserArena) ElementNode(0, elems->m_expr);
- ElementNode* tail = head;
- elems = elems->m_next;
- while (elems) {
- tail = new (m_parserArena) ElementNode(tail, 0, elems->m_expr);
- elems = elems->m_next;
- }
- return head;
- }
FormalParameterList createFormalParameterList() { return new (m_parserArena) FunctionParameters(); }
void appendParameter(FormalParameterList list, DestructuringPattern pattern, ExpressionNode* defaultValue)
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (196703 => 196704)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2016-02-17 19:18:12 UTC (rev 196704)
@@ -3703,7 +3703,7 @@
}
template <typename LexerType>
-template <class TreeBuilder> TreeArguments Parser<LexerType>::parseArguments(TreeBuilder& context)
+template <class TreeBuilder> TreeArguments Parser<LexerType>::parseArguments(TreeBuilder& context, SpreadMode mode)
{
consumeOrFailWithFlags(OPENPAREN, TreeBuilder::DontBuildStrings, "Expected opening '(' at start of argument list");
JSTokenLocation location(tokenLocation());
@@ -3711,63 +3711,42 @@
next(TreeBuilder::DontBuildStrings);
return context.createArguments();
}
- auto argumentsStart = m_token.m_startPosition;
- auto argumentsDivot = m_token.m_endPosition;
-
- ArgumentType argType = ArgumentType::Normal;
- TreeExpression firstArg = parseArgument(context, argType);
+ if (match(DOTDOTDOT) && mode == AllowSpread) {
+ JSTokenLocation spreadLocation(tokenLocation());
+ auto start = m_token.m_startPosition;
+ auto divot = m_token.m_endPosition;
+ next();
+ auto spreadExpr = parseAssignmentExpression(context);
+ auto end = m_lastTokenEndPosition;
+ if (!spreadExpr)
+ failWithMessage("Cannot parse spread _expression_");
+ if (!consume(CLOSEPAREN)) {
+ if (match(COMMA))
+ semanticFail("Spread operator may only be applied to the last argument passed to a function");
+ handleProductionOrFail(CLOSEPAREN, ")", "end", "argument list");
+ }
+ auto spread = context.createSpreadExpression(spreadLocation, spreadExpr, start, divot, end);
+ TreeArgumentsList argList = context.createArgumentsList(location, spread);
+ return context.createArguments(argList);
+ }
+ TreeExpression firstArg = parseAssignmentExpression(context);
failIfFalse(firstArg, "Cannot parse function argument");
- semanticFailIfTrue(match(DOTDOTDOT), "The '...' operator should come before the target _expression_");
-
- bool hasSpread = false;
- if (argType == ArgumentType::Spread)
- hasSpread = true;
+
TreeArgumentsList argList = context.createArgumentsList(location, firstArg);
TreeArgumentsList tail = argList;
-
while (match(COMMA)) {
JSTokenLocation argumentLocation(tokenLocation());
next(TreeBuilder::DontBuildStrings);
-
- TreeExpression arg = parseArgument(context, argType);
- propagateError();
- semanticFailIfTrue(match(DOTDOTDOT), "The '...' operator should come before the target _expression_");
-
- if (argType == ArgumentType::Spread)
- hasSpread = true;
-
+ TreeExpression arg = parseAssignmentExpression(context);
+ failIfFalse(arg, "Cannot parse function argument");
tail = context.createArgumentsList(argumentLocation, tail, arg);
}
-
+ semanticFailIfTrue(match(DOTDOTDOT), "The '...' operator should come before the target _expression_");
handleProductionOrFail(CLOSEPAREN, ")", "end", "argument list");
- if (hasSpread) {
- TreeExpression spreadArray = context.createSpreadExpression(location, context.createArray(location, context.createElementList(argList)), argumentsStart, argumentsDivot, m_lastTokenEndPosition);
- return context.createArguments(context.createArgumentsList(location, spreadArray));
- }
-
return context.createArguments(argList);
}
template <typename LexerType>
-template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArgument(TreeBuilder& context, ArgumentType& type)
-{
- if (UNLIKELY(match(DOTDOTDOT))) {
- JSTokenLocation spreadLocation(tokenLocation());
- auto start = m_token.m_startPosition;
- auto divot = m_token.m_endPosition;
- next();
- TreeExpression spreadExpr = parseAssignmentExpression(context);
- propagateError();
- auto end = m_lastTokenEndPosition;
- type = ArgumentType::Spread;
- return context.createSpreadExpression(spreadLocation, spreadExpr, start, divot, end);
- }
-
- type = ArgumentType::Normal;
- return parseAssignmentExpression(context);
-}
-
-template <typename LexerType>
template <class TreeBuilder> TreeExpression Parser<LexerType>::parseMemberExpression(TreeBuilder& context)
{
TreeExpression base = 0;
@@ -3835,12 +3814,12 @@
if (newCount) {
newCount--;
JSTextPosition expressionEnd = lastTokenEndPosition();
- TreeArguments arguments = parseArguments(context);
+ TreeArguments arguments = parseArguments(context, AllowSpread);
failIfFalse(arguments, "Cannot parse call arguments");
base = context.createNewExpr(location, base, arguments, expressionStart, expressionEnd, lastTokenEndPosition());
} else {
JSTextPosition expressionEnd = lastTokenEndPosition();
- TreeArguments arguments = parseArguments(context);
+ TreeArguments arguments = parseArguments(context, AllowSpread);
failIfFalse(arguments, "Cannot parse call arguments");
if (baseIsSuper)
currentFunctionScope()->setHasDirectSuper();
Modified: trunk/Source/_javascript_Core/parser/Parser.h (196703 => 196704)
--- trunk/Source/_javascript_Core/parser/Parser.h 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/parser/Parser.h 2016-02-17 19:18:12 UTC (rev 196704)
@@ -677,11 +677,6 @@
unsigned m_index;
};
-enum class ArgumentType {
- Normal,
- Spread
-};
-
template <typename LexerType>
class Parser {
WTF_MAKE_NONCOPYABLE(Parser);
@@ -1244,8 +1239,8 @@
template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseObjectLiteral(TreeBuilder&);
template <class TreeBuilder> NEVER_INLINE TreeExpression parseStrictObjectLiteral(TreeBuilder&);
template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseFunctionExpression(TreeBuilder&);
- template <class TreeBuilder> ALWAYS_INLINE TreeArguments parseArguments(TreeBuilder&);
- template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseArgument(TreeBuilder&, ArgumentType&);
+ enum SpreadMode { AllowSpread, DontAllowSpread };
+ template <class TreeBuilder> ALWAYS_INLINE TreeArguments parseArguments(TreeBuilder&, SpreadMode);
template <class TreeBuilder> TreeProperty parseProperty(TreeBuilder&, bool strict);
template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator);
template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind = ConstructorKind::None, SuperBinding = SuperBinding::NotNeeded);
Modified: trunk/Source/_javascript_Core/parser/SyntaxChecker.h (196703 => 196704)
--- trunk/Source/_javascript_Core/parser/SyntaxChecker.h 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/parser/SyntaxChecker.h 2016-02-17 19:18:12 UTC (rev 196704)
@@ -221,7 +221,6 @@
int createPropertyList(const JSTokenLocation&, Property, int) { return PropertyListResult; }
int createElementList(int, int) { return ElementsListResult; }
int createElementList(int, int, int) { return ElementsListResult; }
- int createElementList(int) { return ElementsListResult; }
int createFormalParameterList() { return FormalParameterListResult; }
void appendParameter(int, DestructuringPattern, int) { }
int createClause(int, int) { return ClauseResult; }
Modified: trunk/Source/_javascript_Core/tests/es6.yaml (196703 => 196704)
--- trunk/Source/_javascript_Core/tests/es6.yaml 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/tests/es6.yaml 2016-02-17 19:18:12 UTC (rev 196704)
@@ -1113,11 +1113,11 @@
- path: es6/Set_Set[Symbol.species].js
cmd: runES6 :normal
- path: es6/spread_..._operator_with_astral_plane_strings_in_function_calls.js
- cmd: runES6 :normal
+ cmd: runES6 :fail
- path: es6/spread_..._operator_with_generator_instances_in_arrays.js
cmd: runES6 :normal
- path: es6/spread_..._operator_with_generator_instances_in_calls.js
- cmd: runES6 :normal
+ cmd: runES6 :fail
- path: es6/spread_..._operator_with_generic_iterables_in_arrays.js
cmd: runES6 :fail
- path: es6/spread_..._operator_with_generic_iterables_in_calls.js
@@ -1127,7 +1127,7 @@
- path: es6/spread_..._operator_with_instances_of_iterables_in_calls.js
cmd: runES6 :fail
- path: es6/spread_..._operator_with_strings_in_function_calls.js
- cmd: runES6 :normal
+ cmd: runES6 :fail
- path: es6/typed_arrays_%TypedArray%.from.js
cmd: runES6 :normal
- path: es6/typed_arrays_%TypedArray%.of.js
Deleted: trunk/Source/_javascript_Core/tests/stress/spread-calling.js (196703 => 196704)
--- trunk/Source/_javascript_Core/tests/stress/spread-calling.js 2016-02-17 19:17:09 UTC (rev 196703)
+++ trunk/Source/_javascript_Core/tests/stress/spread-calling.js 2016-02-17 19:18:12 UTC (rev 196704)
@@ -1,81 +0,0 @@
-function testFunction() {
- if (arguments.length !== 10)
- throw "wrong number of arguments expected 10 was " + arguments.length;
- for (let i in arguments) {
- if ((arguments[i] | 0) !== (i | 0))
- throw "argument " + i + " expected " + i + " was " + arguments[i];
- }
-}
-
-function testEmpty() {
- if (arguments.length !== 0)
- throw "wrong length expected 0 was " + arguments.length;
-}
-
-iter = Array.prototype.values;
-
-function makeObject(array, iterator) {
- let obj = { [Symbol.iterator]: iterator, length: array.length };
- for (let i in array)
- obj[i] = array[i];
- return obj;
-}
-
-function otherIterator() {
- return {
- count: 6,
- next: function() {
- if (this.count < 10)
- return { value: this.count++, done: false };
- return { done: true };
- }
- };
-}
-
-count = 0;
-function* totalIter() {
- for (let i = count; i < count+5; i++) {
- yield i;
- }
- count += 5;
-}
-
-function throwingIter() {
- return {
- count: 0,
- next: function() {
- if (this.count < 10)
- return { value: this.count++, done: false };
- throw new Error("this should have been caught");
- }
- };
-}
-
-object1 = makeObject([1, 2, 3], iter);
-object2 = makeObject([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], iter);
-object3 = makeObject([], otherIterator);
-object4 = makeObject([], totalIter);
-objectThrow = makeObject([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], throwingIter);
-
-for (let i = 0; i < 10000; i++) {
- count = 0;
- testFunction(0, ...[1, 2, 3], ...[4], 5, 6, ...[7, 8, 9]);
- testFunction(...[0, 1], 2, 3, ...[4, 5, 6, 7, 8], 9);
- testFunction(...[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
- testFunction(0, ...object1, 4, 5, ...[6, 7, 8, 9]);
- testFunction(...object2);
- testFunction(0, ...object1, 4, 5, ...object3);
- testFunction(0, ..."12345", ...object3);
- testEmpty(...[]);
- testFunction(...object4, ...object4);
- let failed = false;
- try {
- testFunction(...objectThrow);
- failed = true;
- } catch (e) {
- if (!e instanceof Error)
- failed = true;
- }
- if (failed)
- throw "did not throw an exeption even though it should have";
-}