Changeset 186959 in webkit


Ignore:
Timestamp:
Jul 17, 2015, 11:48:30 AM (10 years ago)
Author:
saambarati1@gmail.com
Message:

Function parameters should be parsed in the same parser arena as the function body
https://bugs.webkit.org/show_bug.cgi?id=145995

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

This patch changes how functions are parsed in JSC. A function's
parameters are now parsed in the same arena as the function itself.
This allows us to arena allocate all destructuring AST nodes and
the FunctionParameters node. This will help make implementing ES6
default parameter values sane.

A source code that represents a function now includes the text of the function's
parameters. The starting offset is at the opening parenthesis of the parameter
list or at the starting character of the identifier for arrow functions that
have single arguments and don't start with parenthesis.

For example:

"function (param1, param2) { ... }"


| This offset used to be the starting offset of a function's SourceCode


| This is the new starting offset for a function's SourceCode.

This requires us to change how some offsets are calculated
and also requires us to report some different line numbers for internal
metrics that use a SourceCode's starting line and column numbers.

This patch also does a bit of cleanup with regards to how
functions are parsed in general (especially arrow functions).
It removes some unnecessary #ifdefs and the likes for arrow
to make things clearer and more deliberate.

  • API/JSScriptRef.cpp:

(parseScript):

  • builtins/BuiltinExecutables.cpp:

(JSC::BuiltinExecutables::createExecutableInternal):

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::generateFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::visitChildren):
(JSC::UnlinkedFunctionExecutable::parameterCount): Deleted.

  • bytecode/UnlinkedCodeBlock.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::DestructuringAssignmentNode::emitBytecode):
(JSC::assignDefaultValueIfUndefined):
(JSC::ArrayPatternNode::collectBoundIdentifiers):
(JSC::DestructuringPatternNode::~DestructuringPatternNode): Deleted.

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createClassExpr):
(JSC::ASTBuilder::createFunctionExpr):
(JSC::ASTBuilder::createFunctionBody):
(JSC::ASTBuilder::createArrowFunctionExpr):
(JSC::ASTBuilder::createGetterOrSetterProperty):
(JSC::ASTBuilder::createElementList):
(JSC::ASTBuilder::createFormalParameterList):
(JSC::ASTBuilder::appendParameter):
(JSC::ASTBuilder::createClause):
(JSC::ASTBuilder::createClauseList):
(JSC::ASTBuilder::createFuncDeclStatement):
(JSC::ASTBuilder::createForInLoop):
(JSC::ASTBuilder::createForOfLoop):
(JSC::ASTBuilder::isResolve):
(JSC::ASTBuilder::createDestructuringAssignment):
(JSC::ASTBuilder::createArrayPattern):
(JSC::ASTBuilder::appendArrayPatternSkipEntry):
(JSC::ASTBuilder::appendArrayPatternEntry):
(JSC::ASTBuilder::appendArrayPatternRestEntry):
(JSC::ASTBuilder::finishArrayPattern):
(JSC::ASTBuilder::createObjectPattern):
(JSC::ASTBuilder::appendObjectPatternEntry):
(JSC::ASTBuilder::createBindingLocation):
(JSC::ASTBuilder::setEndOffset):

  • parser/Lexer.cpp:

(JSC::Lexer<T>::Lexer):
(JSC::Lexer<T>::nextTokenIsColon):
(JSC::Lexer<T>::setTokenPosition):
(JSC::Lexer<T>::lex):
(JSC::Lexer<T>::clear):

  • parser/Lexer.h:

(JSC::Lexer::setIsReparsingFunction):
(JSC::Lexer::isReparsingFunction):
(JSC::Lexer::lineNumber):
(JSC::Lexer::setIsReparsing): Deleted.
(JSC::Lexer::isReparsing): Deleted.

  • parser/NodeConstructors.h:

(JSC::TryNode::TryNode):
(JSC::FunctionParameters::FunctionParameters):
(JSC::FuncExprNode::FuncExprNode):
(JSC::FuncDeclNode::FuncDeclNode):
(JSC::ArrayPatternNode::ArrayPatternNode):
(JSC::ObjectPatternNode::ObjectPatternNode):
(JSC::BindingNode::BindingNode):
(JSC::DestructuringAssignmentNode::DestructuringAssignmentNode):
(JSC::ParameterNode::ParameterNode): Deleted.
(JSC::ArrayPatternNode::create): Deleted.
(JSC::ObjectPatternNode::create): Deleted.
(JSC::BindingNode::create): Deleted.

  • parser/Nodes.cpp:

(JSC::ProgramNode::ProgramNode):
(JSC::EvalNode::EvalNode):
(JSC::FunctionBodyNode::FunctionBodyNode):
(JSC::FunctionBodyNode::finishParsing):
(JSC::FunctionNode::FunctionNode):
(JSC::FunctionNode::finishParsing):
(JSC::FunctionParameters::create): Deleted.
(JSC::FunctionParameters::FunctionParameters): Deleted.
(JSC::FunctionParameters::~FunctionParameters): Deleted.

  • parser/Nodes.h:

(JSC::ProgramNode::startColumn):
(JSC::ProgramNode::endColumn):
(JSC::EvalNode::startColumn):
(JSC::EvalNode::endColumn):
(JSC::FunctionParameters::size):
(JSC::FunctionParameters::at):
(JSC::FunctionParameters::append):
(JSC::FuncExprNode::body):
(JSC::DestructuringPatternNode::~DestructuringPatternNode):
(JSC::DestructuringPatternNode::isBindingNode):
(JSC::DestructuringPatternNode::emitDirectBinding):
(JSC::ArrayPatternNode::appendIndex):
(JSC::ObjectPatternNode::appendEntry):
(JSC::BindingNode::boundProperty):
(JSC::BindingNode::divotStart):
(JSC::BindingNode::divotEnd):
(JSC::DestructuringAssignmentNode::bindings):
(JSC::FuncDeclNode::body):
(JSC::ParameterNode::pattern): Deleted.
(JSC::ParameterNode::nextParam): Deleted.
(JSC::FunctionParameters::patterns): Deleted.

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::Parser):
(JSC::Parser<LexerType>::~Parser):
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::allowAutomaticSemicolon):
(JSC::Parser<LexerType>::parseSourceElements):
(JSC::Parser<LexerType>::createBindingPattern):
(JSC::Parser<LexerType>::parseArrowFunctionSingleExpressionBodySourceElements):
(JSC::Parser<LexerType>::tryParseDestructuringPatternExpression):
(JSC::Parser<LexerType>::parseSwitchClauses):
(JSC::Parser<LexerType>::parseSwitchDefaultClause):
(JSC::Parser<LexerType>::parseBlockStatement):
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::parseFormalParameters):
(JSC::Parser<LexerType>::parseFunctionBody):
(JSC::stringForFunctionMode):
(JSC::Parser<LexerType>::parseFunctionParameters):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseFunctionDeclaration):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):
(JSC::Parser<LexerType>::parseArrowFunctionExpression):
(JSC::operatorString):
(JSC::Parser<LexerType>::parseArrowFunctionSingleExpressionBody): Deleted.

  • parser/Parser.h:

(JSC::Parser::positionBeforeLastNewline):
(JSC::Parser::locationBeforeLastToken):
(JSC::Parser::findCachedFunctionInfo):
(JSC::Parser::isofToken):
(JSC::Parser::isEndOfArrowFunction):
(JSC::Parser::isArrowFunctionParamters):
(JSC::Parser::tokenStart):
(JSC::Parser::isLETMaskedAsIDENT):
(JSC::Parser::autoSemiColon):
(JSC::Parser::setEndOfStatement):
(JSC::Parser::canRecurse):
(JSC::Parser<LexerType>::parse):
(JSC::parse):

  • parser/ParserFunctionInfo.h:
  • parser/ParserModes.h:

(JSC::functionNameIsInScope):

  • parser/SourceCode.h:

(JSC::makeSource):
(JSC::SourceCode::subExpression):
(JSC::SourceCode::subArrowExpression): Deleted.

  • parser/SourceProviderCache.h:

(JSC::SourceProviderCache::get):

  • parser/SourceProviderCacheItem.h:

(JSC::SourceProviderCacheItem::endFunctionToken):
(JSC::SourceProviderCacheItem::usedVariables):
(JSC::SourceProviderCacheItem::writtenVariables):
(JSC::SourceProviderCacheItem::SourceProviderCacheItem):

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::SyntaxChecker):
(JSC::SyntaxChecker::createClassExpr):
(JSC::SyntaxChecker::createFunctionExpr):
(JSC::SyntaxChecker::createFunctionBody):
(JSC::SyntaxChecker::createArrowFunctionExpr):
(JSC::SyntaxChecker::setFunctionNameStart):
(JSC::SyntaxChecker::createArguments):
(JSC::SyntaxChecker::createPropertyList):
(JSC::SyntaxChecker::createElementList):
(JSC::SyntaxChecker::createFormalParameterList):
(JSC::SyntaxChecker::appendParameter):
(JSC::SyntaxChecker::createClause):
(JSC::SyntaxChecker::createClauseList):

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getGlobalCodeBlock):
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):

  • runtime/Completion.cpp:

(JSC::checkSyntax):

  • runtime/Executable.cpp:

(JSC::ProgramExecutable::checkSyntax):

  • tests/controlFlowProfiler/conditional-expression.js:

(testConditionalFunctionCall):

LayoutTests:

  • fast/profiler/anonymous-event-handler-expected.txt:
  • fast/profiler/anonymous-function-called-from-different-contexts-expected.txt:
  • fast/profiler/anonymous-function-calls-built-in-functions-expected.txt:
  • fast/profiler/anonymous-function-calls-eval-expected.txt:
  • fast/profiler/anonymous-functions-with-display-names-expected.txt:
  • fast/profiler/apply-expected.txt:
  • fast/profiler/built-in-function-calls-anonymous-expected.txt:
  • fast/profiler/built-in-function-calls-user-defined-function-expected.txt:
  • fast/profiler/call-expected.txt:
  • fast/profiler/calling-the-function-that-started-the-profiler-from-another-scope-expected.txt:
  • fast/profiler/compare-multiple-profiles-expected.txt:
  • fast/profiler/constructor-expected.txt:
  • fast/profiler/dead-time-expected.txt:
  • fast/profiler/document-dot-write-expected.txt:
  • fast/profiler/event-handler-expected.txt:
  • fast/profiler/execution-context-and-eval-on-same-line-expected.txt:
  • fast/profiler/inline-event-handler-expected.txt:
  • fast/profiler/many-calls-in-the-same-scope-expected.txt:
  • fast/profiler/multiple-and-different-scoped-anonymous-function-calls-expected.txt:
  • fast/profiler/multiple-and-different-scoped-function-calls-expected.txt:
  • fast/profiler/multiple-anonymous-functions-called-from-the-same-function-expected.txt:
  • fast/profiler/multiple-frames-expected.txt:
  • fast/profiler/named-functions-with-display-names-expected.txt:
  • fast/profiler/nested-anonymous-functon-expected.txt:
  • fast/profiler/nested-start-and-stop-profiler-expected.txt:
  • fast/profiler/one-execution-context-expected.txt:
  • fast/profiler/profile-calls-in-included-file-expected.txt:
  • fast/profiler/profile-with-no-title-expected.txt:
  • fast/profiler/profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting-expected.txt:
  • fast/profiler/profiling-from-a-nested-location-expected.txt:
  • fast/profiler/simple-event-call-expected.txt:
  • fast/profiler/simple-no-level-change-expected.txt:
  • fast/profiler/start-and-stop-profiler-multiple-times-expected.txt:
  • fast/profiler/start-and-stop-profiling-in-the-same-function-expected.txt:
  • fast/profiler/stop-profiling-after-setTimeout-expected.txt:
  • fast/profiler/stop-then-function-call-expected.txt:
  • fast/profiler/two-execution-contexts-expected.txt:
  • fast/profiler/user-defined-function-calls-built-in-functions-expected.txt:
  • fast/profiler/window-dot-eval-expected.txt:
  • js/dom/script-start-end-locations-expected.txt:
Location:
trunk
Files:
65 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r186957 r186959  
     12015-07-17  Saam barati  <saambarati1@gmail.com>
     2
     3        Function parameters should be parsed in the same parser arena as the function body
     4        https://bugs.webkit.org/show_bug.cgi?id=145995
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * fast/profiler/anonymous-event-handler-expected.txt:
     9        * fast/profiler/anonymous-function-called-from-different-contexts-expected.txt:
     10        * fast/profiler/anonymous-function-calls-built-in-functions-expected.txt:
     11        * fast/profiler/anonymous-function-calls-eval-expected.txt:
     12        * fast/profiler/anonymous-functions-with-display-names-expected.txt:
     13        * fast/profiler/apply-expected.txt:
     14        * fast/profiler/built-in-function-calls-anonymous-expected.txt:
     15        * fast/profiler/built-in-function-calls-user-defined-function-expected.txt:
     16        * fast/profiler/call-expected.txt:
     17        * fast/profiler/calling-the-function-that-started-the-profiler-from-another-scope-expected.txt:
     18        * fast/profiler/compare-multiple-profiles-expected.txt:
     19        * fast/profiler/constructor-expected.txt:
     20        * fast/profiler/dead-time-expected.txt:
     21        * fast/profiler/document-dot-write-expected.txt:
     22        * fast/profiler/event-handler-expected.txt:
     23        * fast/profiler/execution-context-and-eval-on-same-line-expected.txt:
     24        * fast/profiler/inline-event-handler-expected.txt:
     25        * fast/profiler/many-calls-in-the-same-scope-expected.txt:
     26        * fast/profiler/multiple-and-different-scoped-anonymous-function-calls-expected.txt:
     27        * fast/profiler/multiple-and-different-scoped-function-calls-expected.txt:
     28        * fast/profiler/multiple-anonymous-functions-called-from-the-same-function-expected.txt:
     29        * fast/profiler/multiple-frames-expected.txt:
     30        * fast/profiler/named-functions-with-display-names-expected.txt:
     31        * fast/profiler/nested-anonymous-functon-expected.txt:
     32        * fast/profiler/nested-start-and-stop-profiler-expected.txt:
     33        * fast/profiler/one-execution-context-expected.txt:
     34        * fast/profiler/profile-calls-in-included-file-expected.txt:
     35        * fast/profiler/profile-with-no-title-expected.txt:
     36        * fast/profiler/profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting-expected.txt:
     37        * fast/profiler/profiling-from-a-nested-location-expected.txt:
     38        * fast/profiler/simple-event-call-expected.txt:
     39        * fast/profiler/simple-no-level-change-expected.txt:
     40        * fast/profiler/start-and-stop-profiler-multiple-times-expected.txt:
     41        * fast/profiler/start-and-stop-profiling-in-the-same-function-expected.txt:
     42        * fast/profiler/stop-profiling-after-setTimeout-expected.txt:
     43        * fast/profiler/stop-then-function-call-expected.txt:
     44        * fast/profiler/two-execution-contexts-expected.txt:
     45        * fast/profiler/user-defined-function-calls-built-in-functions-expected.txt:
     46        * fast/profiler/window-dot-eval-expected.txt:
     47        * js/dom/script-start-end-locations-expected.txt:
     48
    1492015-07-17  Benjamin Poulain  <bpoulain@apple.com>
    250
  • trunk/LayoutTests/fast/profiler/anonymous-event-handler-expected.txt

    r163140 r186959  
    55Profile title: Anonymous event handler
    66Thread_1 (no file) (line 0:0)
    7    startTest anonymous-event-handler.html (line 11:1)
     7   startTest anonymous-event-handler.html (line 10:19)
    88      getElementById (no file) (line 0:0)
    99      click (no file) (line 0:0)
    10          onclick anonymous-event-handler.html (line 15:54)
    11             insertNewText profiler-test-JS-resources.js (line 17:26)
     10         onclick anonymous-event-handler.html (line 15:51)
     11            insertNewText profiler-test-JS-resources.js (line 17:23)
    1212               createElement (no file) (line 0:0)
    1313               createTextNode (no file) (line 0:0)
    1414               appendChild (no file) (line 0:0)
    1515               getElementById (no file) (line 0:0)
    16       endTest profiler-test-JS-resources.js (line 1:20)
     16      endTest profiler-test-JS-resources.js (line 1:17)
    1717
    1818
  • trunk/LayoutTests/fast/profiler/anonymous-function-called-from-different-contexts-expected.txt

    r163140 r186959  
    55Profile title: Same anonymous function called from different contexts
    66Thread_1 (no file) (line 0:0)
    7    startTest anonymous-function-called-from-different-contexts.html (line 11:1)
    8       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    9          insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest anonymous-function-called-from-different-contexts.html (line 10:19)
     8      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     9         insertNewText profiler-test-JS-resources.js (line 17:23)
    1010            createElement (no file) (line 0:0)
    1111            createTextNode (no file) (line 0:0)
     
    1414      eval (no file) (line 0:0)
    1515         (program) (no file) (line 1:1)
    16             anonymousFunction profiler-test-JS-resources.js (line 29:37)
    17                insertNewText profiler-test-JS-resources.js (line 17:26)
     16            anonymousFunction profiler-test-JS-resources.js (line 29:34)
     17               insertNewText profiler-test-JS-resources.js (line 17:23)
    1818                  createElement (no file) (line 0:0)
    1919                  createTextNode (no file) (line 0:0)
    2020                  appendChild (no file) (line 0:0)
    2121                  getElementById (no file) (line 0:0)
    22       endTest profiler-test-JS-resources.js (line 1:20)
     22      endTest profiler-test-JS-resources.js (line 1:17)
    2323
    2424
  • trunk/LayoutTests/fast/profiler/anonymous-function-calls-built-in-functions-expected.txt

    r163140 r186959  
    55Profile title: Anonymous function calls built-in functions
    66Thread_1 (no file) (line 0:0)
    7    startTest anonymous-function-calls-built-in-functions.html (line 11:1)
    8       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    9          insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest anonymous-function-calls-built-in-functions.html (line 10:19)
     8      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     9         insertNewText profiler-test-JS-resources.js (line 17:23)
    1010            createElement (no file) (line 0:0)
    1111            createTextNode (no file) (line 0:0)
    1212            appendChild (no file) (line 0:0)
    1313            getElementById (no file) (line 0:0)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616
  • trunk/LayoutTests/fast/profiler/anonymous-function-calls-eval-expected.txt

    r163140 r186959  
    55Profile title: Anonymous function calles eval
    66Thread_1 (no file) (line 0:0)
    7    startTest anonymous-function-calls-eval.html (line 11:1)
    8       variableThatPointsToAnAnonymousFunction anonymous-function-calls-eval.html (line 14:62)
     7   startTest anonymous-function-calls-eval.html (line 10:19)
     8      variableThatPointsToAnAnonymousFunction anonymous-function-calls-eval.html (line 14:59)
    99         eval (no file) (line 0:0)
    1010            (program) (no file) (line 1:1)
    11                insertNewText profiler-test-JS-resources.js (line 17:26)
     11               insertNewText profiler-test-JS-resources.js (line 17:23)
    1212                  createElement (no file) (line 0:0)
    1313                  createTextNode (no file) (line 0:0)
    1414                  appendChild (no file) (line 0:0)
    1515                  getElementById (no file) (line 0:0)
    16       endTest profiler-test-JS-resources.js (line 1:20)
     16      endTest profiler-test-JS-resources.js (line 1:17)
    1717
    1818
  • trunk/LayoutTests/fast/profiler/anonymous-functions-with-display-names-expected.txt

    r163140 r186959  
    55Profile title: Anonymous functions with display names
    66Thread_1 (no file) (line 0:0)
    7    startTest anonymous-functions-with-display-names.html (line 23:1)
    8       anonymousFunctionGenerator anonymous-functions-with-display-names.html (line 11:1)
    9       0 iterations function anonymous-functions-with-display-names.html (line 13:5)
    10       1 iterations function anonymous-functions-with-display-names.html (line 13:5)
    11       2 iterations function anonymous-functions-with-display-names.html (line 13:5)
    12       20 iterations function anonymous-functions-with-display-names.html (line 13:5)
    13       1000 iterations function anonymous-functions-with-display-names.html (line 13:5)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest anonymous-functions-with-display-names.html (line 22:19)
     8      anonymousFunctionGenerator anonymous-functions-with-display-names.html (line 10:36)
     9      0 iterations function anonymous-functions-with-display-names.html (line 12:59)
     10      1 iterations function anonymous-functions-with-display-names.html (line 12:59)
     11      2 iterations function anonymous-functions-with-display-names.html (line 12:59)
     12      20 iterations function anonymous-functions-with-display-names.html (line 12:59)
     13      1000 iterations function anonymous-functions-with-display-names.html (line 12:59)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616
  • trunk/LayoutTests/fast/profiler/apply-expected.txt

    r163140 r186959  
    55Profile title: Using the apply() method
    66Thread_1 (no file) (line 0:0)
    7    startTest apply.html (line 11:1)
    8       fakeObject apply.html (line 18:1)
    9          fakeInteriorFunction apply.html (line 24:1)
    10       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest apply.html (line 10:19)
     8      fakeObject apply.html (line 17:21)
     9         fakeInteriorFunction apply.html (line 23:30)
     10      endTest profiler-test-JS-resources.js (line 1:17)
    1111
    1212
  • trunk/LayoutTests/fast/profiler/built-in-function-calls-anonymous-expected.txt

    r186300 r186959  
    55Profile title: Built-in function calls an anonymous function
    66Thread_1 (no file) (line 0:0)
    7    startTest built-in-function-calls-anonymous.html (line 11:1)
     7   startTest built-in-function-calls-anonymous.html (line 10:19)
    88      Array (no file) (line 0:0)
    99      map (no file) (line 0:0)
     
    1313               Number (no file) (line 0:0)
    1414               (anonymous function) (no file) (line 0:0)
    15          myFunction built-in-function-calls-anonymous.html (line 14:45)
    16             arrayOperatorFunction profiler-test-JS-resources.js (line 25:46)
    17       endTest profiler-test-JS-resources.js (line 1:20)
     15         myFunction built-in-function-calls-anonymous.html (line 14:30)
     16            arrayOperatorFunction profiler-test-JS-resources.js (line 25:31)
     17      endTest profiler-test-JS-resources.js (line 1:17)
    1818
    1919
  • trunk/LayoutTests/fast/profiler/built-in-function-calls-user-defined-function-expected.txt

    r186300 r186959  
    55Profile title: Built-in function calls a user defined function
    66Thread_1 (no file) (line 0:0)
    7    startTest built-in-function-calls-user-defined-function.html (line 11:1)
     7   startTest built-in-function-calls-user-defined-function.html (line 10:19)
    88      Array (no file) (line 0:0)
    99      map (no file) (line 0:0)
     
    1313               Number (no file) (line 0:0)
    1414               (anonymous function) (no file) (line 0:0)
    15          arrayOperatorFunction profiler-test-JS-resources.js (line 25:46)
    16       endTest profiler-test-JS-resources.js (line 1:20)
     15         arrayOperatorFunction profiler-test-JS-resources.js (line 25:31)
     16      endTest profiler-test-JS-resources.js (line 1:17)
    1717
    1818
  • trunk/LayoutTests/fast/profiler/call-expected.txt

    r163140 r186959  
    55Profile title: Using the call() method
    66Thread_1 (no file) (line 0:0)
    7    startTest call.html (line 11:1)
    8       fakeObject call.html (line 20:1)
    9          fakeInteriorFunction call.html (line 26:1)
    10       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest call.html (line 10:19)
     8      fakeObject call.html (line 19:21)
     9         fakeInteriorFunction call.html (line 25:30)
     10      endTest profiler-test-JS-resources.js (line 1:17)
    1111
    1212
  • trunk/LayoutTests/fast/profiler/calling-the-function-that-started-the-profiler-from-another-scope-expected.txt

    r163140 r186959  
    55Profile title: Calling the same function where the profile started from another function
    66Thread_1 (no file) (line 0:0)
    7    indirection calling-the-function-that-started-the-profiler-from-another-scope.html (line 18:1)
    8       functionWichStartsAndStopsTheProfiler calling-the-function-that-started-the-profiler-from-another-scope.html (line 24:1)
    9    functionWichStartsAndStopsTheProfiler calling-the-function-that-started-the-profiler-from-another-scope.html (line 24:1)
    10    endTest profiler-test-JS-resources.js (line 1:20)
     7   indirection calling-the-function-that-started-the-profiler-from-another-scope.html (line 17:21)
     8      functionWichStartsAndStopsTheProfiler calling-the-function-that-started-the-profiler-from-another-scope.html (line 23:47)
     9   functionWichStartsAndStopsTheProfiler calling-the-function-that-started-the-profiler-from-another-scope.html (line 23:47)
     10   endTest profiler-test-JS-resources.js (line 1:17)
    1111
    1212
  • trunk/LayoutTests/fast/profiler/compare-multiple-profiles-expected.txt

    r163140 r186959  
    55Profile title: Test
    66Thread_1 (no file) (line 0:0)
    7    startTest compare-multiple-profiles.html (line 23:1)
    8       test compare-multiple-profiles.html (line 11:20)
    9          test2 compare-multiple-profiles.html (line 17:21)
     7   startTest compare-multiple-profiles.html (line 22:19)
     8      test compare-multiple-profiles.html (line 11:14)
     9         test2 compare-multiple-profiles.html (line 17:15)
    1010
    1111Profile title: Test
    1212Thread_1 (no file) (line 0:0)
    13    startTest compare-multiple-profiles.html (line 23:1)
    14       test compare-multiple-profiles.html (line 11:20)
    15          test2 compare-multiple-profiles.html (line 17:21)
     13   startTest compare-multiple-profiles.html (line 22:19)
     14      test compare-multiple-profiles.html (line 11:14)
     15         test2 compare-multiple-profiles.html (line 17:15)
    1616
    1717
  • trunk/LayoutTests/fast/profiler/constructor-expected.txt

    r163140 r186959  
    55Profile title: Using a constructor.
    66Thread_1 (no file) (line 0:0)
    7    startTest constructor.html (line 11:1)
    8       fakeObject constructor.html (line 20:1)
     7   startTest constructor.html (line 10:19)
     8      fakeObject constructor.html (line 19:21)
    99         Array (no file) (line 0:0)
    10       endTest profiler-test-JS-resources.js (line 1:20)
     10      endTest profiler-test-JS-resources.js (line 1:17)
    1111
    1212
  • trunk/LayoutTests/fast/profiler/dead-time-expected.txt

    r182034 r186959  
    55Profile title: Dead time in profile.
    66Thread_1 (no file) (line 0:0)
    7    onload dead-time.html (line 21:52)
    8       startTest dead-time.html (line 13:1)
     7   onload dead-time.html (line 21:44)
     8      startTest dead-time.html (line 12:19)
    99         setTimeout (no file) (line 0:0)
    1010   (program) dead-time.html (line 1:1)
    11       endTest profiler-test-JS-resources.js (line 1:20)
     11      endTest profiler-test-JS-resources.js (line 1:17)
    1212
    1313
  • trunk/LayoutTests/fast/profiler/document-dot-write-expected.txt

    r163140 r186959  
    22Profile title: Call Document.write()
    33Thread_1 (no file) (line 0:0)
    4    startTest document-dot-write.html (line 11:1)
     4   startTest document-dot-write.html (line 10:19)
    55      write (no file) (line 0:0)
    6       endTest profiler-test-JS-resources.js (line 1:20)
     6      endTest profiler-test-JS-resources.js (line 1:17)
    77
    88
  • trunk/LayoutTests/fast/profiler/event-handler-expected.txt

    r163140 r186959  
    55Profile title: Event handler
    66Thread_1 (no file) (line 0:0)
    7    startTest event-handler.html (line 11:1)
     7   startTest event-handler.html (line 10:19)
    88      getElementById (no file) (line 0:0)
    99      addEventListener (no file) (line 0:0)
    1010      click (no file) (line 0:0)
    11          insertNewText profiler-test-JS-resources.js (line 17:26)
     11         insertNewText profiler-test-JS-resources.js (line 17:23)
    1212            createElement (no file) (line 0:0)
    1313            createTextNode (no file) (line 0:0)
    1414            appendChild (no file) (line 0:0)
    1515            getElementById (no file) (line 0:0)
    16       endTest profiler-test-JS-resources.js (line 1:20)
     16      endTest profiler-test-JS-resources.js (line 1:17)
    1717
    1818
  • trunk/LayoutTests/fast/profiler/execution-context-and-eval-on-same-line-expected.txt

    r163140 r186959  
    55Profile title: Two Execution Contexts on the same line
    66Thread_1 (no file) (line 0:0)
    7    startTest execution-context-and-eval-on-same-line.html (line 11:1)
    8       evalFunction (no file) (line 1:25)
    9          insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest execution-context-and-eval-on-same-line.html (line 10:19)
     8      evalFunction (no file) (line 1:22)
     9         insertNewText profiler-test-JS-resources.js (line 17:23)
    1010            createElement (no file) (line 0:0)
    1111            createTextNode (no file) (line 0:0)
    1212            appendChild (no file) (line 0:0)
    1313            getElementById (no file) (line 0:0)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616
  • trunk/LayoutTests/fast/profiler/inline-event-handler-expected.txt

    r182034 r186959  
    55Profile title: Inline event handler
    66Thread_1 (no file) (line 0:0)
    7    startTest inline-event-handler.html (line 11:1)
     7   startTest inline-event-handler.html (line 10:19)
    88      getElementById (no file) (line 0:0)
    99      click (no file) (line 0:0)
    10          onclick inline-event-handler.html (line 31:135)
    11             eventListener inline-event-handler.html (line 17:26)
    12                anonymousFunction profiler-test-JS-resources.js (line 29:37)
    13                   insertNewText profiler-test-JS-resources.js (line 17:26)
     10         onclick inline-event-handler.html (line 31:127)
     11            eventListener inline-event-handler.html (line 17:23)
     12               anonymousFunction profiler-test-JS-resources.js (line 29:34)
     13                  insertNewText profiler-test-JS-resources.js (line 17:23)
    1414                     createElement (no file) (line 0:0)
    1515                     createTextNode (no file) (line 0:0)
    1616                     appendChild (no file) (line 0:0)
    1717                     getElementById (no file) (line 0:0)
    18                endTest profiler-test-JS-resources.js (line 1:20)
     18               endTest profiler-test-JS-resources.js (line 1:17)
    1919
    2020
  • trunk/LayoutTests/fast/profiler/many-calls-in-the-same-scope-expected.txt

    r163140 r186959  
    55Profile title: Many Calls In The Same Scope
    66Thread_1 (no file) (line 0:0)
    7    startTest many-calls-in-the-same-scope.html (line 11:1)
    8       insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest many-calls-in-the-same-scope.html (line 10:19)
     8      insertNewText profiler-test-JS-resources.js (line 17:23)
    99         createElement (no file) (line 0:0)
    1010         createTextNode (no file) (line 0:0)
    1111         appendChild (no file) (line 0:0)
    1212         getElementById (no file) (line 0:0)
    13       insertGivenText profiler-test-JS-resources.js (line 9:32)
     13      insertGivenText profiler-test-JS-resources.js (line 9:25)
    1414         createElement (no file) (line 0:0)
    1515         createTextNode (no file) (line 0:0)
    1616         appendChild (no file) (line 0:0)
    1717         getElementById (no file) (line 0:0)
    18       arrayOperatorFunction profiler-test-JS-resources.js (line 25:46)
    19       intermediaryFunction profiler-test-JS-resources.js (line 33:1)
    20          anonymousFunction profiler-test-JS-resources.js (line 29:37)
    21             insertNewText profiler-test-JS-resources.js (line 17:26)
     18      arrayOperatorFunction profiler-test-JS-resources.js (line 25:31)
     19      intermediaryFunction profiler-test-JS-resources.js (line 32:30)
     20         anonymousFunction profiler-test-JS-resources.js (line 29:34)
     21            insertNewText profiler-test-JS-resources.js (line 17:23)
    2222               createElement (no file) (line 0:0)
    2323               createTextNode (no file) (line 0:0)
    2424               appendChild (no file) (line 0:0)
    2525               getElementById (no file) (line 0:0)
    26       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    27          insertNewText profiler-test-JS-resources.js (line 17:26)
     26      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     27         insertNewText profiler-test-JS-resources.js (line 17:23)
    2828            createElement (no file) (line 0:0)
    2929            createTextNode (no file) (line 0:0)
    3030            appendChild (no file) (line 0:0)
    3131            getElementById (no file) (line 0:0)
    32       end many-calls-in-the-same-scope.html (line 27:1)
    33       endT many-calls-in-the-same-scope.html (line 32:1)
    34       endTest profiler-test-JS-resources.js (line 1:20)
     32      end many-calls-in-the-same-scope.html (line 26:13)
     33      endT many-calls-in-the-same-scope.html (line 31:14)
     34      endTest profiler-test-JS-resources.js (line 1:17)
    3535
    3636
  • trunk/LayoutTests/fast/profiler/multiple-and-different-scoped-anonymous-function-calls-expected.txt

    r163140 r186959  
    55Profile title: Multiple and different scoped calls to the same anonymous function
    66Thread_1 (no file) (line 0:0)
    7    startTest multiple-and-different-scoped-anonymous-function-calls.html (line 11:1)
    8       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    9          insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest multiple-and-different-scoped-anonymous-function-calls.html (line 10:19)
     8      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     9         insertNewText profiler-test-JS-resources.js (line 17:23)
    1010            createElement (no file) (line 0:0)
    1111            createTextNode (no file) (line 0:0)
    1212            appendChild (no file) (line 0:0)
    1313            getElementById (no file) (line 0:0)
    14       intermediaryFunction profiler-test-JS-resources.js (line 33:1)
    15          anonymousFunction profiler-test-JS-resources.js (line 29:37)
    16             insertNewText profiler-test-JS-resources.js (line 17:26)
     14      intermediaryFunction profiler-test-JS-resources.js (line 32:30)
     15         anonymousFunction profiler-test-JS-resources.js (line 29:34)
     16            insertNewText profiler-test-JS-resources.js (line 17:23)
    1717               createElement (no file) (line 0:0)
    1818               createTextNode (no file) (line 0:0)
    1919               appendChild (no file) (line 0:0)
    2020               getElementById (no file) (line 0:0)
    21       endTest profiler-test-JS-resources.js (line 1:20)
     21      endTest profiler-test-JS-resources.js (line 1:17)
    2222
    2323
  • trunk/LayoutTests/fast/profiler/multiple-and-different-scoped-function-calls-expected.txt

    r163140 r186959  
    55Profile title: Multiple and different scoped calls to the same function
    66Thread_1 (no file) (line 0:0)
    7    startTest multiple-and-different-scoped-function-calls.html (line 11:1)
    8       insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest multiple-and-different-scoped-function-calls.html (line 10:19)
     8      insertNewText profiler-test-JS-resources.js (line 17:23)
    99         createElement (no file) (line 0:0)
    1010         createTextNode (no file) (line 0:0)
    1111         appendChild (no file) (line 0:0)
    1212         getElementById (no file) (line 0:0)
    13       intermediaryFunction profiler-test-JS-resources.js (line 33:1)
    14          anonymousFunction profiler-test-JS-resources.js (line 29:37)
    15             insertNewText profiler-test-JS-resources.js (line 17:26)
     13      intermediaryFunction profiler-test-JS-resources.js (line 32:30)
     14         anonymousFunction profiler-test-JS-resources.js (line 29:34)
     15            insertNewText profiler-test-JS-resources.js (line 17:23)
    1616               createElement (no file) (line 0:0)
    1717               createTextNode (no file) (line 0:0)
    1818               appendChild (no file) (line 0:0)
    1919               getElementById (no file) (line 0:0)
    20       endTest profiler-test-JS-resources.js (line 1:20)
     20      endTest profiler-test-JS-resources.js (line 1:17)
    2121
    2222
  • trunk/LayoutTests/fast/profiler/multiple-anonymous-functions-called-from-the-same-function-expected.txt

    r163140 r186959  
    55Profile title: Multiple calls to different anonymous functions
    66Thread_1 (no file) (line 0:0)
    7    startTest multiple-anonymous-functions-called-from-the-same-function.html (line 11:1)
    8       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    9          insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest multiple-anonymous-functions-called-from-the-same-function.html (line 10:19)
     8      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     9         insertNewText profiler-test-JS-resources.js (line 17:23)
    1010            createElement (no file) (line 0:0)
    1111            createTextNode (no file) (line 0:0)
    1212            appendChild (no file) (line 0:0)
    1313            getElementById (no file) (line 0:0)
    14       anotherAnonymousFunction profiler-test-JS-resources.js (line 30:44)
    15          insertGivenText profiler-test-JS-resources.js (line 9:32)
     14      anotherAnonymousFunction profiler-test-JS-resources.js (line 30:41)
     15         insertGivenText profiler-test-JS-resources.js (line 9:25)
    1616            createElement (no file) (line 0:0)
    1717            createTextNode (no file) (line 0:0)
    1818            appendChild (no file) (line 0:0)
    1919            getElementById (no file) (line 0:0)
    20       endTest profiler-test-JS-resources.js (line 1:20)
     20      endTest profiler-test-JS-resources.js (line 1:17)
    2121
    2222
  • trunk/LayoutTests/fast/profiler/multiple-frames-expected.txt

    r163140 r186959  
    55Profile title: Other window executing JavaScript
    66Thread_1 (no file) (line 0:0)
    7    startTest multiple-frames.html (line 11:1)
     7   startTest multiple-frames.html (line 10:19)
    88      getElementById (no file) (line 0:0)
    9       functionInOtherFrame other-frame.html (line 4:33)
    10          functionInParentFrame multiple-frames.html (line 21:34)
    11       insertGivenText profiler-test-JS-resources.js (line 9:32)
     9      functionInOtherFrame other-frame.html (line 4:30)
     10         functionInParentFrame multiple-frames.html (line 21:31)
     11      insertGivenText profiler-test-JS-resources.js (line 9:25)
    1212         createElement (no file) (line 0:0)
    1313         createTextNode (no file) (line 0:0)
    1414         appendChild (no file) (line 0:0)
    1515         getElementById (no file) (line 0:0)
    16       endTest profiler-test-JS-resources.js (line 1:20)
     16      endTest profiler-test-JS-resources.js (line 1:17)
    1717
    1818
  • trunk/LayoutTests/fast/profiler/named-functions-with-display-names-expected.txt

    r163140 r186959  
    55Profile title: Named functions with display names
    66Thread_1 (no file) (line 0:0)
    7    startTest named-functions-with-display-names.html (line 54:1)
    8       0 iterations function named-functions-with-display-names.html (line 11:1)
    9       1 iteration function named-functions-with-display-names.html (line 18:1)
    10       2 iterations function named-functions-with-display-names.html (line 25:1)
    11       20 iterations function named-functions-with-display-names.html (line 32:1)
    12       1000 iterations function named-functions-with-display-names.html (line 39:1)
    13       bogusDisplayNameFunction named-functions-with-display-names.html (line 47:1)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest named-functions-with-display-names.html (line 53:19)
     8      0 iterations function named-functions-with-display-names.html (line 10:19)
     9      1 iteration function named-functions-with-display-names.html (line 17:19)
     10      2 iterations function named-functions-with-display-names.html (line 24:19)
     11      20 iterations function named-functions-with-display-names.html (line 31:20)
     12      1000 iterations function named-functions-with-display-names.html (line 38:22)
     13      bogusDisplayNameFunction named-functions-with-display-names.html (line 46:34)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616
  • trunk/LayoutTests/fast/profiler/nested-anonymous-functon-expected.txt

    r163140 r186959  
    55Profile title: Nested anonymous functions called
    66Thread_1 (no file) (line 0:0)
    7    startTest nested-anonymous-functon.html (line 11:1)
    8       AnonymousFunctionWichCallsAnAnonymousFunction nested-anonymous-functon.html (line 14:68)
    9          anonymousFunction profiler-test-JS-resources.js (line 29:37)
    10             insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest nested-anonymous-functon.html (line 10:19)
     8      AnonymousFunctionWichCallsAnAnonymousFunction nested-anonymous-functon.html (line 14:65)
     9         anonymousFunction profiler-test-JS-resources.js (line 29:34)
     10            insertNewText profiler-test-JS-resources.js (line 17:23)
    1111               createElement (no file) (line 0:0)
    1212               createTextNode (no file) (line 0:0)
    1313               appendChild (no file) (line 0:0)
    1414               getElementById (no file) (line 0:0)
    15       endTest profiler-test-JS-resources.js (line 1:20)
     15      endTest profiler-test-JS-resources.js (line 1:17)
    1616
    1717
  • trunk/LayoutTests/fast/profiler/nested-start-and-stop-profiler-expected.txt

    r163140 r186959  
    55Profile title: Start the profiler the third time.
    66Thread_1 (no file) (line 0:0)
    7    startTest nested-start-and-stop-profiler.html (line 11:1)
    8       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest nested-start-and-stop-profiler.html (line 10:19)
     8      endTest profiler-test-JS-resources.js (line 1:17)
    99
    1010
    1111Profile title: Start the profiler the third time.
    1212Thread_1 (no file) (line 0:0)
    13    startTest nested-start-and-stop-profiler.html (line 11:1)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     13   startTest nested-start-and-stop-profiler.html (line 10:19)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616Profile title: Start the profiler the second time.
    1717Thread_1 (no file) (line 0:0)
    18    startTest nested-start-and-stop-profiler.html (line 11:1)
    19       endTest profiler-test-JS-resources.js (line 1:20)
     18   startTest nested-start-and-stop-profiler.html (line 10:19)
     19      endTest profiler-test-JS-resources.js (line 1:17)
    2020         profileEnd (no file) (line 0:0)
    21          printProfilesDataWithoutTime profiler-test-JS-resources.js (line 63:1)
     21         printProfilesDataWithoutTime profiler-test-JS-resources.js (line 62:38)
    2222            createElement (no file) (line 0:0)
    2323            createTextNode (no file) (line 0:0)
    2424            appendChild (no file) (line 0:0)
    25             printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     25            printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    2626               replace (no file) (line 0:0)
    2727               createTextNode (no file) (line 0:0)
    2828               appendChild (no file) (line 0:0)
    2929               children (no file) (line 0:0)
    30                printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     30               printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    3131                  replace (no file) (line 0:0)
    3232                  createTextNode (no file) (line 0:0)
    3333                  appendChild (no file) (line 0:0)
    3434                  children (no file) (line 0:0)
    35                   printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     35                  printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    3636                     replace (no file) (line 0:0)
    3737                     createTextNode (no file) (line 0:0)
     
    4444Profile title: Start the profiler the third time.
    4545Thread_1 (no file) (line 0:0)
    46    startTest nested-start-and-stop-profiler.html (line 11:1)
    47       endTest profiler-test-JS-resources.js (line 1:20)
     46   startTest nested-start-and-stop-profiler.html (line 10:19)
     47      endTest profiler-test-JS-resources.js (line 1:17)
    4848
    4949Profile title: Start the profiler the second time.
    5050Thread_1 (no file) (line 0:0)
    51    startTest nested-start-and-stop-profiler.html (line 11:1)
    52       endTest profiler-test-JS-resources.js (line 1:20)
     51   startTest nested-start-and-stop-profiler.html (line 10:19)
     52      endTest profiler-test-JS-resources.js (line 1:17)
    5353         profileEnd (no file) (line 0:0)
    54          printProfilesDataWithoutTime profiler-test-JS-resources.js (line 63:1)
     54         printProfilesDataWithoutTime profiler-test-JS-resources.js (line 62:38)
    5555            createElement (no file) (line 0:0)
    5656            createTextNode (no file) (line 0:0)
    5757            appendChild (no file) (line 0:0)
    58             printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     58            printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    5959               replace (no file) (line 0:0)
    6060               createTextNode (no file) (line 0:0)
    6161               appendChild (no file) (line 0:0)
    6262               children (no file) (line 0:0)
    63                printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     63               printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    6464                  replace (no file) (line 0:0)
    6565                  createTextNode (no file) (line 0:0)
    6666                  appendChild (no file) (line 0:0)
    6767                  children (no file) (line 0:0)
    68                   printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     68                  printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    6969                     replace (no file) (line 0:0)
    7070                     createTextNode (no file) (line 0:0)
     
    7676Profile title: Start the profiler the first time.
    7777Thread_1 (no file) (line 0:0)
    78    startTest nested-start-and-stop-profiler.html (line 11:1)
    79       endTest profiler-test-JS-resources.js (line 1:20)
     78   startTest nested-start-and-stop-profiler.html (line 10:19)
     79      endTest profiler-test-JS-resources.js (line 1:17)
    8080         profileEnd (no file) (line 0:0)
    81          printProfilesDataWithoutTime profiler-test-JS-resources.js (line 63:1)
     81         printProfilesDataWithoutTime profiler-test-JS-resources.js (line 62:38)
    8282            createElement (no file) (line 0:0)
    8383            createTextNode (no file) (line 0:0)
    8484            appendChild (no file) (line 0:0)
    85             printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     85            printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    8686               replace (no file) (line 0:0)
    8787               createTextNode (no file) (line 0:0)
    8888               appendChild (no file) (line 0:0)
    8989               children (no file) (line 0:0)
    90                printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     90               printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    9191                  replace (no file) (line 0:0)
    9292                  createTextNode (no file) (line 0:0)
    9393                  appendChild (no file) (line 0:0)
    9494                  children (no file) (line 0:0)
    95                   printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     95                  printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    9696                     replace (no file) (line 0:0)
    9797                     createTextNode (no file) (line 0:0)
    9898                     appendChild (no file) (line 0:0)
    9999                     children (no file) (line 0:0)
    100                      printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     100                     printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    101101                        replace (no file) (line 0:0)
    102102                        createTextNode (no file) (line 0:0)
    103103                        appendChild (no file) (line 0:0)
    104104                        children (no file) (line 0:0)
    105                         printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     105                        printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    106106                           replace (no file) (line 0:0)
    107107                           createTextNode (no file) (line 0:0)
    108108                           appendChild (no file) (line 0:0)
    109109                           children (no file) (line 0:0)
    110                            printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     110                           printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    111111                              replace (no file) (line 0:0)
    112112                              createTextNode (no file) (line 0:0)
    113113                              appendChild (no file) (line 0:0)
    114114                              children (no file) (line 0:0)
    115                               printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     115                              printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    116116                                 replace (no file) (line 0:0)
    117117                                 createTextNode (no file) (line 0:0)
    118118                                 appendChild (no file) (line 0:0)
    119119                                 children (no file) (line 0:0)
    120                                  printProfileNodeWithoutTime profiler-test-JS-resources.js (line 78:1)
     120                                 printProfileNodeWithoutTime profiler-test-JS-resources.js (line 77:37)
    121121                                    replace (no file) (line 0:0)
    122122                                    createTextNode (no file) (line 0:0)
  • trunk/LayoutTests/fast/profiler/one-execution-context-expected.txt

    r163140 r186959  
    55Profile title: One Execution Context
    66Thread_1 (no file) (line 0:0)
    7    startTest one-execution-context.html (line 11:1)
    8       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest one-execution-context.html (line 10:19)
     8      endTest profiler-test-JS-resources.js (line 1:17)
    99
    1010
  • trunk/LayoutTests/fast/profiler/profile-calls-in-included-file-expected.txt

    r163140 r186959  
    55Profile title: Profile call in included file
    66Thread_1 (no file) (line 0:0)
    7    startProfile profiler-test-JS-resources.js (line 43:1)
    8    endTest profiler-test-JS-resources.js (line 1:20)
     7   startProfile profiler-test-JS-resources.js (line 42:22)
     8   endTest profiler-test-JS-resources.js (line 1:17)
    99
    1010
  • trunk/LayoutTests/fast/profiler/profile-with-no-title-expected.txt

    r171195 r186959  
    55Profile title:
    66Thread_1 (no file) (line 0:0)
    7    startTest profile-with-no-title.html (line 11:1)
    8       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest profile-with-no-title.html (line 10:19)
     8      endTest profiler-test-JS-resources.js (line 1:17)
    99
    1010
  • trunk/LayoutTests/fast/profiler/profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting-expected.txt

    r163140 r186959  
    55Profile title: Profiling From A Nested Location But Stop Profiling Outside The Nesting
    66Thread_1 (no file) (line 0:0)
    7    functionWichStartsTheProfiler profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting.html (line 17:1)
    8    endTest profiler-test-JS-resources.js (line 1:20)
     7   functionWichStartsTheProfiler profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting.html (line 16:39)
     8   endTest profiler-test-JS-resources.js (line 1:17)
    99
    1010
  • trunk/LayoutTests/fast/profiler/profiling-from-a-nested-location-expected.txt

    r163140 r186959  
    55Profile title: Profiling From A Nested Location
    66Thread_1 (no file) (line 0:0)
    7    functionWichStartsAndStopsTheProfiler profiling-from-a-nested-location.html (line 16:1)
    8       endTest profiler-test-JS-resources.js (line 1:20)
     7   functionWichStartsAndStopsTheProfiler profiling-from-a-nested-location.html (line 15:47)
     8      endTest profiler-test-JS-resources.js (line 1:17)
    99
    1010
  • trunk/LayoutTests/fast/profiler/simple-event-call-expected.txt

    r163140 r186959  
    55Profile title: A simple profile test where an event happens.
    66Thread_1 (no file) (line 0:0)
    7    startTest simple-event-call.html (line 11:1)
    8       endTest profiler-test-JS-resources.js (line 1:20)
     7   startTest simple-event-call.html (line 10:19)
     8      endTest profiler-test-JS-resources.js (line 1:17)
    99
    1010
  • trunk/LayoutTests/fast/profiler/simple-no-level-change-expected.txt

    r163140 r186959  
    55Profile title: A simple profile test where no scope chagnes
    66Thread_1 (no file) (line 0:0)
    7    functionWichStartsAndStopsTheProfiler simple-no-level-change.html (line 16:1)
     7   functionWichStartsAndStopsTheProfiler simple-no-level-change.html (line 15:47)
    88      getElementById (no file) (line 0:0)
    99
  • trunk/LayoutTests/fast/profiler/start-and-stop-profiler-multiple-times-expected.txt

    r163140 r186959  
    55Profile title: Start the profiler the first time.
    66Thread_1 (no file) (line 0:0)
    7    startTest start-and-stop-profiler-multiple-times.html (line 11:1)
    8       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    9          insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest start-and-stop-profiler-multiple-times.html (line 10:19)
     8      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     9         insertNewText profiler-test-JS-resources.js (line 17:23)
    1010            createElement (no file) (line 0:0)
    1111            createTextNode (no file) (line 0:0)
    1212            appendChild (no file) (line 0:0)
    1313            getElementById (no file) (line 0:0)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616
    1717Profile title: Start the profiler the first time.
    1818Thread_1 (no file) (line 0:0)
    19    startTest start-and-stop-profiler-multiple-times.html (line 11:1)
    20       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    21          insertNewText profiler-test-JS-resources.js (line 17:26)
     19   startTest start-and-stop-profiler-multiple-times.html (line 10:19)
     20      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     21         insertNewText profiler-test-JS-resources.js (line 17:23)
    2222            createElement (no file) (line 0:0)
    2323            createTextNode (no file) (line 0:0)
    2424            appendChild (no file) (line 0:0)
    2525            getElementById (no file) (line 0:0)
    26       endTest profiler-test-JS-resources.js (line 1:20)
     26      endTest profiler-test-JS-resources.js (line 1:17)
    2727
    2828Profile title: Start the profiler the second time.
    2929Thread_1 (no file) (line 0:0)
    30    startTest start-and-stop-profiler-multiple-times.html (line 11:1)
    31       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    32          insertNewText profiler-test-JS-resources.js (line 17:26)
     30   startTest start-and-stop-profiler-multiple-times.html (line 10:19)
     31      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     32         insertNewText profiler-test-JS-resources.js (line 17:23)
    3333            createElement (no file) (line 0:0)
    3434            createTextNode (no file) (line 0:0)
    3535            appendChild (no file) (line 0:0)
    3636            getElementById (no file) (line 0:0)
    37       endTest profiler-test-JS-resources.js (line 1:20)
     37      endTest profiler-test-JS-resources.js (line 1:17)
    3838
    3939
    4040Profile title: Start the profiler the first time.
    4141Thread_1 (no file) (line 0:0)
    42    startTest start-and-stop-profiler-multiple-times.html (line 11:1)
    43       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    44          insertNewText profiler-test-JS-resources.js (line 17:26)
     42   startTest start-and-stop-profiler-multiple-times.html (line 10:19)
     43      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     44         insertNewText profiler-test-JS-resources.js (line 17:23)
    4545            createElement (no file) (line 0:0)
    4646            createTextNode (no file) (line 0:0)
    4747            appendChild (no file) (line 0:0)
    4848            getElementById (no file) (line 0:0)
    49       endTest profiler-test-JS-resources.js (line 1:20)
     49      endTest profiler-test-JS-resources.js (line 1:17)
    5050
    5151Profile title: Start the profiler the second time.
    5252Thread_1 (no file) (line 0:0)
    53    startTest start-and-stop-profiler-multiple-times.html (line 11:1)
    54       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    55          insertNewText profiler-test-JS-resources.js (line 17:26)
     53   startTest start-and-stop-profiler-multiple-times.html (line 10:19)
     54      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     55         insertNewText profiler-test-JS-resources.js (line 17:23)
    5656            createElement (no file) (line 0:0)
    5757            createTextNode (no file) (line 0:0)
    5858            appendChild (no file) (line 0:0)
    5959            getElementById (no file) (line 0:0)
    60       endTest profiler-test-JS-resources.js (line 1:20)
     60      endTest profiler-test-JS-resources.js (line 1:17)
    6161
    6262Profile title: Start the profiler the third time.
    6363Thread_1 (no file) (line 0:0)
    64    startTest start-and-stop-profiler-multiple-times.html (line 11:1)
    65       anonymousFunction profiler-test-JS-resources.js (line 29:37)
    66          insertNewText profiler-test-JS-resources.js (line 17:26)
     64   startTest start-and-stop-profiler-multiple-times.html (line 10:19)
     65      anonymousFunction profiler-test-JS-resources.js (line 29:34)
     66         insertNewText profiler-test-JS-resources.js (line 17:23)
    6767            createElement (no file) (line 0:0)
    6868            createTextNode (no file) (line 0:0)
    6969            appendChild (no file) (line 0:0)
    7070            getElementById (no file) (line 0:0)
    71       endTest profiler-test-JS-resources.js (line 1:20)
     71      endTest profiler-test-JS-resources.js (line 1:17)
    7272
    7373
  • trunk/LayoutTests/fast/profiler/start-and-stop-profiling-in-the-same-function-expected.txt

    r163140 r186959  
    55Profile title: Profiling From A Nested Location
    66Thread_1 (no file) (line 0:0)
    7    startTest start-and-stop-profiling-in-the-same-function.html (line 11:1)
    8       functionWichStopsTheProfiler start-and-stop-profiling-in-the-same-function.html (line 18:1)
     7   startTest start-and-stop-profiling-in-the-same-function.html (line 10:19)
     8      functionWichStopsTheProfiler start-and-stop-profiling-in-the-same-function.html (line 17:38)
    99
    1010
  • trunk/LayoutTests/fast/profiler/stop-profiling-after-setTimeout-expected.txt

    r182034 r186959  
    55Profile title: Stop profiling from a timeout
    66Thread_1 (no file) (line 0:0)
    7    onload stop-profiling-after-setTimeout.html (line 21:52)
    8       startTest stop-profiling-after-setTimeout.html (line 13:1)
     7   onload stop-profiling-after-setTimeout.html (line 21:44)
     8      startTest stop-profiling-after-setTimeout.html (line 12:19)
    99         setTimeout (no file) (line 0:0)
    1010   (program) stop-profiling-after-setTimeout.html (line 1:1)
    11       endTest profiler-test-JS-resources.js (line 1:20)
     11      endTest profiler-test-JS-resources.js (line 1:17)
    1212
    1313
  • trunk/LayoutTests/fast/profiler/stop-then-function-call-expected.txt

    r163140 r186959  
    66Thread_1 (no file) (line 0:0)
    77   (program) (no file) (line 1:16)
    8       test stop-then-function-call.html (line 11:20)
     8      test stop-then-function-call.html (line 11:14)
    99
    1010
  • trunk/LayoutTests/fast/profiler/two-execution-contexts-expected.txt

    r163140 r186959  
    55Profile title: Two Execution Contexts
    66Thread_1 (no file) (line 0:0)
    7    startTest two-execution-contexts.html (line 11:1)
    8       intermediaryFunction two-execution-contexts.html (line 18:1)
    9          testEnd two-execution-contexts.html (line 33:20)
     7   startTest two-execution-contexts.html (line 10:19)
     8      intermediaryFunction two-execution-contexts.html (line 17:30)
     9         testEnd two-execution-contexts.html (line 33:17)
    1010
    1111
  • trunk/LayoutTests/fast/profiler/user-defined-function-calls-built-in-functions-expected.txt

    r163140 r186959  
    77Profile title: User defined function calles built-in functions
    88Thread_1 (no file) (line 0:0)
    9    startTest user-defined-function-calls-built-in-functions.html (line 11:1)
     9   startTest user-defined-function-calls-built-in-functions.html (line 10:19)
    1010      createElement (no file) (line 0:0)
    1111      createTextNode (no file) (line 0:0)
    1212      appendChild (no file) (line 0:0)
    1313      getElementById (no file) (line 0:0)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616
  • trunk/LayoutTests/fast/profiler/window-dot-eval-expected.txt

    r163140 r186959  
    55Profile title: Call window.eval()
    66Thread_1 (no file) (line 0:0)
    7    startTest window-dot-eval.html (line 11:1)
    8       evalFunction (no file) (line 1:25)
    9          insertNewText profiler-test-JS-resources.js (line 17:26)
     7   startTest window-dot-eval.html (line 10:19)
     8      evalFunction (no file) (line 1:22)
     9         insertNewText profiler-test-JS-resources.js (line 17:23)
    1010            createElement (no file) (line 0:0)
    1111            createTextNode (no file) (line 0:0)
    1212            appendChild (no file) (line 0:0)
    1313            getElementById (no file) (line 0:0)
    14       endTest profiler-test-JS-resources.js (line 1:20)
     14      endTest profiler-test-JS-resources.js (line 1:17)
    1515
    1616
  • trunk/LayoutTests/js/dom/script-start-end-locations-expected.txt

    r181810 r186959  
    66program { 25:9 - 26:1 }
    77program { 27:13 - 28:1 }
    8 function "hf1" { 30:24 - 30:38 }
    9 function "hf2" { 31:28 - 31:42 }
    10 function "hf3" { 32:32 - 32:46 }
    11 function "hf4" { 34:24 - 36:9 }
    12 function "hf5" { 37:28 - 39:9 }
    13 function "hf6" { 40:32 - 42:9 }
    14 function "hf7" { 45:16 - 47:5 }
    15 function "hf8" { 49:35 - 49:45 }
    16 function "hf9" { 49:97 - 49:107 }
     8function "hf1" { 30:21 - 30:38 }
     9function "hf2" { 31:25 - 31:42 }
     10function "hf3" { 32:29 - 32:46 }
     11function "hf4" { 34:21 - 36:9 }
     12function "hf5" { 37:25 - 39:9 }
     13function "hf6" { 40:29 - 42:9 }
     14function "hf7" { 45:13 - 47:5 }
     15function "hf8" { 49:32 - 49:45 }
     16function "hf9" { 49:94 - 49:107 }
    1717
    1818program { 1:1 - 474:1 }
    1919
    2020  On first line:
    21 function "f0" { 1:115 - 1:266 }
    22 function "f0a" { 1:142 - 1:257 }
    23 function "f0b" { 1:170 - 1:248 }
    24 eval { 1:1 - 1:56 }
    25 function "x0" { 1:298 - 1:476 }
    26 function "x0a" { 1:330 - 1:466 }
    27 function "x0b" { 1:364 - 1:456 }
     21function "f0" { 1:112 - 1:266 }
     22function "f0a" { 1:139 - 1:257 }
     23function "f0b" { 1:167 - 1:248 }
     24eval { 1:1 - 1:56 }
     25function "x0" { 1:292 - 1:476 }
     26function "x0a" { 1:327 - 1:466 }
     27function "x0b" { 1:361 - 1:456 }
    2828eval { 1:1 - 1:56 }
    2929
    3030  Functions Declarations in a function:
    31 function "f1" { 9:22 - 9:113 }
    32 eval { 1:1 - 1:56 }
    33 function "f2" { 12:22 - 16:5 }
    34 function "f2a" { 14:24 - 14:116 }
    35 eval { 1:1 - 1:56 }
    36 function "f3" { 19:22 - 31:5 }
    37 function "f3a" { 21:24 - 29:9 }
    38 function "f3b" { 23:28 - 27:13 }
    39 eval { 1:1 - 1:56 }
    40 function "f4" { 34:22 - 34:71 }
    41 function "f4a" { 34:49 - 34:50 }
    42 function "f5" { 36:22 - 36:151 }
    43 function "f5a" { 36:49 - 36:141 }
    44 eval { 1:1 - 1:56 }
    45 function "f6" { 38:22 - 38:189 }
    46 function "f6a" { 38:49 - 38:179 }
    47 function "f6b" { 38:77 - 38:169 }
     31function "f1" { 9:16 - 9:113 }
     32eval { 1:1 - 1:56 }
     33function "f2" { 12:16 - 16:5 }
     34function "f2a" { 14:21 - 14:116 }
     35eval { 1:1 - 1:56 }
     36function "f3" { 19:16 - 31:5 }
     37function "f3a" { 21:21 - 29:9 }
     38function "f3b" { 23:25 - 27:13 }
     39eval { 1:1 - 1:56 }
     40function "f4" { 34:16 - 34:71 }
     41function "f4a" { 34:46 - 34:50 }
     42function "f5" { 36:16 - 36:151 }
     43function "f5a" { 36:46 - 36:141 }
     44eval { 1:1 - 1:56 }
     45function "f6" { 38:16 - 38:189 }
     46function "f6a" { 38:46 - 38:179 }
     47function "f6b" { 38:74 - 38:169 }
    4848eval { 1:1 - 1:56 }
    4949
    5050  Indented Functions Declarations in a function:
    51 function "fi1" { 43:27 - 43:119 }
    52 eval { 1:1 - 1:56 }
    53 function "fi2" { 46:27 - 50:9 }
    54 function "fi2a" { 48:29 - 48:122 }
    55 eval { 1:1 - 1:56 }
    56 function "fi3" { 53:27 - 65:9 }
    57 function "fi3a" { 55:29 - 63:13 }
    58 function "fi3b" { 57:33 - 61:17 }
    59 eval { 1:1 - 1:56 }
    60 function "fi4" { 68:27 - 68:80 }
    61 function "fi4a" { 68:56 - 68:57 }
    62 function "fi5" { 70:27 - 70:160 }
    63 function "fi5a" { 70:56 - 70:149 }
    64 eval { 1:1 - 1:56 }
    65 function "fi6" { 72:27 - 72:201 }
    66 function "fi6a" { 72:56 - 72:190 }
    67 function "fi6b" { 72:86 - 72:179 }
     51function "fi1" { 43:21 - 43:119 }
     52eval { 1:1 - 1:56 }
     53function "fi2" { 46:21 - 50:9 }
     54function "fi2a" { 48:26 - 48:122 }
     55eval { 1:1 - 1:56 }
     56function "fi3" { 53:21 - 65:9 }
     57function "fi3a" { 55:26 - 63:13 }
     58function "fi3b" { 57:30 - 61:17 }
     59eval { 1:1 - 1:56 }
     60function "fi4" { 68:21 - 68:80 }
     61function "fi4a" { 68:53 - 68:57 }
     62function "fi5" { 70:21 - 70:160 }
     63function "fi5a" { 70:53 - 70:149 }
     64eval { 1:1 - 1:56 }
     65function "fi6" { 72:21 - 72:201 }
     66function "fi6a" { 72:53 - 72:190 }
     67function "fi6b" { 72:83 - 72:179 }
    6868eval { 1:1 - 1:56 }
    6969
    7070  Functions Expressions in a function:
    71 function "x1" { 77:28 - 77:119 }
    72 eval { 1:1 - 1:56 }
    73 function "x2" { 80:28 - 84:5 }
    74 function "x2a" { 82:30 - 82:122 }
    75 eval { 1:1 - 1:56 }
    76 function "x3" { 87:28 - 99:5 }
    77 function "x3a" { 89:30 - 97:9 }
    78 function "x3b" { 91:34 - 95:13 }
    79 eval { 1:1 - 1:56 }
    80 function "x4" { 102:28 - 102:83 }
    81 function "x4a" { 102:61 - 102:62 }
    82 function "x5" { 104:28 - 104:163 }
    83 function "x5a" { 104:61 - 104:153 }
    84 eval { 1:1 - 1:56 }
    85 function "x6" { 106:28 - 106:207 }
    86 function "x6a" { 106:61 - 106:197 }
    87 function "x6b" { 106:95 - 106:187 }
     71function "x1" { 77:22 - 77:119 }
     72eval { 1:1 - 1:56 }
     73function "x2" { 80:22 - 84:5 }
     74function "x2a" { 82:27 - 82:122 }
     75eval { 1:1 - 1:56 }
     76function "x3" { 87:22 - 99:5 }
     77function "x3a" { 89:27 - 97:9 }
     78function "x3b" { 91:31 - 95:13 }
     79eval { 1:1 - 1:56 }
     80function "x4" { 102:22 - 102:83 }
     81function "x4a" { 102:58 - 102:62 }
     82function "x5" { 104:22 - 104:163 }
     83function "x5a" { 104:58 - 104:153 }
     84eval { 1:1 - 1:56 }
     85function "x6" { 106:22 - 106:207 }
     86function "x6a" { 106:58 - 106:197 }
     87function "x6b" { 106:92 - 106:187 }
    8888eval { 1:1 - 1:56 }
    8989
    9090  Indented Functions Expressions in a function:
    91 function "xi1" { 111:33 - 111:125 }
    92 eval { 1:1 - 1:56 }
    93 function "xi2" { 114:33 - 118:9 }
    94 function "xi2a" { 116:35 - 116:128 }
    95 eval { 1:1 - 1:56 }
    96 function "xi3" { 121:33 - 133:9 }
    97 function "xi3a" { 123:35 - 131:13 }
    98 function "xi3b" { 125:39 - 129:17 }
    99 eval { 1:1 - 1:56 }
    100 function "xi4" { 136:33 - 136:92 }
    101 function "xi4a" { 136:68 - 136:69 }
    102 function "xi5" { 138:33 - 138:172 }
    103 function "xi5a" { 138:68 - 138:161 }
    104 eval { 1:1 - 1:56 }
    105 function "xi6" { 140:33 - 140:219 }
    106 function "xi6a" { 140:68 - 140:208 }
    107 function "xi6b" { 140:104 - 140:197 }
     91function "xi1" { 111:27 - 111:125 }
     92eval { 1:1 - 1:56 }
     93function "xi2" { 114:27 - 118:9 }
     94function "xi2a" { 116:32 - 116:128 }
     95eval { 1:1 - 1:56 }
     96function "xi3" { 121:27 - 133:9 }
     97function "xi3a" { 123:32 - 131:13 }
     98function "xi3b" { 125:36 - 129:17 }
     99eval { 1:1 - 1:56 }
     100function "xi4" { 136:27 - 136:92 }
     101function "xi4a" { 136:65 - 136:69 }
     102function "xi5" { 138:27 - 138:172 }
     103function "xi5a" { 138:65 - 138:161 }
     104eval { 1:1 - 1:56 }
     105function "xi6" { 140:27 - 140:219 }
     106function "xi6a" { 140:65 - 140:208 }
     107function "xi6b" { 140:101 - 140:197 }
    108108eval { 1:1 - 1:56 }
    109109
    110110  Anonymous Function Declaration in a function:
    111 function "" { 146:58 - 151:5 }
     111function "" { 146:52 - 151:5 }
    112112eval { 1:1 - 1:56 }
    113113
     
    116116
    117117  Global Functions Declarations:
    118 function "gf1" { 161:19 - 161:111 }
    119 eval { 1:1 - 1:56 }
    120 function "gf2" { 164:19 - 168:1 }
    121 function "gf2a" { 166:21 - 166:114 }
    122 eval { 1:1 - 1:56 }
    123 function "gf3" { 171:19 - 183:1 }
    124 function "gf3a" { 173:21 - 181:5 }
    125 function "gf3b" { 175:25 - 179:9 }
    126 eval { 1:1 - 1:56 }
    127 function "gf4" { 186:19 - 186:72 }
    128 function "gf4a" { 186:48 - 186:49 }
    129 function "gf5" { 188:19 - 188:152 }
    130 function "gf5a" { 188:48 - 188:141 }
    131 eval { 1:1 - 1:56 }
    132 function "gf6" { 190:19 - 190:193 }
    133 function "gf6a" { 190:48 - 190:182 }
    134 function "gf6b" { 190:78 - 190:171 }
     118function "gf1" { 161:13 - 161:111 }
     119eval { 1:1 - 1:56 }
     120function "gf2" { 164:13 - 168:1 }
     121function "gf2a" { 166:18 - 166:114 }
     122eval { 1:1 - 1:56 }
     123function "gf3" { 171:13 - 183:1 }
     124function "gf3a" { 173:18 - 181:5 }
     125function "gf3b" { 175:22 - 179:9 }
     126eval { 1:1 - 1:56 }
     127function "gf4" { 186:13 - 186:72 }
     128function "gf4a" { 186:45 - 186:49 }
     129function "gf5" { 188:13 - 188:152 }
     130function "gf5a" { 188:45 - 188:141 }
     131eval { 1:1 - 1:56 }
     132function "gf6" { 190:13 - 190:193 }
     133function "gf6a" { 190:45 - 190:182 }
     134function "gf6b" { 190:75 - 190:171 }
    135135eval { 1:1 - 1:56 }
    136136
    137137  Indented Global Functions Declarations:
    138 function "gfi1" { 195:24 - 195:117 }
    139 eval { 1:1 - 1:56 }
    140 function "gfi2" { 198:24 - 202:5 }
    141 function "gfi2a" { 200:26 - 200:120 }
    142 eval { 1:1 - 1:56 }
    143 function "gfi3" { 205:24 - 217:5 }
    144 function "gfi3a" { 207:26 - 215:9 }
    145 function "gfi3b" { 209:30 - 213:13 }
    146 eval { 1:1 - 1:56 }
    147 function "gfi4" { 220:24 - 220:81 }
    148 function "gfi4a" { 220:55 - 220:56 }
    149 function "gfi5" { 222:24 - 222:161 }
    150 function "gfi5a" { 222:55 - 222:149 }
    151 eval { 1:1 - 1:56 }
    152 function "gfi6" { 224:24 - 224:205 }
    153 function "gfi6a" { 224:55 - 224:193 }
    154 function "gfi6b" { 224:87 - 224:181 }
     138function "gfi1" { 195:18 - 195:117 }
     139eval { 1:1 - 1:56 }
     140function "gfi2" { 198:18 - 202:5 }
     141function "gfi2a" { 200:23 - 200:120 }
     142eval { 1:1 - 1:56 }
     143function "gfi3" { 205:18 - 217:5 }
     144function "gfi3a" { 207:23 - 215:9 }
     145function "gfi3b" { 209:27 - 213:13 }
     146eval { 1:1 - 1:56 }
     147function "gfi4" { 220:18 - 220:81 }
     148function "gfi4a" { 220:52 - 220:56 }
     149function "gfi5" { 222:18 - 222:161 }
     150function "gfi5a" { 222:52 - 222:149 }
     151eval { 1:1 - 1:56 }
     152function "gfi6" { 224:18 - 224:205 }
     153function "gfi6a" { 224:52 - 224:193 }
     154function "gfi6b" { 224:84 - 224:181 }
    155155eval { 1:1 - 1:56 }
    156156
    157157  Global Functions Expressions:
    158 function "gx1" { 229:25 - 229:117 }
    159 eval { 1:1 - 1:56 }
    160 function "gx2" { 232:25 - 236:1 }
    161 function "gx2a" { 234:27 - 234:120 }
    162 eval { 1:1 - 1:56 }
    163 function "gx3" { 239:25 - 251:1 }
    164 function "gx3a" { 241:27 - 249:5 }
    165 function "gx3b" { 243:31 - 247:9 }
    166 eval { 1:1 - 1:56 }
    167 function "gx4" { 254:25 - 254:84 }
    168 function "gx4a" { 254:60 - 254:61 }
    169 function "gx5" { 256:25 - 256:164 }
    170 function "gx5a" { 256:60 - 256:153 }
    171 eval { 1:1 - 1:56 }
    172 function "gx6" { 258:25 - 258:211 }
    173 function "gx6a" { 258:60 - 258:200 }
    174 function "gx6b" { 258:96 - 258:189 }
     158function "gx1" { 229:19 - 229:117 }
     159eval { 1:1 - 1:56 }
     160function "gx2" { 232:19 - 236:1 }
     161function "gx2a" { 234:24 - 234:120 }
     162eval { 1:1 - 1:56 }
     163function "gx3" { 239:19 - 251:1 }
     164function "gx3a" { 241:24 - 249:5 }
     165function "gx3b" { 243:28 - 247:9 }
     166eval { 1:1 - 1:56 }
     167function "gx4" { 254:19 - 254:84 }
     168function "gx4a" { 254:57 - 254:61 }
     169function "gx5" { 256:19 - 256:164 }
     170function "gx5a" { 256:57 - 256:153 }
     171eval { 1:1 - 1:56 }
     172function "gx6" { 258:19 - 258:211 }
     173function "gx6a" { 258:57 - 258:200 }
     174function "gx6b" { 258:93 - 258:189 }
    175175eval { 1:1 - 1:56 }
    176176
    177177  Indented Functions Declarations:
    178 function "gxi1" { 263:30 - 263:123 }
    179 eval { 1:1 - 1:56 }
    180 function "gxi2" { 266:30 - 270:5 }
    181 function "gxi2a" { 268:32 - 268:126 }
    182 eval { 1:1 - 1:56 }
    183 function "gxi3" { 273:30 - 285:5 }
    184 function "gxi3a" { 275:32 - 283:9 }
    185 function "gxi3b" { 277:36 - 281:13 }
    186 eval { 1:1 - 1:56 }
    187 function "gxi4" { 288:30 - 288:93 }
    188 function "gxi4a" { 288:67 - 288:68 }
    189 function "gxi5" { 290:30 - 290:173 }
    190 function "gxi5a" { 290:67 - 290:161 }
    191 eval { 1:1 - 1:56 }
    192 function "gxi6" { 292:30 - 292:223 }
    193 function "gxi6a" { 292:67 - 292:211 }
    194 function "gxi6b" { 292:105 - 292:199 }
     178function "gxi1" { 263:24 - 263:123 }
     179eval { 1:1 - 1:56 }
     180function "gxi2" { 266:24 - 270:5 }
     181function "gxi2a" { 268:29 - 268:126 }
     182eval { 1:1 - 1:56 }
     183function "gxi3" { 273:24 - 285:5 }
     184function "gxi3a" { 275:29 - 283:9 }
     185function "gxi3b" { 277:33 - 281:13 }
     186eval { 1:1 - 1:56 }
     187function "gxi4" { 288:24 - 288:93 }
     188function "gxi4a" { 288:64 - 288:68 }
     189function "gxi5" { 290:24 - 290:173 }
     190function "gxi5a" { 290:64 - 290:161 }
     191eval { 1:1 - 1:56 }
     192function "gxi6" { 292:24 - 292:223 }
     193function "gxi6a" { 292:64 - 292:211 }
     194function "gxi6b" { 292:102 - 292:199 }
    195195eval { 1:1 - 1:56 }
    196196
    197197  Anonymous Global Function Declarations:
    198 function "" { 299:56 - 304:1 }
     198function "" { 299:50 - 304:1 }
    199199eval { 1:1 - 1:56 }
    200200
    201201  Function Declarations in an eval:
    202202eval { 1:1 - 16:7 }
    203 function "ef1" { 3:20 - 14:5 }
    204 function "ef1a" { 5:25 - 12:9 }
    205 function "ef1b" { 7:29 - 10:13 }
     203function "ef1" { 3:17 - 14:5 }
     204function "ef1a" { 5:22 - 12:9 }
     205function "ef1b" { 7:26 - 10:13 }
    206206eval { 1:1 - 1:56 }
    207207eval { 1:1 - 1:225 }
    208 function "ef2" { 1:59 - 1:217 }
    209 function "ef2a" { 1:88 - 1:207 }
    210 function "ef2b" { 1:118 - 1:197 }
     208function "ef2" { 1:56 - 1:217 }
     209function "ef2a" { 1:85 - 1:207 }
     210function "ef2b" { 1:115 - 1:197 }
    211211eval { 1:1 - 1:56 }
    212212eval { 1:1 - 17:8 }
    213 function "efi1" { 4:21 - 15:5 }
    214 function "efi1a" { 6:26 - 13:9 }
    215 function "efi1b" { 8:30 - 11:13 }
     213function "efi1" { 4:18 - 15:5 }
     214function "efi1a" { 6:23 - 13:9 }
     215function "efi1b" { 8:27 - 11:13 }
    216216eval { 1:1 - 1:56 }
    217217eval { 1:1 - 1:234 }
    218 function "efi2" { 1:60 - 1:225 }
    219 function "efi2a" { 1:91 - 1:214 }
    220 function "efi2b" { 1:123 - 1:203 }
     218function "efi2" { 1:57 - 1:225 }
     219function "efi2a" { 1:88 - 1:214 }
     220function "efi2b" { 1:120 - 1:203 }
    221221eval { 1:1 - 1:56 }
    222222
    223223  Function Expressions in an eval:
    224224eval { 1:1 - 16:7 }
    225 function "ex1" { 3:26 - 14:5 }
    226 function "ex1a" { 5:31 - 12:9 }
    227 function "ex1b" { 7:35 - 10:13 }
     225function "ex1" { 3:23 - 14:5 }
     226function "ex1a" { 5:28 - 12:9 }
     227function "ex1b" { 7:32 - 10:13 }
    228228eval { 1:1 - 1:56 }
    229229eval { 1:1 - 1:246 }
    230 function "ex2" { 1:65 - 1:237 }
    231 function "ex2a" { 1:100 - 1:226 }
    232 function "ex2b" { 1:136 - 1:215 }
     230function "ex2" { 1:62 - 1:237 }
     231function "ex2a" { 1:97 - 1:226 }
     232function "ex2b" { 1:133 - 1:215 }
    233233eval { 1:1 - 1:56 }
    234234eval { 1:1 - 17:8 }
    235 function "exi1" { 4:27 - 15:5 }
    236 function "exi1a" { 6:32 - 13:9 }
    237 function "exi1b" { 8:36 - 11:13 }
     235function "exi1" { 4:24 - 15:5 }
     236function "exi1a" { 6:29 - 13:9 }
     237function "exi1b" { 8:33 - 11:13 }
    238238eval { 1:1 - 1:56 }
    239239eval { 1:1 - 1:255 }
    240 function "exi2" { 1:66 - 1:245 }
    241 function "exi2a" { 1:103 - 1:233 }
    242 function "exi2b" { 1:141 - 1:221 }
     240function "exi2" { 1:63 - 1:245 }
     241function "exi2a" { 1:100 - 1:233 }
     242function "exi2b" { 1:138 - 1:221 }
    243243eval { 1:1 - 1:56 }
    244244
    245245  new Function Object:
    246 function "anonymous" { 1:27 - 2:228 }
    247 function "nf1a" { 2:60 - 2:219 }
    248 function "nf1b" { 2:90 - 2:209 }
    249 function "nf1c" { 2:120 - 2:199 }
    250 eval { 1:1 - 1:56 }
    251 function "anonymous" { 1:27 - 18:8 }
    252 function "nf2a" { 5:21 - 16:5 }
    253 function "nf2b" { 7:25 - 14:9 }
    254 function "nf2c" { 9:29 - 12:13 }
    255 eval { 1:1 - 1:56 }
    256 function "anonymous" { 1:27 - 2:228 }
    257 function "nf1a" { 2:60 - 2:219 }
    258 function "nf1b" { 2:90 - 2:209 }
    259 function "nf1c" { 2:120 - 2:199 }
    260 eval { 1:1 - 1:56 }
    261 function "anonymous" { 1:27 - 2:237 }
    262 function "nfi1a" { 2:61 - 2:227 }
    263 function "nfi1b" { 2:93 - 2:216 }
    264 function "nfi1c" { 2:125 - 2:205 }
    265 eval { 1:1 - 1:56 }
    266 function "anonymous" { 1:27 - 18:8 }
    267 function "nf2a" { 5:21 - 16:5 }
    268 function "nf2b" { 7:25 - 14:9 }
    269 function "nf2c" { 9:29 - 12:13 }
    270 eval { 1:1 - 1:56 }
    271 function "anonymous" { 1:27 - 18:9 }
    272 function "nfi2a" { 5:22 - 16:5 }
    273 function "nfi2b" { 7:26 - 14:9 }
    274 function "nfi2c" { 9:30 - 12:13 }
     246function "anonymous" { 1:20 - 2:228 }
     247function "nf1a" { 2:57 - 2:219 }
     248function "nf1b" { 2:87 - 2:209 }
     249function "nf1c" { 2:117 - 2:199 }
     250eval { 1:1 - 1:56 }
     251function "anonymous" { 1:20 - 18:8 }
     252function "nf2a" { 5:18 - 16:5 }
     253function "nf2b" { 7:22 - 14:9 }
     254function "nf2c" { 9:26 - 12:13 }
     255eval { 1:1 - 1:56 }
     256function "anonymous" { 1:20 - 2:228 }
     257function "nf1a" { 2:57 - 2:219 }
     258function "nf1b" { 2:87 - 2:209 }
     259function "nf1c" { 2:117 - 2:199 }
     260eval { 1:1 - 1:56 }
     261function "anonymous" { 1:20 - 2:237 }
     262function "nfi1a" { 2:58 - 2:227 }
     263function "nfi1b" { 2:90 - 2:216 }
     264function "nfi1c" { 2:122 - 2:205 }
     265eval { 1:1 - 1:56 }
     266function "anonymous" { 1:20 - 18:8 }
     267function "nf2a" { 5:18 - 16:5 }
     268function "nf2b" { 7:22 - 14:9 }
     269function "nf2c" { 9:26 - 12:13 }
     270eval { 1:1 - 1:56 }
     271function "anonymous" { 1:20 - 18:9 }
     272function "nfi2a" { 5:19 - 16:5 }
     273function "nfi2b" { 7:23 - 14:9 }
     274function "nfi2c" { 9:27 - 12:13 }
    275275eval { 1:1 - 1:56 }
    276276
  • trunk/Source/JavaScriptCore/API/JSScriptRef.cpp

    r185608 r186959  
    7171{
    7272    return !!JSC::parse<JSC::ProgramNode>(
    73         vm, source, 0, Identifier(), JSParserBuiltinMode::NotBuiltin,
     73        vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    7474        JSParserStrictMode::NotStrict, JSParserCodeType::Program,
    7575        error);
  • trunk/Source/JavaScriptCore/ChangeLog

    r186923 r186959  
     12015-07-17  Saam barati  <saambarati1@gmail.com>
     2
     3        Function parameters should be parsed in the same parser arena as the function body
     4        https://bugs.webkit.org/show_bug.cgi?id=145995
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        This patch changes how functions are parsed in JSC. A function's
     9        parameters are now parsed in the same arena as the function itself.
     10        This allows us to arena allocate all destructuring AST nodes and
     11        the FunctionParameters node. This will help make implementing ES6
     12        default parameter values sane.
     13
     14        A source code that represents a function now includes the text of the function's
     15        parameters. The starting offset is at the opening parenthesis of the parameter
     16        list or at the starting character of the identifier for arrow functions that
     17        have single arguments and don't start with parenthesis.
     18
     19        For example:
     20
     21        "function (param1, param2) { ... }"
     22                                   ^
     23                                   | This offset used to be the starting offset of a function's SourceCode
     24                  ^
     25                  | This is the new starting offset for a function's SourceCode.
     26
     27        This requires us to change how some offsets are calculated
     28        and also requires us to report some different line numbers for internal
     29        metrics that use a SourceCode's starting line and column numbers.
     30
     31        This patch also does a bit of cleanup with regards to how
     32        functions are parsed in general (especially arrow functions).
     33        It removes some unnecessary #ifdefs and the likes for arrow
     34        to make things clearer and more deliberate.
     35
     36        * API/JSScriptRef.cpp:
     37        (parseScript):
     38        * builtins/BuiltinExecutables.cpp:
     39        (JSC::BuiltinExecutables::createExecutableInternal):
     40        * bytecode/UnlinkedCodeBlock.cpp:
     41        (JSC::generateFunctionCodeBlock):
     42        (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
     43        (JSC::UnlinkedFunctionExecutable::visitChildren):
     44        (JSC::UnlinkedFunctionExecutable::parameterCount): Deleted.
     45        * bytecode/UnlinkedCodeBlock.h:
     46        * bytecompiler/NodesCodegen.cpp:
     47        (JSC::DestructuringAssignmentNode::emitBytecode):
     48        (JSC::assignDefaultValueIfUndefined):
     49        (JSC::ArrayPatternNode::collectBoundIdentifiers):
     50        (JSC::DestructuringPatternNode::~DestructuringPatternNode): Deleted.
     51        * parser/ASTBuilder.h:
     52        (JSC::ASTBuilder::createClassExpr):
     53        (JSC::ASTBuilder::createFunctionExpr):
     54        (JSC::ASTBuilder::createFunctionBody):
     55        (JSC::ASTBuilder::createArrowFunctionExpr):
     56        (JSC::ASTBuilder::createGetterOrSetterProperty):
     57        (JSC::ASTBuilder::createElementList):
     58        (JSC::ASTBuilder::createFormalParameterList):
     59        (JSC::ASTBuilder::appendParameter):
     60        (JSC::ASTBuilder::createClause):
     61        (JSC::ASTBuilder::createClauseList):
     62        (JSC::ASTBuilder::createFuncDeclStatement):
     63        (JSC::ASTBuilder::createForInLoop):
     64        (JSC::ASTBuilder::createForOfLoop):
     65        (JSC::ASTBuilder::isResolve):
     66        (JSC::ASTBuilder::createDestructuringAssignment):
     67        (JSC::ASTBuilder::createArrayPattern):
     68        (JSC::ASTBuilder::appendArrayPatternSkipEntry):
     69        (JSC::ASTBuilder::appendArrayPatternEntry):
     70        (JSC::ASTBuilder::appendArrayPatternRestEntry):
     71        (JSC::ASTBuilder::finishArrayPattern):
     72        (JSC::ASTBuilder::createObjectPattern):
     73        (JSC::ASTBuilder::appendObjectPatternEntry):
     74        (JSC::ASTBuilder::createBindingLocation):
     75        (JSC::ASTBuilder::setEndOffset):
     76        * parser/Lexer.cpp:
     77        (JSC::Lexer<T>::Lexer):
     78        (JSC::Lexer<T>::nextTokenIsColon):
     79        (JSC::Lexer<T>::setTokenPosition):
     80        (JSC::Lexer<T>::lex):
     81        (JSC::Lexer<T>::clear):
     82        * parser/Lexer.h:
     83        (JSC::Lexer::setIsReparsingFunction):
     84        (JSC::Lexer::isReparsingFunction):
     85        (JSC::Lexer::lineNumber):
     86        (JSC::Lexer::setIsReparsing): Deleted.
     87        (JSC::Lexer::isReparsing): Deleted.
     88        * parser/NodeConstructors.h:
     89        (JSC::TryNode::TryNode):
     90        (JSC::FunctionParameters::FunctionParameters):
     91        (JSC::FuncExprNode::FuncExprNode):
     92        (JSC::FuncDeclNode::FuncDeclNode):
     93        (JSC::ArrayPatternNode::ArrayPatternNode):
     94        (JSC::ObjectPatternNode::ObjectPatternNode):
     95        (JSC::BindingNode::BindingNode):
     96        (JSC::DestructuringAssignmentNode::DestructuringAssignmentNode):
     97        (JSC::ParameterNode::ParameterNode): Deleted.
     98        (JSC::ArrayPatternNode::create): Deleted.
     99        (JSC::ObjectPatternNode::create): Deleted.
     100        (JSC::BindingNode::create): Deleted.
     101        * parser/Nodes.cpp:
     102        (JSC::ProgramNode::ProgramNode):
     103        (JSC::EvalNode::EvalNode):
     104        (JSC::FunctionBodyNode::FunctionBodyNode):
     105        (JSC::FunctionBodyNode::finishParsing):
     106        (JSC::FunctionNode::FunctionNode):
     107        (JSC::FunctionNode::finishParsing):
     108        (JSC::FunctionParameters::create): Deleted.
     109        (JSC::FunctionParameters::FunctionParameters): Deleted.
     110        (JSC::FunctionParameters::~FunctionParameters): Deleted.
     111        * parser/Nodes.h:
     112        (JSC::ProgramNode::startColumn):
     113        (JSC::ProgramNode::endColumn):
     114        (JSC::EvalNode::startColumn):
     115        (JSC::EvalNode::endColumn):
     116        (JSC::FunctionParameters::size):
     117        (JSC::FunctionParameters::at):
     118        (JSC::FunctionParameters::append):
     119        (JSC::FuncExprNode::body):
     120        (JSC::DestructuringPatternNode::~DestructuringPatternNode):
     121        (JSC::DestructuringPatternNode::isBindingNode):
     122        (JSC::DestructuringPatternNode::emitDirectBinding):
     123        (JSC::ArrayPatternNode::appendIndex):
     124        (JSC::ObjectPatternNode::appendEntry):
     125        (JSC::BindingNode::boundProperty):
     126        (JSC::BindingNode::divotStart):
     127        (JSC::BindingNode::divotEnd):
     128        (JSC::DestructuringAssignmentNode::bindings):
     129        (JSC::FuncDeclNode::body):
     130        (JSC::ParameterNode::pattern): Deleted.
     131        (JSC::ParameterNode::nextParam): Deleted.
     132        (JSC::FunctionParameters::patterns): Deleted.
     133        * parser/Parser.cpp:
     134        (JSC::Parser<LexerType>::Parser):
     135        (JSC::Parser<LexerType>::~Parser):
     136        (JSC::Parser<LexerType>::parseInner):
     137        (JSC::Parser<LexerType>::allowAutomaticSemicolon):
     138        (JSC::Parser<LexerType>::parseSourceElements):
     139        (JSC::Parser<LexerType>::createBindingPattern):
     140        (JSC::Parser<LexerType>::parseArrowFunctionSingleExpressionBodySourceElements):
     141        (JSC::Parser<LexerType>::tryParseDestructuringPatternExpression):
     142        (JSC::Parser<LexerType>::parseSwitchClauses):
     143        (JSC::Parser<LexerType>::parseSwitchDefaultClause):
     144        (JSC::Parser<LexerType>::parseBlockStatement):
     145        (JSC::Parser<LexerType>::parseStatement):
     146        (JSC::Parser<LexerType>::parseFormalParameters):
     147        (JSC::Parser<LexerType>::parseFunctionBody):
     148        (JSC::stringForFunctionMode):
     149        (JSC::Parser<LexerType>::parseFunctionParameters):
     150        (JSC::Parser<LexerType>::parseFunctionInfo):
     151        (JSC::Parser<LexerType>::parseFunctionDeclaration):
     152        (JSC::Parser<LexerType>::parseClass):
     153        (JSC::Parser<LexerType>::parsePrimaryExpression):
     154        (JSC::Parser<LexerType>::parseMemberExpression):
     155        (JSC::Parser<LexerType>::parseArrowFunctionExpression):
     156        (JSC::operatorString):
     157        (JSC::Parser<LexerType>::parseArrowFunctionSingleExpressionBody): Deleted.
     158        * parser/Parser.h:
     159        (JSC::Parser::positionBeforeLastNewline):
     160        (JSC::Parser::locationBeforeLastToken):
     161        (JSC::Parser::findCachedFunctionInfo):
     162        (JSC::Parser::isofToken):
     163        (JSC::Parser::isEndOfArrowFunction):
     164        (JSC::Parser::isArrowFunctionParamters):
     165        (JSC::Parser::tokenStart):
     166        (JSC::Parser::isLETMaskedAsIDENT):
     167        (JSC::Parser::autoSemiColon):
     168        (JSC::Parser::setEndOfStatement):
     169        (JSC::Parser::canRecurse):
     170        (JSC::Parser<LexerType>::parse):
     171        (JSC::parse):
     172        * parser/ParserFunctionInfo.h:
     173        * parser/ParserModes.h:
     174        (JSC::functionNameIsInScope):
     175        * parser/SourceCode.h:
     176        (JSC::makeSource):
     177        (JSC::SourceCode::subExpression):
     178        (JSC::SourceCode::subArrowExpression): Deleted.
     179        * parser/SourceProviderCache.h:
     180        (JSC::SourceProviderCache::get):
     181        * parser/SourceProviderCacheItem.h:
     182        (JSC::SourceProviderCacheItem::endFunctionToken):
     183        (JSC::SourceProviderCacheItem::usedVariables):
     184        (JSC::SourceProviderCacheItem::writtenVariables):
     185        (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
     186        * parser/SyntaxChecker.h:
     187        (JSC::SyntaxChecker::SyntaxChecker):
     188        (JSC::SyntaxChecker::createClassExpr):
     189        (JSC::SyntaxChecker::createFunctionExpr):
     190        (JSC::SyntaxChecker::createFunctionBody):
     191        (JSC::SyntaxChecker::createArrowFunctionExpr):
     192        (JSC::SyntaxChecker::setFunctionNameStart):
     193        (JSC::SyntaxChecker::createArguments):
     194        (JSC::SyntaxChecker::createPropertyList):
     195        (JSC::SyntaxChecker::createElementList):
     196        (JSC::SyntaxChecker::createFormalParameterList):
     197        (JSC::SyntaxChecker::appendParameter):
     198        (JSC::SyntaxChecker::createClause):
     199        (JSC::SyntaxChecker::createClauseList):
     200        * runtime/CodeCache.cpp:
     201        (JSC::CodeCache::getGlobalCodeBlock):
     202        (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
     203        * runtime/Completion.cpp:
     204        (JSC::checkSyntax):
     205        * runtime/Executable.cpp:
     206        (JSC::ProgramExecutable::checkSyntax):
     207        * tests/controlFlowProfiler/conditional-expression.js:
     208        (testConditionalFunctionCall):
     209
    12102015-07-16  Filip Pizlo  <fpizlo@apple.com>
    2211
  • trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp

    r186860 r186959  
    7070    RefPtr<SourceProvider> sourceOverride = isParsingDefaultConstructor ? source.provider() : nullptr;
    7171    std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
    72         &m_vm, source, 0, Identifier(), builtinMode,
    73         JSParserStrictMode::NotStrict,
    74         JSParserCodeType::Program,
    75         error, &positionBeforeLastNewline, constructorKind);
     72        &m_vm, source, Identifier(), builtinMode,
     73        JSParserStrictMode::NotStrict, JSParserCodeType::Program, error,
     74        &positionBeforeLastNewline, FunctionParseMode::NotAFunctionMode, constructorKind);
    7675
    7776    if (!program) {
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp

    r186860 r186959  
    6161    JSParserStrictMode strictMode = executable->isInStrictContext() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
    6262    std::unique_ptr<FunctionNode> function = parse<FunctionNode>(
    63         &vm, source, executable->parameters(), executable->name(), builtinMode,
    64         strictMode, JSParserCodeType::Function, error, 0);
     63        &vm, source, executable->name(), builtinMode, strictMode,
     64        JSParserCodeType::Function, error, nullptr, executable->parseMode());
    6565
    6666    if (!function) {
     
    6969    }
    7070
    71     function->finishParsing(executable->parameters(), executable->name(), executable->functionMode());
     71    function->finishParsing(executable->name(), executable->functionMode());
    7272    executable->recordParse(function->features(), function->hasCapturedVariables());
    7373   
     
    8585    , m_name(node->ident())
    8686    , m_inferredName(node->inferredName())
    87     , m_parameters(node->parameters())
    8887    , m_sourceOverride(WTF::move(sourceOverride))
    8988    , m_firstLineOffset(node->firstLine() - source.firstLine())
     
    9796    , m_typeProfilingStartOffset(node->functionKeywordStart())
    9897    , m_typeProfilingEndOffset(node->startStartOffset() + node->source().length() - 1)
     98    , m_parameterCount(node->parameterCount())
     99    , m_parseMode(node->parseMode())
    99100    , m_features(0)
    100101    , m_isInStrictContext(node->isInStrictContext())
     
    106107    ASSERT(m_constructorKind == static_cast<unsigned>(node->constructorKind()));
    107108    m_parentScopeTDZVariables.swap(parentScopeTDZVariables);
    108 }
    109 
    110 size_t UnlinkedFunctionExecutable::parameterCount() const
    111 {
    112     return m_parameters->size();
    113109}
    114110
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r186860 r186959  
    5050class FunctionBodyNode;
    5151class FunctionExecutable;
    52 class FunctionParameters;
    5352class JSScope;
    5453class ParserError;
     
    124123        return (kind == CodeForCall) ? m_symbolTableForCall.get() : m_symbolTableForConstruct.get();
    125124    }
    126     size_t parameterCount() const;
     125    unsigned parameterCount() const { return m_parameterCount; };
     126    FunctionParseMode parseMode() const { return m_parseMode; };
    127127    bool isInStrictContext() const { return m_isInStrictContext; }
    128128    FunctionMode functionMode() const { return static_cast<FunctionMode>(m_functionMode); }
     
    156156    }
    157157
    158     FunctionParameters* parameters() { return m_parameters.get(); }
    159 
    160158    void recordParse(CodeFeatures features, bool hasCapturedVariables)
    161159    {
     
    184182    WriteBarrier<SymbolTable> m_symbolTableForCall;
    185183    WriteBarrier<SymbolTable> m_symbolTableForConstruct;
    186     RefPtr<FunctionParameters> m_parameters;
    187184    RefPtr<SourceProvider> m_sourceOverride;
    188185    VariableEnvironment m_parentScopeTDZVariables;
     
    197194    unsigned m_typeProfilingStartOffset;
    198195    unsigned m_typeProfilingEndOffset;
     196    unsigned m_parameterCount;
     197    FunctionParseMode m_parseMode;
    199198
    200199    CodeFeatures m_features;
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r186860 r186959  
    31903190}
    31913191
    3192 DestructuringPatternNode::~DestructuringPatternNode()
    3193 {
    3194 }
    3195 
    31963192static void assignDefaultValueIfUndefined(BytecodeGenerator& generator, RegisterID* maybeUndefined, ExpressionNode* defaultValue)
    31973193{
     
    33513347{
    33523348    for (size_t i = 0; i < m_targetPatterns.size(); i++) {
    3353         if (DestructuringPatternNode* node = m_targetPatterns[i].pattern.get())
     3349        if (DestructuringPatternNode* node = m_targetPatterns[i].pattern)
    33543350            node->collectBoundIdentifiers(identifiers);
    33553351    }
  • trunk/Source/JavaScriptCore/parser/ASTBuilder.h

    r186860 r186959  
    9595
    9696
    97     typedef SyntaxChecker FunctionBodyBuilder;
    98 
    9997    typedef ExpressionNode* Expression;
    10098    typedef JSC::SourceElements* SourceElements;
     
    111109    typedef TemplateLiteralNode* TemplateLiteral;
    112110#endif
    113     typedef ParameterNode* FormalParameterList;
     111    typedef FunctionParameters* FormalParameterList;
    114112    typedef FunctionBodyNode* FunctionBody;
    115113#if ENABLE(ES6_CLASS_SYNTAX)
     
    121119    typedef ConstDeclNode* ConstDeclList;
    122120    typedef std::pair<ExpressionNode*, BinaryOpInfo> BinaryOperand;
    123     typedef RefPtr<DestructuringPatternNode> DestructuringPattern;
    124     typedef RefPtr<ArrayPatternNode> ArrayPattern;
    125     typedef RefPtr<ObjectPatternNode> ObjectPattern;
    126     typedef RefPtr<BindingNode> BindingPattern;
     121    typedef DestructuringPatternNode* DestructuringPattern;
     122    typedef ArrayPatternNode* ArrayPattern;
     123    typedef ObjectPatternNode* ObjectPattern;
     124    typedef BindingNode* BindingPattern;
    127125    static const bool CreatesAST = true;
    128126    static const bool NeedsFreeVariableInfo = true;
     
    345343#endif
    346344
    347     ExpressionNode* createFunctionExpr(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& info)
    348     {
    349         FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *info.name, info.body,
    350             m_sourceCode->subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
    351         info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
     345    ExpressionNode* createFunctionExpr(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& functionInfo)
     346    {
     347        FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *functionInfo.name, functionInfo.body,
     348            m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn));
     349        functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
    352350        return result;
    353351    }
     
    357355        unsigned startColumn, unsigned endColumn, int functionKeywordStart,
    358356        int functionNameStart, int parametersStart, bool inStrictContext,
    359         ConstructorKind constructorKind)
     357        ConstructorKind constructorKind, unsigned parameterCount, FunctionParseMode mode)
    360358    {
    361359        return new (m_parserArena) FunctionBodyNode(
    362360            m_parserArena, startLocation, endLocation, startColumn, endColumn,
    363361            functionKeywordStart, functionNameStart, parametersStart,
    364             inStrictContext, constructorKind);
    365     }
    366 
    367 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    368     ExpressionNode* createArrowFunctionExpr(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& info)
    369     {
    370         SourceCode source = info.functionBodyType == ArrowFunctionBodyExpression
    371             ? m_sourceCode->subArrowExpression(info.arrowFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn)
    372             : m_sourceCode->subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn);
    373 
    374         FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *info.name, info.body, source, info.parameters);
    375         info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
    376         return result;
    377     }
    378 #endif
     362            inStrictContext, constructorKind, parameterCount, mode);
     363    }
     364
     365    ExpressionNode* createArrowFunctionExpr(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& functionInfo)
     366    {
     367        SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn);
     368
     369        FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *functionInfo.name, functionInfo.body, source);
     370        functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
     371        return result;
     372    }
    379373
    380374    NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool,
    381         const Identifier* name, const ParserFunctionInfo<ASTBuilder>& info, SuperBinding superBinding)
     375        const Identifier* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)
    382376    {
    383377        ASSERT(name);
    384         info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
    385         info.body->setInferredName(*name);
    386         SourceCode source = m_sourceCode->subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn);
    387         FuncExprNode* funcExpr = new (m_parserArena) FuncExprNode(location, m_vm->propertyNames->nullIdentifier, info.body, source, info.parameters);
     378        functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
     379        functionInfo.body->setInferredName(*name);
     380        SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn);
     381        FuncExprNode* funcExpr = new (m_parserArena) FuncExprNode(location, m_vm->propertyNames->nullIdentifier, functionInfo.body, source);
    388382        return new (m_parserArena) PropertyNode(*name, funcExpr, type, PropertyNode::Unknown, superBinding);
    389383    }
    390384   
    391385    NEVER_INLINE PropertyNode* createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation& location, PropertyNode::Type type, bool,
    392         double name, const ParserFunctionInfo<ASTBuilder>& info, SuperBinding superBinding)
    393     {
    394         info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
     386        double name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)
     387    {
     388        functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
    395389        const Identifier& ident = parserArena.identifierArena().makeNumericIdentifier(vm, name);
    396         SourceCode source = m_sourceCode->subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn);
    397         FuncExprNode* funcExpr = new (m_parserArena) FuncExprNode(location, vm->propertyNames->nullIdentifier, info.body, source, info.parameters);
     390        SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn);
     391        FuncExprNode* funcExpr = new (m_parserArena) FuncExprNode(location, vm->propertyNames->nullIdentifier, functionInfo.body, source);
    398392        return new (m_parserArena) PropertyNode(ident, funcExpr, type, PropertyNode::Unknown, superBinding);
    399393    }
     
    421415    ElementNode* createElementList(ElementNode* elems, int elisions, ExpressionNode* expr) { return new (m_parserArena) ElementNode(elems, elisions, expr); }
    422416
    423     ParameterNode* createFormalParameterList(DestructuringPattern pattern) { return new (m_parserArena) ParameterNode(pattern); }
    424     ParameterNode* createFormalParameterList(ParameterNode* list, DestructuringPattern pattern) { return new (m_parserArena) ParameterNode(list, pattern); }
     417    FormalParameterList createFormalParameterList() { return new (m_parserArena) FunctionParameters(); }
     418    void appendParameter(FormalParameterList list, DestructuringPattern pattern) { list->append(pattern); }
    425419
    426420    CaseClauseNode* createClause(ExpressionNode* expr, JSC::SourceElements* statements) { return new (m_parserArena) CaseClauseNode(expr, statements); }
     
    428422    ClauseListNode* createClauseList(ClauseListNode* tail, CaseClauseNode* clause) { return new (m_parserArena) ClauseListNode(tail, clause); }
    429423
    430     StatementNode* createFuncDeclStatement(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& info)
    431     {
    432         FuncDeclNode* decl = new (m_parserArena) FuncDeclNode(location, *info.name, info.body,
    433             m_sourceCode->subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
    434         if (*info.name == m_vm->propertyNames->arguments)
     424    StatementNode* createFuncDeclStatement(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& functionInfo)
     425    {
     426        FuncDeclNode* decl = new (m_parserArena) FuncDeclNode(location, *functionInfo.name, functionInfo.body,
     427            m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn));
     428        if (*functionInfo.name == m_vm->propertyNames->arguments)
    435429            usesArguments();
    436430        m_scope.m_funcDeclarations.append(decl->body());
    437         info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
     431        functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
    438432        return decl;
    439433    }
     
    487481    }
    488482   
    489     StatementNode* createForInLoop(const JSTokenLocation& location, PassRefPtr<DestructuringPatternNode> pattern, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& eStart, const JSTextPosition& eDivot, const JSTextPosition& eEnd, int start, int end, VariableEnvironment& lexicalVariables)
    490     {
    491         auto lexpr = new (m_parserArena) DestructuringAssignmentNode(location, pattern.get(), 0);
     483    StatementNode* createForInLoop(const JSTokenLocation& location, DestructuringPatternNode* pattern, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& eStart, const JSTextPosition& eDivot, const JSTextPosition& eEnd, int start, int end, VariableEnvironment& lexicalVariables)
     484    {
     485        auto lexpr = new (m_parserArena) DestructuringAssignmentNode(location, pattern, 0);
    492486        return createForInLoop(location, lexpr, iter, statements, eStart, eDivot, eEnd, start, end, lexicalVariables);
    493487    }
     
    501495    }
    502496   
    503     StatementNode* createForOfLoop(const JSTokenLocation& location, PassRefPtr<DestructuringPatternNode> pattern, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& eStart, const JSTextPosition& eDivot, const JSTextPosition& eEnd, int start, int end, VariableEnvironment& lexicalVariables)
    504     {
    505         auto lexpr = new (m_parserArena) DestructuringAssignmentNode(location, pattern.get(), 0);
     497    StatementNode* createForOfLoop(const JSTokenLocation& location, DestructuringPatternNode* pattern, ExpressionNode* iter, StatementNode* statements, const JSTextPosition& eStart, const JSTextPosition& eDivot, const JSTextPosition& eEnd, int start, int end, VariableEnvironment& lexicalVariables)
     498    {
     499        auto lexpr = new (m_parserArena) DestructuringAssignmentNode(location, pattern, 0);
    506500        return createForOfLoop(location, lexpr, iter, statements, eStart, eDivot, eEnd, start, end, lexicalVariables);
    507501    }
     
    746740    bool isResolve(ExpressionNode* expr) const { return expr->isResolveNode(); }
    747741
    748     ExpressionNode* createDestructuringAssignment(const JSTokenLocation& location, PassRefPtr<DestructuringPatternNode> pattern, ExpressionNode* initializer)
    749     {
    750         return new (m_parserArena) DestructuringAssignmentNode(location, pattern.get(), initializer);
     742    ExpressionNode* createDestructuringAssignment(const JSTokenLocation& location, DestructuringPattern pattern, ExpressionNode* initializer)
     743    {
     744        return new (m_parserArena) DestructuringAssignmentNode(location, pattern, initializer);
    751745    }
    752746   
    753747    ArrayPattern createArrayPattern(const JSTokenLocation&)
    754748    {
    755         return ArrayPatternNode::create();
     749        return new (m_parserArena) ArrayPatternNode();
    756750    }
    757751   
     
    763757    void appendArrayPatternEntry(ArrayPattern node, const JSTokenLocation& location, DestructuringPattern pattern, ExpressionNode* defaultValue)
    764758    {
    765         node->appendIndex(ArrayPatternNode::BindingType::Element, location, pattern.get(), defaultValue);
     759        node->appendIndex(ArrayPatternNode::BindingType::Element, location, pattern, defaultValue);
    766760    }
    767761
    768762    void appendArrayPatternRestEntry(ArrayPattern node, const JSTokenLocation& location, DestructuringPattern pattern)
    769763    {
    770         node->appendIndex(ArrayPatternNode::BindingType::RestElement, location, pattern.get(), nullptr);
     764        node->appendIndex(ArrayPatternNode::BindingType::RestElement, location, pattern, nullptr);
    771765    }
    772766
    773767    void finishArrayPattern(ArrayPattern node, const JSTextPosition& divotStart, const JSTextPosition& divot, const JSTextPosition& divotEnd)
    774768    {
    775         setExceptionLocation(node.get(), divotStart, divot, divotEnd);
     769        setExceptionLocation(node, divotStart, divot, divotEnd);
    776770    }
    777771   
    778772    ObjectPattern createObjectPattern(const JSTokenLocation&)
    779773    {
    780         return ObjectPatternNode::create();
     774        return new (m_parserArena) ObjectPatternNode();
    781775    }
    782776   
    783777    void appendObjectPatternEntry(ObjectPattern node, const JSTokenLocation& location, bool wasString, const Identifier& identifier, DestructuringPattern pattern, ExpressionNode* defaultValue)
    784778    {
    785         node->appendEntry(location, identifier, wasString, pattern.get(), defaultValue);
     779        node->appendEntry(location, identifier, wasString, pattern, defaultValue);
    786780    }
    787781   
    788782    BindingPattern createBindingLocation(const JSTokenLocation&, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext context)
    789783    {
    790         return BindingNode::create(boundProperty, start, end, context);
     784        return new (m_parserArena) BindingNode(boundProperty, start, end, context);
    791785    }
    792786
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r185989 r186959  
    495495template <typename T>
    496496Lexer<T>::Lexer(VM* vm, JSParserBuiltinMode builtinMode)
    497     : m_isReparsing(false)
     497    : m_isReparsingFunction(false)
    498498    , m_vm(vm)
    499499    , m_parsingBuiltinFunction(builtinMode == JSParserBuiltinMode::Builtin)
     
    17161716}
    17171717
    1718 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    17191718template <typename T>
    17201719void Lexer<T>::setTokenPosition(JSToken* tokenRecord)
     
    17261725    ASSERT(tokenData->offset >= tokenData->lineStartOffset);
    17271726}
    1728 #endif
    17291727
    17301728template <typename T>
     
    24122410    m_bufferForRawTemplateString16.swap(newBufferForRawTemplateString16);
    24132411
    2414     m_isReparsing = false;
     2412    m_isReparsingFunction = false;
    24152413}
    24162414
  • trunk/Source/JavaScriptCore/parser/Lexer.h

    r185989 r186959  
    8585    // Functions to set up parsing.
    8686    void setCode(const SourceCode&, ParserArena*);
    87     void setIsReparsing() { m_isReparsing = true; }
    88     bool isReparsing() const { return m_isReparsing; }
    89 
    90 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
     87    void setIsReparsingFunction() { m_isReparsingFunction = true; }
     88    bool isReparsingFunction() const { return m_isReparsingFunction; }
     89
    9190    void setTokenPosition(JSToken* tokenRecord);
    92 #endif
    9391    JSTokenType lex(JSToken*, unsigned, bool strictMode);
    9492    bool nextTokenIsColon();
     
    225223    JSTextPosition m_positionBeforeLastNewline;
    226224    JSTokenLocation m_lastTockenLocation;
    227     bool m_isReparsing;
     225    bool m_isReparsingFunction;
    228226    bool m_atLineStart;
    229227    bool m_error;
  • trunk/Source/JavaScriptCore/parser/NodeConstructors.h

    r186860 r186959  
    829829    }
    830830
    831     inline ParameterNode::ParameterNode(PassRefPtr<DestructuringPatternNode> pattern)
    832         : m_pattern(pattern)
    833         , m_next(0)
    834     {
    835         ASSERT(m_pattern);
    836     }
    837 
    838     inline ParameterNode::ParameterNode(ParameterNode* previous, PassRefPtr<DestructuringPatternNode> pattern)
    839         : m_pattern(pattern)
    840         , m_next(0)
    841     {
    842         previous->m_next = this;
    843         ASSERT(m_pattern);
    844         ASSERT(previous->m_pattern);
    845     }
    846 
    847     inline FuncExprNode::FuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
     831    inline FunctionParameters::FunctionParameters()
     832    {
     833    }
     834
     835    inline FuncExprNode::FuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source)
    848836        : ExpressionNode(location)
    849837        , m_body(body)
    850838    {
    851         m_body->finishParsing(source, parameter, ident, FunctionExpression);
    852     }
    853 
    854     inline FuncDeclNode::FuncDeclNode(const JSTokenLocation& location, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
     839        m_body->finishParsing(source, ident, FunctionExpression);
     840    }
     841
     842    inline FuncDeclNode::FuncDeclNode(const JSTokenLocation& location, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source)
    855843        : StatementNode(location)
    856844        , m_body(body)
    857845    {
    858         m_body->finishParsing(source, parameter, ident, FunctionDeclaration);
     846        m_body->finishParsing(source, ident, FunctionDeclaration);
    859847    }
    860848
     
    955943    }
    956944   
    957     inline Ref<ArrayPatternNode> ArrayPatternNode::create()
    958     {
    959         return adoptRef(*new ArrayPatternNode);
    960     }
    961    
    962945    inline ObjectPatternNode::ObjectPatternNode()
    963946        : DestructuringPatternNode()
    964947    {
    965     }
    966    
    967     inline Ref<ObjectPatternNode> ObjectPatternNode::create()
    968     {
    969         return adoptRef(*new ObjectPatternNode);
    970     }
    971 
    972     inline Ref<BindingNode> BindingNode::create(const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext context)
    973     {
    974         return adoptRef(*new BindingNode(boundProperty, start, end, context));
    975948    }
    976949   
     
    984957    }
    985958   
    986     inline DestructuringAssignmentNode::DestructuringAssignmentNode(const JSTokenLocation& location, PassRefPtr<DestructuringPatternNode> bindings, ExpressionNode* initializer)
     959    inline DestructuringAssignmentNode::DestructuringAssignmentNode(const JSTokenLocation& location, DestructuringPatternNode* bindings, ExpressionNode* initializer)
    987960        : ExpressionNode(location)
    988961        , m_bindings(bindings)
  • trunk/Source/JavaScriptCore/parser/Nodes.cpp

    r186860 r186959  
    118118// ------------------------------ ProgramNode -----------------------------
    119119
    120 ProgramNode::ProgramNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack& funcStack, VariableEnvironment& lexicalVariables, const SourceCode& source, CodeFeatures features, int numConstants)
     120ProgramNode::ProgramNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack& funcStack, VariableEnvironment& lexicalVariables, FunctionParameters*, const SourceCode& source, CodeFeatures features, int numConstants)
    121121    : ScopeNode(parserArena, startLocation, endLocation, source, children, varEnvironment, funcStack, lexicalVariables, features, numConstants)
    122122    , m_startColumn(startColumn)
     
    132132// ------------------------------ EvalNode -----------------------------
    133133
    134 EvalNode::EvalNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack& funcStack, VariableEnvironment& lexicalVariables, const SourceCode& source, CodeFeatures features, int numConstants)
     134EvalNode::EvalNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack& funcStack, VariableEnvironment& lexicalVariables, FunctionParameters*, const SourceCode& source, CodeFeatures features, int numConstants)
    135135    : ScopeNode(parserArena, startLocation, endLocation, source, children, varEnvironment, funcStack, lexicalVariables, features, numConstants)
    136136    , m_endColumn(endColumn)
     
    140140// ------------------------------ FunctionBodyNode -----------------------------
    141141
    142 Ref<FunctionParameters> FunctionParameters::create(ParameterNode* firstParameter)
    143 {
    144     unsigned parameterCount = 0;
    145     for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam())
    146         ++parameterCount;
    147 
    148     size_t objectSize = sizeof(FunctionParameters) - sizeof(void*) + sizeof(DestructuringPatternNode*) * parameterCount;
    149     void* slot = fastMalloc(objectSize);
    150     return adoptRef(*new (slot) FunctionParameters(firstParameter, parameterCount));
    151 }
    152 
    153 FunctionParameters::FunctionParameters(ParameterNode* firstParameter, unsigned size)
    154     : m_size(size)
    155 {
    156     unsigned i = 0;
    157     for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam()) {
    158         auto pattern = parameter->pattern();
    159         pattern->ref();
    160         patterns()[i++] = pattern;
    161     }
    162 }
    163 
    164 FunctionParameters::~FunctionParameters()
    165 {
    166     for (unsigned i = 0; i < m_size; ++i)
    167         patterns()[i]->deref();
    168 }
    169 
    170142FunctionBodyNode::FunctionBodyNode(
    171143    ParserArena&, const JSTokenLocation& startLocation,
    172144    const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn,
    173     int functionKeywordStart, int functionNameStart, int parametersStart,
    174     bool isInStrictContext, ConstructorKind constructorKind)
     145    int functionKeywordStart, int functionNameStart, int parametersStart, bool isInStrictContext,
     146    ConstructorKind constructorKind, unsigned parameterCount, FunctionParseMode mode)
    175147        : StatementNode(endLocation)
    176148        , m_startColumn(startColumn)
     
    180152        , m_parametersStart(parametersStart)
    181153        , m_startStartOffset(startLocation.startOffset)
     154        , m_parameterCount(parameterCount)
     155        , m_parseMode(mode)
    182156        , m_isInStrictContext(isInStrictContext)
    183157        , m_constructorKind(static_cast<unsigned>(constructorKind))
     
    186160}
    187161
    188 void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter, const Identifier& ident, enum FunctionMode functionMode)
     162void FunctionBodyNode::finishParsing(const SourceCode& source, const Identifier& ident, enum FunctionMode functionMode)
    189163{
    190164    m_source = source;
    191     m_parameters = FunctionParameters::create(firstParameter);
    192165    m_ident = ident;
    193166    m_functionMode = functionMode;
     
    202175// ------------------------------ FunctionNode -----------------------------
    203176
    204 FunctionNode::FunctionNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack& funcStack, VariableEnvironment& lexicalVariables, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
     177FunctionNode::FunctionNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack& funcStack, VariableEnvironment& lexicalVariables, FunctionParameters* parameters, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
    205178    : ScopeNode(parserArena, startLocation, endLocation, sourceCode, children, varEnvironment, funcStack, lexicalVariables, features, numConstants)
     179    , m_parameters(parameters)
    206180    , m_startColumn(startColumn)
    207181    , m_endColumn(endColumn)
     
    209183}
    210184
    211 void FunctionNode::finishParsing(PassRefPtr<FunctionParameters> parameters, const Identifier& ident, enum FunctionMode functionMode)
     185void FunctionNode::finishParsing(const Identifier& ident, enum FunctionMode functionMode)
    212186{
    213187    ASSERT(!source().isNull());
    214     m_parameters = parameters;
    215188    m_ident = ident;
    216189    m_functionMode = functionMode;
  • trunk/Source/JavaScriptCore/parser/Nodes.h

    r186860 r186959  
    4343    class BytecodeGenerator;
    4444    class FunctionBodyNode;
     45    class FunctionParameters;
    4546    class Label;
    4647    class PropertyListNode;
     
    15421543    };
    15431544
    1544     class ParameterNode : public ParserArenaDeletable {
    1545     public:
    1546         ParameterNode(PassRefPtr<DestructuringPatternNode>);
    1547         ParameterNode(ParameterNode*, PassRefPtr<DestructuringPatternNode>);
    1548 
    1549         DestructuringPatternNode* pattern() const { return m_pattern.get(); }
    1550         ParameterNode* nextParam() const { return m_next; }
    1551 
    1552     private:
    1553         RefPtr<DestructuringPatternNode> m_pattern;
    1554         ParameterNode* m_next;
    1555     };
    1556 
    15571545    class ScopeNode : public StatementNode, public ParserArenaRoot, public VariableEnvironmentNode {
    15581546    public:
     
    16201608    class ProgramNode : public ScopeNode {
    16211609    public:
    1622         ProgramNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&, VariableEnvironment&, const SourceCode&, CodeFeatures, int numConstants);
     1610        ProgramNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&, VariableEnvironment&, FunctionParameters*, const SourceCode&, CodeFeatures, int numConstants);
    16231611
    16241612        unsigned startColumn() const { return m_startColumn; }
     
    16391627    class EvalNode : public ScopeNode {
    16401628    public:
    1641         EvalNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&, VariableEnvironment&, const SourceCode&, CodeFeatures, int numConstants);
     1629        EvalNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&, VariableEnvironment&, FunctionParameters*, const SourceCode&, CodeFeatures, int numConstants);
    16421630
    16431631        ALWAYS_INLINE unsigned startColumn() const { return 0; }
     
    16521640    };
    16531641
    1654     class FunctionParameters : public RefCounted<FunctionParameters> {
    1655         WTF_MAKE_FAST_ALLOCATED;
    1656         WTF_MAKE_NONCOPYABLE(FunctionParameters);
    1657     public:
    1658         static Ref<FunctionParameters> create(ParameterNode*);
    1659         ~FunctionParameters();
    1660 
    1661         unsigned size() const { return m_size; }
    1662         DestructuringPatternNode* at(unsigned index) { ASSERT(index < m_size); return patterns()[index]; }
    1663 
    1664     private:
    1665         FunctionParameters(ParameterNode*, unsigned size);
    1666 
    1667         DestructuringPatternNode** patterns() { return &m_storage; }
    1668 
    1669         unsigned m_size;
    1670         DestructuringPatternNode* m_storage;
     1642    class FunctionParameters : public ParserArenaDeletable {
     1643    public:
     1644        FunctionParameters();
     1645        ALWAYS_INLINE unsigned size() const { return m_patterns.size(); }
     1646        ALWAYS_INLINE DestructuringPatternNode* at(unsigned index) { return m_patterns[index]; }
     1647        ALWAYS_INLINE void append(DestructuringPatternNode* pattern) { ASSERT(pattern); m_patterns.append(pattern); }
     1648
     1649    private:
     1650
     1651        Vector<DestructuringPatternNode*, 3> m_patterns;
    16711652    };
    16721653
     
    16791660            unsigned startColumn, unsigned endColumn, int functionKeywordStart,
    16801661            int functionNameStart, int parametersStart, bool isInStrictContext,
    1681             ConstructorKind);
    1682 
    1683         FunctionParameters* parameters() const { return m_parameters.get(); }
    1684 
    1685         virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
    1686 
    1687         void finishParsing(const SourceCode&, ParameterNode*, const Identifier&, FunctionMode);
     1662            ConstructorKind, unsigned, FunctionParseMode);
     1663
     1664        virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
     1665
     1666        void finishParsing(const SourceCode&, const Identifier&, FunctionMode);
    16881667       
    16891668        void overrideName(const Identifier& ident) { m_ident = ident; }
     
    16991678        unsigned startColumn() const { return m_startColumn; }
    17001679        unsigned endColumn() const { return m_endColumn; }
     1680        unsigned parameterCount() const { return m_parameterCount; }
     1681        FunctionParseMode parseMode() const { return m_parseMode; }
    17011682
    17021683        void setEndPosition(JSTextPosition);
     
    17121693        Identifier m_inferredName;
    17131694        FunctionMode m_functionMode;
    1714         RefPtr<FunctionParameters> m_parameters;
    17151695        unsigned m_startColumn;
    17161696        unsigned m_endColumn;
     
    17201700        SourceCode m_source;
    17211701        int m_startStartOffset;
     1702        unsigned m_parameterCount;
     1703        FunctionParseMode m_parseMode;
    17221704        unsigned m_isInStrictContext : 1;
    17231705        unsigned m_constructorKind : 2;
     
    17261708    class FunctionNode final : public ScopeNode {
    17271709    public:
    1728         FunctionNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&, VariableEnvironment&, const SourceCode&, CodeFeatures, int numConstants);
    1729 
    1730         FunctionParameters* parameters() const { return m_parameters.get(); }
    1731 
    1732         virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
    1733 
    1734         void finishParsing(PassRefPtr<FunctionParameters>, const Identifier&, FunctionMode);
     1710        FunctionNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&, VariableEnvironment&, FunctionParameters*, const SourceCode&, CodeFeatures, int numConstants);
     1711
     1712        FunctionParameters* parameters() const { return m_parameters; }
     1713
     1714        virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
     1715
     1716        void finishParsing(const Identifier&, FunctionMode);
    17351717       
    17361718        const Identifier& ident() { return m_ident; }
     
    17461728        Identifier m_ident;
    17471729        FunctionMode m_functionMode;
    1748         RefPtr<FunctionParameters> m_parameters;
     1730        FunctionParameters* m_parameters;
    17491731        unsigned m_startColumn;
    17501732        unsigned m_endColumn;
     
    17531735    class FuncExprNode : public ExpressionNode {
    17541736    public:
    1755         FuncExprNode(const JSTokenLocation&, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0);
     1737        FuncExprNode(const JSTokenLocation&, const Identifier&, FunctionBodyNode*, const SourceCode&);
    17561738
    17571739        FunctionBodyNode* body() { return m_body; }
     
    17841766#endif
    17851767
    1786     class DestructuringPatternNode : public RefCounted<DestructuringPatternNode> {
    1787         WTF_MAKE_NONCOPYABLE(DestructuringPatternNode);
    1788         WTF_MAKE_FAST_ALLOCATED;
    1789 
    1790     public:
     1768    class DestructuringPatternNode : public ParserArenaDeletable {
     1769    public:
     1770        virtual ~DestructuringPatternNode() { }
    17911771        virtual void collectBoundIdentifiers(Vector<Identifier>&) const = 0;
    17921772        virtual void bindValue(BytecodeGenerator&, RegisterID* source) const = 0;
     
    17961776        virtual RegisterID* emitDirectBinding(BytecodeGenerator&, RegisterID*, ExpressionNode*) { return 0; }
    17971777       
    1798         virtual ~DestructuringPatternNode() = 0;
    1799        
    18001778    protected:
    18011779        DestructuringPatternNode();
     
    18041782    class ArrayPatternNode : public DestructuringPatternNode, public ThrowableExpressionData {
    18051783    public:
     1784        ArrayPatternNode();
    18061785        enum class BindingType {
    18071786            Elision,
     
    18101789        };
    18111790
    1812         static Ref<ArrayPatternNode> create();
    18131791        void appendIndex(BindingType bindingType, const JSTokenLocation&, DestructuringPatternNode* node, ExpressionNode* defaultValue)
    18141792        {
     
    18191797        struct Entry {
    18201798            BindingType bindingType;
    1821             RefPtr<DestructuringPatternNode> pattern;
     1799            DestructuringPatternNode* pattern;
    18221800            ExpressionNode* defaultValue;
    18231801        };
    1824         ArrayPatternNode();
    18251802        virtual void collectBoundIdentifiers(Vector<Identifier>&) const override;
    18261803        virtual void bindValue(BytecodeGenerator&, RegisterID*) const override;
     
    18331810    class ObjectPatternNode : public DestructuringPatternNode {
    18341811    public:
    1835         static Ref<ObjectPatternNode> create();
     1812        ObjectPatternNode();
    18361813        void appendEntry(const JSTokenLocation&, const Identifier& identifier, bool wasString, DestructuringPatternNode* pattern, ExpressionNode* defaultValue)
    18371814        {
     
    18401817       
    18411818    private:
    1842         ObjectPatternNode();
    18431819        virtual void collectBoundIdentifiers(Vector<Identifier>&) const override;
    18441820        virtual void bindValue(BytecodeGenerator&, RegisterID*) const override;
     
    18471823            Identifier propertyName;
    18481824            bool wasString;
    1849             RefPtr<DestructuringPatternNode> pattern;
     1825            DestructuringPatternNode* pattern;
    18501826            ExpressionNode* defaultValue;
    18511827        };
     
    18551831    class BindingNode : public DestructuringPatternNode {
    18561832    public:
    1857         static Ref<BindingNode> create(const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext);
     1833        BindingNode(const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext);
    18581834        const Identifier& boundProperty() const { return m_boundProperty; }
    18591835
     
    18621838       
    18631839    private:
    1864         BindingNode(const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext);
    1865 
    18661840        virtual void collectBoundIdentifiers(Vector<Identifier>&) const override;
    18671841        virtual void bindValue(BytecodeGenerator&, RegisterID*) const override;
     
    18781852    class DestructuringAssignmentNode : public ExpressionNode, public ParserArenaDeletable {
    18791853    public:
    1880         DestructuringAssignmentNode(const JSTokenLocation&, PassRefPtr<DestructuringPatternNode>, ExpressionNode*);
    1881         DestructuringPatternNode* bindings() { return m_bindings.get(); }
     1854        DestructuringAssignmentNode(const JSTokenLocation&, DestructuringPatternNode*, ExpressionNode*);
     1855        DestructuringPatternNode* bindings() { return m_bindings; }
    18821856       
    18831857        using ParserArenaDeletable::operator new;
     
    18881862        virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
    18891863
    1890         RefPtr<DestructuringPatternNode> m_bindings;
     1864        DestructuringPatternNode* m_bindings;
    18911865        ExpressionNode* m_initializer;
    18921866    };
     
    18941868    class FuncDeclNode : public StatementNode {
    18951869    public:
    1896         FuncDeclNode(const JSTokenLocation&, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0);
     1870        FuncDeclNode(const JSTokenLocation&, const Identifier&, FunctionBodyNode*, const SourceCode&);
    18971871
    18981872        virtual bool isFuncDeclNode() const override { return true; }
     
    19901964    };
    19911965
    1992     struct ParameterList {
    1993         ParameterNode* head;
    1994         ParameterNode* tail;
    1995     };
    1996 
    19971966    struct ClauseList {
    19981967        ClauseListNode* head;
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r186860 r186959  
    192192template <typename LexerType>
    193193Parser<LexerType>::Parser(
    194     VM* vm, const SourceCode& source, FunctionParameters* parameters,
    195     const Identifier& name, JSParserBuiltinMode builtinMode,
     194    VM* vm, const SourceCode& source, JSParserBuiltinMode builtinMode,
    196195    JSParserStrictMode strictMode, JSParserCodeType codeType,
    197196    ConstructorKind defaultConstructorKind, ThisTDZMode thisTDZMode)
     
    224223    if (strictMode == JSParserStrictMode::Strict)
    225224        scope->setStrictMode();
    226     if (parameters) {
    227         bool hadBindingParameters = false;
    228         for (unsigned i = 0; i < parameters->size(); i++) {
    229             auto parameter = parameters->at(i);
    230             if (!parameter->isBindingNode()) {
    231                 hadBindingParameters = true;
    232                 continue;
    233             }
    234             scope->declareParameter(&static_cast<BindingNode*>(parameter)->boundProperty());
    235         }
    236         if (hadBindingParameters) {
    237             Vector<Identifier> boundParameterNames;
    238             for (unsigned i = 0; i < parameters->size(); i++) {
    239                 auto parameter = parameters->at(i);
    240                 if (parameter->isBindingNode())
    241                     continue;
    242                 parameter->collectBoundIdentifiers(boundParameterNames);
    243             }
    244             for (auto& boundParameterName : boundParameterNames)
    245                 scope->declareVariable(&boundParameterName);
    246         }
    247     }
    248     if (!name.isNull())
    249         scope->declareCallee(&name);
     225
    250226    next();
    251227}
     
    257233
    258234template <typename LexerType>
    259 String Parser<LexerType>::parseInner()
     235String Parser<LexerType>::parseInner(const Identifier& calleeName, FunctionParseMode parseMode)
    260236{
    261237    String parseError = String();
    262238   
    263239    ASTBuilder context(const_cast<VM*>(m_vm), m_parserArena, const_cast<SourceCode*>(m_source));
    264     if (m_lexer->isReparsing())
    265         m_statementDepth--;
    266240    ScopeRef scope = currentScope();
    267241    scope->setIsLexicalScope();
    268242
    269     SourceElements* sourceElements = parseSourceElements(context, CheckForStrictMode, StandardFunctionParseType);
    270     if (!sourceElements || !consume(EOFTOK)) {
     243    bool isArrowFunctionBodyExpression = false;
     244    if (m_lexer->isReparsingFunction()) {
     245        ParserFunctionInfo<ASTBuilder> functionInfo;
     246        parseFunctionParameters(context, parseMode, functionInfo);
     247        m_parameters = functionInfo.parameters;
     248
     249#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
     250        if (parseMode == ArrowFunctionMode && !hasError()) {
     251            // The only way we could have an error wile reparsing is if we run out of stack space.
     252            RELEASE_ASSERT(match(ARROWFUNCTION));
     253            next();
     254            isArrowFunctionBodyExpression = !match(OPENBRACE);
     255        }
     256#endif
     257    }
     258
     259    if (!calleeName.isNull())
     260        scope->declareCallee(&calleeName);
     261
     262    if (m_lexer->isReparsingFunction())
     263        m_statementDepth--;
     264
     265    SourceElements* sourceElements = nullptr;
     266    // The only way we can error this early is if we reparse a function and we run out of stack space.
     267    if (!hasError()) {
     268        if (isArrowFunctionBodyExpression)
     269            sourceElements = parseArrowFunctionSingleExpressionBodySourceElements(context);
     270        else
     271            sourceElements = parseSourceElements(context, CheckForStrictMode);
     272    }
     273
     274    bool validEnding;
     275    if (isArrowFunctionBodyExpression) {
     276        ASSERT(m_lexer->isReparsingFunction());
     277        // When we reparse and stack overflow, we're not guaranteed a valid ending. If we don't run out of stack space,
     278        // then of course this will always be valid because we already parsed for syntax errors. But we must
     279        // be cautious in case we run out of stack space.
     280        validEnding = isEndOfArrowFunction();
     281    } else
     282        validEnding = consume(EOFTOK);
     283
     284    if (!sourceElements || !validEnding) {
    271285        if (hasError())
    272286            parseError = m_errorMessage;
     
    347361
    348362template <typename LexerType>
    349 template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseSourceElements(TreeBuilder& context, SourceElementsMode mode, FunctionParseType functionParseType)
     363template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseSourceElements(TreeBuilder& context, SourceElementsMode mode)
    350364{
    351365    const unsigned lengthOfUseStrictLiteral = 12; // "use strict".length
     
    356370    auto savePoint = createSavePoint();
    357371    bool hasSetStrict = false;
    358    
    359 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    360     if (match(ARROWFUNCTION)) {
    361         TreeStatement arrowfunctionStatement = parseArrowFunctionSingleExpressionBody(context, functionParseType);
    362            
    363         if (arrowfunctionStatement) {
    364             context.setEndOffset(arrowfunctionStatement, m_lastTokenEndPosition.offset);
    365             context.appendStatement(sourceElements, arrowfunctionStatement);
    366         }
    367        
    368         propagateError();
    369         return sourceElements;
    370     }
    371 #else
    372     UNUSED_PARAM(functionParseType);
    373 #endif
    374372   
    375373    while (TreeStatement statement = parseStatementListItem(context, directive, &directiveLiteralLength)) {
     
    663661}
    664662
    665 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    666 template <typename LexerType>
    667 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseArrowFunctionSingleExpressionBody(TreeBuilder& context, FunctionParseType parseType)
    668 {
    669     ASSERT(match(ARROWFUNCTION));
    670 
    671     // When reparsing phase, parseType becomes StandardFunctionParseType even if the function is arrow function.
    672     // This condition considers the following situations.
    673     // (1): If we are in the reparsing phase, this arrow function is already parsed once, so there is no syntax error.
    674     // (2): But if we are not in the reparsing phase, we should check this function is called in the context of the arrow function.
    675     if (!m_lexer->isReparsing() && parseType != ArrowFunctionParseType)
    676         failDueToUnexpectedToken();
    677    
     663template <typename LexerType>
     664template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseArrowFunctionSingleExpressionBodySourceElements(TreeBuilder& context)
     665{
     666    ASSERT(!match(OPENBRACE));
     667
    678668    JSTokenLocation location(tokenLocation());
    679669    JSTextPosition start = tokenStartPosition();
    680     JSTextPosition end = tokenEndPosition();
    681 
    682     next();
    683670
    684671    failIfStackOverflow();
     
    690677    failIfFalse(isEndOfArrowFunction(), "Expected a ';', ']', '}', ')', ',', line terminator or EOF following a arrow function statement");
    691678
    692     end = tokenEndPosition();
     679    JSTextPosition end = tokenEndPosition();
    693680   
    694681    if (!m_lexer->prevTerminator())
    695682        setEndOfStatement();
    696683
    697     return context.createReturnStatement(location, expr, start, end);
    698 }
    699 #endif
     684    TreeSourceElements sourceElements = context.createSourceElements();
     685    TreeStatement body = context.createReturnStatement(location, expr, start, end);
     686    context.setEndOffset(body, m_lastTokenEndPosition.offset);
     687    context.appendStatement(sourceElements, body);
     688
     689    return sourceElements;
     690}
    700691
    701692template <typename LexerType>
     
    12301221    failIfFalse(condition, "Cannot parse switch clause");
    12311222    consumeOrFail(COLON, "Expected a ':' after switch clause expression");
    1232     TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
     1223    TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode);
    12331224    failIfFalse(statements, "Cannot parse the body of a switch clause");
    12341225    TreeClause clause = context.createClause(condition, statements);
     
    12431234        failIfFalse(condition, "Cannot parse switch case expression");
    12441235        consumeOrFail(COLON, "Expected a ':' after switch clause expression");
    1245         TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
     1236        TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode);
    12461237        failIfFalse(statements, "Cannot parse the body of a switch clause");
    12471238        clause = context.createClause(condition, statements);
     
    12601251    next();
    12611252    consumeOrFail(COLON, "Expected a ':' after switch default clause");
    1262     TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
     1253    TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode);
    12631254    failIfFalse(statements, "Cannot parse the body of a switch default clause");
    12641255    TreeClause result = context.createClause(0, statements);
     
    13591350        return result;
    13601351    }
    1361     TreeSourceElements subtree = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
     1352    TreeSourceElements subtree = parseSourceElements(context, DontCheckForStrictMode);
    13621353    failIfFalse(subtree, "Cannot parse the body of the block statement");
    13631354    matchOrFail(CLOSEBRACE, "Expected a closing '}' at the end of a block statement");
     
    14671458
    14681459template <typename LexerType>
    1469 template <class TreeBuilder> TreeFormalParameterList Parser<LexerType>::parseFormalParameters(TreeBuilder& context)
     1460template <class TreeBuilder> bool Parser<LexerType>::parseFormalParameters(TreeBuilder& context, TreeFormalParameterList list, unsigned& parameterCount)
    14701461{
    14711462    auto parameter = parseDestructuringPattern(context, DestructureToParameters);
    14721463    failIfFalse(parameter, "Cannot parse parameter pattern");
    1473     TreeFormalParameterList list = context.createFormalParameterList(parameter);
    1474     TreeFormalParameterList tail = list;
     1464    context.appendParameter(list, parameter);
     1465    parameterCount++;
    14751466    while (consume(COMMA)) {
    14761467        parameter = parseDestructuringPattern(context, DestructureToParameters);
    14771468        failIfFalse(parameter, "Cannot parse parameter pattern");
    1478         tail = context.createFormalParameterList(tail, parameter);
    1479     }
    1480     return list;
     1469        context.appendParameter(list, parameter);
     1470        parameterCount++;
     1471    }
     1472    return true;
    14811473}
    14821474
    14831475template <typename LexerType>
    14841476template <class TreeBuilder> TreeFunctionBody Parser<LexerType>::parseFunctionBody(
    1485     TreeBuilder& context, int functionKeywordStart, int functionNameStart,
    1486     int parametersStart, ConstructorKind constructorKind, FunctionParseType parseType)
    1487 {
    1488     JSTokenLocation startLocation(tokenLocation());
    1489     unsigned startColumn = tokenColumn();
    1490 
    1491     if (parseType == StandardFunctionParseType) {
     1477    TreeBuilder& context, const JSTokenLocation& startLocation, int startColumn, int functionKeywordStart, int functionNameStart, int parametersStart,
     1478    ConstructorKind constructorKind, FunctionBodyType bodyType, unsigned parameterCount, FunctionParseMode parseMode)
     1479{
     1480    if (bodyType == StandardFunctionBodyBlock || bodyType == ArrowFunctionBodyBlock) {
    14921481        next();
    14931482        if (match(CLOSEBRACE)) {
    14941483            unsigned endColumn = tokenColumn();
    1495             return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind);
     1484            return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind, parameterCount, parseMode);
    14961485        }
    14971486    }
     
    14991488    DepthManager statementDepth(&m_statementDepth);
    15001489    m_statementDepth = 0;
    1501     typename TreeBuilder::FunctionBodyBuilder bodyBuilder(const_cast<VM*>(m_vm), m_lexer.get());
    1502 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    1503     failIfFalse(parseSourceElements(bodyBuilder, CheckForStrictMode, parseType), parseType == StandardFunctionParseType ? "Cannot parse body of this function" : "Cannot parse body of this arrow function");
    1504 #else
    1505     failIfFalse(parseSourceElements(bodyBuilder, CheckForStrictMode, StandardFunctionParseType), "Cannot parse body of this function");
    1506 #endif
     1490    SyntaxChecker syntaxChecker(const_cast<VM*>(m_vm), m_lexer.get());
     1491    if (bodyType == ArrowFunctionBodyExpression)
     1492        failIfFalse(parseArrowFunctionSingleExpressionBodySourceElements(syntaxChecker), "Cannot parse body of this arrow function");
     1493    else
     1494        failIfFalse(parseSourceElements(syntaxChecker, CheckForStrictMode), bodyType == StandardFunctionBodyBlock ? "Cannot parse body of this function" : "Cannot parse body of this arrow function");
    15071495    unsigned endColumn = tokenColumn();
    1508     return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind);
     1496    return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind, parameterCount, parseMode);
    15091497}
    15101498
     
    15161504    case SetterMode:
    15171505        return "setter";
    1518     case FunctionMode:
     1506    case NormalFunctionMode:
    15191507        return "function";
    15201508    case MethodMode:
    15211509        return "method";
    1522 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    15231510    case ArrowFunctionMode:
    15241511        return "arrow function";
    1525 #endif
     1512    case NotAFunctionMode:
     1513        RELEASE_ASSERT_NOT_REACHED();
     1514        return "";
    15261515    }
    15271516    RELEASE_ASSERT_NOT_REACHED();
     
    15291518}
    15301519
    1531 template <typename LexerType> template <class TreeBuilder> int Parser<LexerType>::parseFunctionParameters(TreeBuilder& context, FunctionParseMode mode, ParserFunctionInfo<TreeBuilder>& info)
    1532 {
     1520template <typename LexerType> template <class TreeBuilder> int Parser<LexerType>::parseFunctionParameters(TreeBuilder& context, FunctionParseMode mode, ParserFunctionInfo<TreeBuilder>& functionInfo)
     1521{
     1522    RELEASE_ASSERT(mode != NotAFunctionMode);
    15331523    int parametersStart = m_token.m_location.startOffset;
    1534    
    1535 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
     1524    TreeFormalParameterList parameterList = context.createFormalParameterList();
     1525    functionInfo.parameters = parameterList;
     1526    functionInfo.startOffset = parametersStart;
     1527   
    15361528    if (mode == ArrowFunctionMode) {
    15371529        if (!match(IDENT) && !match(OPENPAREN)) {
     
    15421534                next();
    15431535               
    1544                 if (!match(CLOSEPAREN)) {
    1545                     info.parameters = parseFormalParameters(context);
    1546                     failIfFalse(info.parameters, "Cannot parse parameters for this ", stringForFunctionMode(mode));
    1547                 }
     1536                if (match(CLOSEPAREN))
     1537                    functionInfo.parameterCount = 0;
     1538                else
     1539                    failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount), "Cannot parse parameters for this ", stringForFunctionMode(mode));
    15481540               
    15491541                consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration");
    15501542            } else {
     1543                functionInfo.parameterCount = 1;
    15511544                auto parameter = parseDestructuringPattern(context, DestructureToParameters);
    15521545                failIfFalse(parameter, "Cannot parse parameter pattern");
    1553                 info.parameters = context.createFormalParameterList(parameter);
    1554                 failIfFalse(info.parameters, "Cannot parse parameters for this ", stringForFunctionMode(mode));
     1546                context.appendParameter(parameterList, parameter);
    15551547            }
    15561548        }
    1557        
     1549
    15581550        return parametersStart;
    15591551    }
    1560 #endif
    1561    
     1552
    15621553    if (!consume(OPENPAREN)) {
    15631554        semanticFailureDueToKeyword(stringForFunctionMode(mode), " name");
     
    15651556    }
    15661557
    1567     if (mode == GetterMode)
     1558    if (mode == GetterMode) {
    15681559        consumeOrFail(CLOSEPAREN, "getter functions must have no parameters");
    1569     else if (mode == SetterMode) {
     1560        functionInfo.parameterCount = 0;
     1561    } else if (mode == SetterMode) {
    15701562        failIfTrue(match(CLOSEPAREN), "setter functions must have one parameter");
    15711563        auto parameter = parseDestructuringPattern(context, DestructureToParameters);
    15721564        failIfFalse(parameter, "setter functions must have one parameter");
    1573         info.parameters = context.createFormalParameterList(parameter);
     1565        context.appendParameter(parameterList, parameter);
     1566        functionInfo.parameterCount = 1;
    15741567        failIfTrue(match(COMMA), "setter functions must have one parameter");
    15751568        consumeOrFail(CLOSEPAREN, "Expected a ')' after a parameter declaration");
    15761569    } else {
    1577         if (!match(CLOSEPAREN)) {
    1578             info.parameters = parseFormalParameters(context);
    1579             failIfFalse(info.parameters, "Cannot parse parameters for this ", stringForFunctionMode(mode));
    1580         }
     1570        if (match(CLOSEPAREN))
     1571            functionInfo.parameterCount = 0;
     1572        else
     1573            failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount), "Cannot parse parameters for this ", stringForFunctionMode(mode));
    15811574        consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration");
    15821575    }
    1583    
     1576
    15841577    return parametersStart;
    15851578}
    15861579
    15871580template <typename LexerType>
    1588 template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& info, FunctionParseType parseType)
    1589 {
     1581template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& functionInfo, FunctionParseType parseType)
     1582{
     1583    RELEASE_ASSERT(mode != NotAFunctionMode);
     1584
    15901585    AutoPopScopeRef functionScope(this, pushScope());
    15911586    functionScope->setIsFunction();
     
    15941589    m_lastFunctionName = nullptr;
    15951590    int parametersStart;
     1591    JSTokenLocation startLocation;
     1592    int startColumn;
     1593    FunctionBodyType functionBodyType;
    15961594   
    15971595    switch (parseType) {
    15981596    case StandardFunctionParseType: {
     1597        RELEASE_ASSERT(mode != ArrowFunctionMode);
    15991598        if (match(IDENT) || isLETMaskedAsIDENT()) {
    1600             info.name = m_token.m_data.ident;
    1601             m_lastFunctionName = info.name;
     1599            functionInfo.name = m_token.m_data.ident;
     1600            m_lastFunctionName = functionInfo.name;
    16021601            next();
    16031602            if (!nameIsInContainingScope)
    1604                 failIfFalseIfStrict(functionScope->declareVariable(info.name), "'", info.name->impl(), "' is not a valid ", stringForFunctionMode(mode), " name in strict mode");
     1603                failIfFalseIfStrict(functionScope->declareVariable(functionInfo.name), "'", functionInfo.name->impl(), "' is not a valid ", stringForFunctionMode(mode), " name in strict mode");
    16051604        } else if (requirements == FunctionNeedsName) {
    1606             if (match(OPENPAREN) && mode == FunctionMode)
     1605            if (match(OPENPAREN) && mode == NormalFunctionMode)
    16071606                semanticFail("Function statements must have a name");
    16081607            semanticFailureDueToKeyword(stringForFunctionMode(mode), " name");
     
    16101609            return false;
    16111610        }
    1612        
    1613         parametersStart = parseFunctionParameters(context, mode, info);
     1611
     1612        startLocation = tokenLocation();
     1613        functionInfo.startLine = tokenLine();
     1614        startColumn = tokenColumn();
     1615
     1616        parametersStart = parseFunctionParameters(context, mode, functionInfo);
    16141617        propagateError();
    16151618       
     
    16231626            expectedSuperBinding = m_defaultConstructorKind == ConstructorKind::Derived ? SuperBinding::Needed : SuperBinding::NotNeeded;
    16241627        }
    1625        
    1626         info.startFunctionOffset = m_token.m_data.offset;
     1628
     1629        functionBodyType = StandardFunctionBodyBlock;
    16271630       
    16281631        break;
     
    16301633#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    16311634    case ArrowFunctionParseType: {
    1632         parametersStart = parseFunctionParameters(context, ArrowFunctionMode, info);
     1635        RELEASE_ASSERT(mode == ArrowFunctionMode);
     1636
     1637        startLocation = tokenLocation();
     1638        functionInfo.startLine = tokenLine();
     1639        startColumn = tokenColumn();
     1640
     1641        parametersStart = parseFunctionParameters(context, mode, functionInfo);
    16331642        propagateError();
    16341643       
     
    16401649        ASSERT(constructorKind == ConstructorKind::None);
    16411650       
    1642         info.arrowFunctionOffset = m_token.m_data.offset;
    16431651        // Check if arrow body start with {. If it true it mean that arrow function is Fat arrow function
    16441652        // and we need use common approach to parse function body
    1645         SavePoint savePoint = createSavePoint();
     1653        next();
     1654        functionBodyType = match(OPENBRACE) ? ArrowFunctionBodyBlock : ArrowFunctionBodyExpression;
    16461655       
    1647         next();
    1648         info.functionBodyType = match(OPENBRACE) ? ArrowFunctionBodyBlock : ArrowFunctionBodyExpression;
    1649         info.startFunctionOffset = (info.functionBodyType == ArrowFunctionBodyBlock) ? m_token.m_data.offset : info.arrowFunctionOffset;
    1650        
    1651         restoreSavePoint(savePoint);
    1652 
    1653         break;
    1654     }
     1656        break;
     1657    }
     1658#else
     1659    default:
     1660        RELEASE_ASSERT_NOT_REACHED();
    16551661#endif
    16561662    }
     
    16581664    bool isClassConstructor = constructorKind != ConstructorKind::None;
    16591665
    1660     info.bodyStartLine = tokenLine();
    1661     info.bodyStartColumn = m_token.m_data.offset - m_token.m_data.lineStartOffset;
    1662     JSTokenLocation startLocation(tokenLocation());
     1666    functionInfo.bodyStartColumn = startColumn;
    16631667   
    16641668    // If we know about this function already, we can use the cached info and skip the parser to the end of the function.
    1665     if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(info.startFunctionOffset) : 0) {
     1669    if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(functionInfo.startOffset) : 0) {
    16661670        // If we're in a strict context, the cached function info must say it was strict too.
    16671671        ASSERT(!strictMode() || cachedInfo->strictMode);
     
    16721676        endLocation.lineStartOffset = cachedInfo->lastTockenLineStartOffset;
    16731677
    1674         bool endColumnIsOnStartLine = (endLocation.line == info.bodyStartLine);
     1678        bool endColumnIsOnStartLine = (endLocation.line == functionInfo.startLine);
    16751679        ASSERT(endLocation.startOffset >= endLocation.lineStartOffset);
    16761680        unsigned bodyEndColumn = endColumnIsOnStartLine ?
     
    16791683        unsigned currentLineStartOffset = m_token.m_location.lineStartOffset;
    16801684
    1681         info.body = context.createFunctionBody(
    1682             startLocation, endLocation, info.bodyStartColumn, bodyEndColumn,
     1685        functionInfo.body = context.createFunctionBody(
     1686            startLocation, endLocation, functionInfo.bodyStartColumn, bodyEndColumn,
    16831687            functionKeywordStart, functionNameStart, parametersStart,
    1684             cachedInfo->strictMode, constructorKind);
     1688            cachedInfo->strictMode, constructorKind, cachedInfo->parameterCount, mode);
    16851689       
    16861690        functionScope->restoreFromSourceProviderCache(cachedInfo);
     
    16941698        m_lexer->setOffset(m_token.m_location.endOffset, m_token.m_location.lineStartOffset);
    16951699        m_lexer->setLineNumber(m_token.m_location.line);
    1696         info.endFunctionOffset = cachedInfo->endFunctionOffset;
    1697 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
     1700        functionInfo.endOffset = cachedInfo->endFunctionOffset;
     1701
    16981702        if (parseType == ArrowFunctionParseType)
    1699             info.functionBodyType = cachedInfo->isBodyArrowExpression ?  ArrowFunctionBodyExpression : ArrowFunctionBodyBlock;
     1703            functionBodyType = cachedInfo->isBodyArrowExpression ?  ArrowFunctionBodyExpression : ArrowFunctionBodyBlock;
    17001704        else
    1701             info.functionBodyType = StandardFunctionBodyBlock;
     1705            functionBodyType = StandardFunctionBodyBlock;
    17021706       
    1703         switch (info.functionBodyType) {
     1707        switch (functionBodyType) {
    17041708        case ArrowFunctionBodyExpression:
    17051709            next();
    1706             context.setEndOffset(info.body, m_lexer->currentOffset());
     1710            context.setEndOffset(functionInfo.body, m_lexer->currentOffset());
    17071711            break;
    17081712        case ArrowFunctionBodyBlock:
    17091713        case StandardFunctionBodyBlock:
    1710             context.setEndOffset(info.body, m_lexer->currentOffset());
     1714            context.setEndOffset(functionInfo.body, m_lexer->currentOffset());
    17111715            next();
    17121716            break;
    17131717        }
    1714 #else
    1715         context.setEndOffset(info.body, m_lexer->currentOffset());
    1716         next();
    1717 #endif
    1718         info.bodyEndLine = m_lastTokenEndPosition.line;
     1718        functionInfo.endLine = m_lastTokenEndPosition.line;
    17191719        return true;
    17201720    }
     
    17231723    ParserState oldState = saveState();
    17241724   
    1725 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    1726     switch (info.functionBodyType) {
    1727     case ArrowFunctionBodyBlock: {
    1728         // Consume => in case of arrow function block e.g. x => { return x; }
    1729         next();
    1730    
    1731         info.bodyStartLine = tokenLine();
    1732         info.bodyStartColumn = m_token.m_data.offset - m_token.m_data.lineStartOffset;
    1733            
    1734         info.body = parseFunctionBody(context, functionKeywordStart, functionNameStart, parametersStart, constructorKind, StandardFunctionParseType);
    1735         break;
    1736     }
    1737     case StandardFunctionBodyBlock:
    1738     case ArrowFunctionBodyExpression : {
    1739         info.body = parseFunctionBody(context, functionKeywordStart, functionNameStart, parametersStart, constructorKind, parseType);
    1740         break;
    1741     }
    1742     }
    1743 #else
    1744     info.body = parseFunctionBody(context, functionKeywordStart, functionNameStart, parametersStart, constructorKind, StandardFunctionParseType);
    1745 #endif
     1725    functionInfo.body = parseFunctionBody(context, startLocation, startColumn, functionKeywordStart, functionNameStart, parametersStart, constructorKind, functionBodyType, functionInfo.parameterCount, mode);
    17461726   
    17471727    restoreState(oldState);
    1748     failIfFalse(info.body, "Cannot parse the body of this ", stringForFunctionMode(mode));
    1749     context.setEndOffset(info.body, m_lexer->currentOffset());
    1750     if (functionScope->strictMode() && info.name) {
    1751         RELEASE_ASSERT(mode == FunctionMode || mode == MethodMode);
    1752         semanticFailIfTrue(m_vm->propertyNames->arguments == *info.name, "'", info.name->impl(), "' is not a valid function name in strict mode");
    1753         semanticFailIfTrue(m_vm->propertyNames->eval == *info.name, "'", info.name->impl(), "' is not a valid function name in strict mode");
     1728    failIfFalse(functionInfo.body, "Cannot parse the body of this ", stringForFunctionMode(mode));
     1729    context.setEndOffset(functionInfo.body, m_lexer->currentOffset());
     1730    if (functionScope->strictMode() && functionInfo.name) {
     1731        RELEASE_ASSERT(mode == NormalFunctionMode || mode == MethodMode);
     1732        semanticFailIfTrue(m_vm->propertyNames->arguments == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode");
     1733        semanticFailIfTrue(m_vm->propertyNames->eval == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode");
    17541734    }
    17551735    if (functionScope->hasDirectSuper()) {
     
    17611741
    17621742    JSTokenLocation location = JSTokenLocation(m_token.m_location);
    1763     info.endFunctionOffset = m_token.m_data.offset;
    1764    
    1765 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    1766     if (info.functionBodyType == ArrowFunctionBodyExpression) {
     1743    functionInfo.endOffset = m_token.m_data.offset;
     1744   
     1745    if (functionBodyType == ArrowFunctionBodyExpression) {
    17671746        location = locationBeforeLastToken();
    1768         info.endFunctionOffset = location.endOffset;
    1769     }
    1770 #endif
     1747        functionInfo.endOffset = location.endOffset;
     1748    }
    17711749   
    17721750    // Cache the tokenizer state and the function scope the first time the function is parsed.
     
    17741752    static const int minimumFunctionLengthToCache = 16;
    17751753    std::unique_ptr<SourceProviderCacheItem> newInfo;
    1776     int functionLength = info.endFunctionOffset - info.startFunctionOffset;
     1754    int functionLength = functionInfo.endOffset - functionInfo.startOffset;
    17771755    if (TreeBuilder::CanUseFunctionCache && m_functionCache && functionLength > minimumFunctionLengthToCache) {
    17781756        SourceProviderCacheItemCreationParameters parameters;
    1779         parameters.endFunctionOffset = info.endFunctionOffset;
     1757        parameters.endFunctionOffset = functionInfo.endOffset;
    17801758        parameters.functionNameStart = functionNameStart;
    17811759        parameters.lastTockenLine = location.line;
     
    17831761        parameters.lastTockenEndOffset = location.endOffset;
    17841762        parameters.lastTockenLineStartOffset = location.lineStartOffset;
    1785 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    1786         if (info.functionBodyType == ArrowFunctionBodyExpression) {
     1763        parameters.parameterCount = functionInfo.parameterCount;
     1764        if (functionBodyType == ArrowFunctionBodyExpression) {
    17871765            parameters.isBodyArrowExpression = true;
    17881766            parameters.tokenType = m_token.m_type;
    17891767        }
    1790 #endif
    17911768        functionScope->fillParametersForSourceProviderCache(parameters);
    17921769        newInfo = SourceProviderCacheItem::create(parameters);
     
    17951772    popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo);
    17961773   
    1797 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    1798     if (info.functionBodyType == ArrowFunctionBodyExpression)
     1774    if (functionBodyType == ArrowFunctionBodyExpression)
    17991775        failIfFalse(isEndOfArrowFunction(), "Expected the closing ';' ',' ']' ')' '}', line terminator or EOF after arrow function");
    18001776    else {
     
    18021778        next();
    18031779    }
    1804 #else
    1805     matchOrFail(CLOSEBRACE, "Expected a closing '}' after a ", stringForFunctionMode(mode), " body");
    1806     next();
    1807 #endif
    18081780   
    18091781    if (newInfo)
    1810         m_functionCache->add(info.startFunctionOffset, WTF::move(newInfo));
    1811    
    1812     info.bodyEndLine = m_lastTokenEndPosition.line;
     1782        m_functionCache->add(functionInfo.startOffset, WTF::move(newInfo));
     1783   
     1784    functionInfo.endLine = m_lastTokenEndPosition.line;
    18131785    return true;
    18141786}
     
    18211793    unsigned functionKeywordStart = tokenStart();
    18221794    next();
    1823     ParserFunctionInfo<TreeBuilder> info;
    1824     failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded,
    1825         functionKeywordStart, info, StandardFunctionParseType)), "Cannot parse this function");
    1826     failIfFalse(info.name, "Function statements must have a name");
    1827     failIfFalseIfStrict(declareVariable(info.name), "Cannot declare a function named '", info.name->impl(), "' in strict mode");
    1828     return context.createFuncDeclStatement(location, info);
     1795    ParserFunctionInfo<TreeBuilder> functionInfo;
     1796    failIfFalse((parseFunctionInfo(context, FunctionNeedsName, NormalFunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded,
     1797        functionKeywordStart, functionInfo, StandardFunctionParseType)), "Cannot parse this function");
     1798    failIfFalse(functionInfo.name, "Function statements must have a name");
     1799    failIfFalseIfStrict(declareVariable(functionInfo.name), "Cannot declare a function named '", functionInfo.name->impl(), "' in strict mode");
     1800    return context.createFuncDeclStatement(location, functionInfo);
    18291801}
    18301802
     
    19401912            ParserFunctionInfo<TreeBuilder> methodInfo;
    19411913            bool isConstructor = !isStaticMethod && *ident == propertyNames.constructor;
    1942             failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, isStaticMethod ? FunctionMode : MethodMode, false, isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method");
     1914            failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, isStaticMethod ? NormalFunctionMode : MethodMode, false, isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method");
    19431915            failIfFalse(ident && declareVariable(ident), "Cannot declare a method named '", methodInfo.name->impl(), "'");
    19441916            methodInfo.name = isConstructor ? className : ident;
     
    27582730        ParserFunctionInfo<TreeBuilder> info;
    27592731        info.name = &m_vm->propertyNames->nullIdentifier;
    2760         failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, StandardFunctionParseType)), "Cannot parse function expression");
     2732        failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, NormalFunctionMode, false, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, StandardFunctionParseType)), "Cannot parse function expression");
    27612733        return context.createFunctionExpr(location, info);
    27622734    }
     
    30032975}
    30042976
    3005 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    30062977template <typename LexerType>
    30072978template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArrowFunctionExpression(TreeBuilder& context)
     
    30132984    ParserFunctionInfo<TreeBuilder> info;
    30142985    info.name = &m_vm->propertyNames->nullIdentifier;
    3015     failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, ArrowFunctionParseType)), "Cannot parse arrow function expression");
     2986    failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, ArrowFunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, ArrowFunctionParseType)), "Cannot parse arrow function expression");
    30162987
    30172988    return context.createArrowFunctionExpr(location, info);
    30182989}
    3019 #endif
    30202990
    30212991static const char* operatorString(bool prefix, unsigned tok)
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r186860 r186959  
    8282
    8383enum SourceElementsMode { CheckForStrictMode, DontCheckForStrictMode };
    84 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    8584enum FunctionParseType { StandardFunctionParseType, ArrowFunctionParseType };
    86 #else
    87 enum FunctionParseType { StandardFunctionParseType};
    88 #endif
     85enum FunctionBodyType { ArrowFunctionBodyExpression, ArrowFunctionBodyBlock, StandardFunctionBodyBlock };
    8986enum FunctionRequirements { FunctionNoRequirements, FunctionNeedsName };
    90 enum FunctionParseMode {
    91     FunctionMode,
    92     GetterMode,
    93     SetterMode,
    94     MethodMode,
    95 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    96     ArrowFunctionMode
    97 #endif
    98 };
    9987enum DestructuringKind {
    10088    DestructureToVariables,
     
    538526public:
    539527    Parser(
    540         VM*, const SourceCode&, FunctionParameters*, const Identifier&,
    541         JSParserBuiltinMode, JSParserStrictMode, JSParserCodeType,
     528        VM*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, JSParserCodeType,
    542529        ConstructorKind defaultConstructorKind = ConstructorKind::None, ThisTDZMode = ThisTDZMode::CheckIfNeeded);
    543530    ~Parser();
    544531
    545532    template <class ParsedNode>
    546     std::unique_ptr<ParsedNode> parse(ParserError&);
     533    std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, FunctionParseMode);
    547534
    548535    JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); }
     
    740727
    741728    Parser();
    742     String parseInner();
     729    String parseInner(const Identifier&, FunctionParseMode);
    743730
    744731    void didFinishParsing(SourceElements*, DeclarationStacks::FunctionStack&, VariableEnvironment&, CodeFeatures, int, const Vector<RefPtr<UniquedStringImpl>>&&);
     
    797784    }
    798785   
     786    ALWAYS_INLINE bool isEndOfArrowFunction()
     787    {
     788        return match(SEMICOLON) || match(COMMA) || match(CLOSEPAREN) || match(CLOSEBRACE) || match(CLOSEBRACKET) || match(EOFTOK) || m_lexer->prevTerminator();
     789    }
     790   
     791    ALWAYS_INLINE bool isArrowFunctionParamters()
     792    {
    799793#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    800     ALWAYS_INLINE bool isEndOfArrowFunction()
    801     {
    802         return match(SEMICOLON) || match(COMMA) || match(CLOSEPAREN) || match(CLOSEBRACE) || match(CLOSEBRACKET) || match(EOFTOK) || m_lexer->prevTerminator();
    803     }
    804    
    805     ALWAYS_INLINE bool isArrowFunctionParamters()
    806     {
    807794        bool isArrowFunction = false;
    808795       
     
    835822       
    836823        return isArrowFunction;
    837     }
     824#else
     825        return false;
    838826#endif
     827    }
    839828   
    840829    ALWAYS_INLINE unsigned tokenStart()
     
    947936    }
    948937
    949     template <class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&, SourceElementsMode, FunctionParseType);
     938    template <class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&, SourceElementsMode);
    950939    template <class TreeBuilder> TreeStatement parseStatementListItem(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength);
    951940    template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength = 0);
     
    988977    template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName);
    989978    template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind = ConstructorKind::None, SuperBinding = SuperBinding::NotNeeded);
    990     template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, FunctionParseType);
    991     template <class TreeBuilder> ALWAYS_INLINE TreeFormalParameterList parseFormalParameters(TreeBuilder&);
     979    template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, FunctionBodyType, unsigned, FunctionParseMode);
     980    template <class TreeBuilder> ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&, TreeFormalParameterList, unsigned&);
    992981    enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext };
    993982    template <class TreeBuilder> TreeExpression parseVariableDeclarationList(TreeBuilder&, int& declarations, TreeDestructuringPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd, VarDeclarationListContext, DeclarationType);
    994983    template <class TreeBuilder> NEVER_INLINE TreeConstDeclList parseConstDeclarationList(TreeBuilder&);
    995 
    996 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    997     template <class TreeBuilder> TreeStatement parseArrowFunctionSingleExpressionBody(TreeBuilder&, FunctionParseType);
     984    template <class TreeBuilder> TreeSourceElements parseArrowFunctionSingleExpressionBodySourceElements(TreeBuilder&);
    998985    template <class TreeBuilder> TreeExpression parseArrowFunctionExpression(TreeBuilder&);
    999 #endif
    1000 
    1001986    template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern createBindingPattern(TreeBuilder&, DestructuringKind, const Identifier&, int depth, JSToken, AssignmentContext);
    1002987    template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern parseDestructuringPattern(TreeBuilder&, DestructuringKind, AssignmentContext = AssignmentContext::DeclarationStatement, int depth = 0);
     
    10311016    }
    10321017   
    1033 
    1034 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    10351018    void setEndOfStatement()
    10361019    {
    10371020        m_lexer->setTokenPosition(&m_token);
    10381021    }
    1039 #endif
    10401022
    10411023    bool canRecurse()
     
    11091091    ParserArena m_parserArena;
    11101092    std::unique_ptr<LexerType> m_lexer;
     1093    FunctionParameters* m_parameters { nullptr };
    11111094   
    11121095    bool m_hasStackOverflow;
     
    11541137template <typename LexerType>
    11551138template <class ParsedNode>
    1156 std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error)
     1139std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, FunctionParseMode parseMode)
    11571140{
    11581141    int errLine;
     
    11601143
    11611144    if (ParsedNode::scopeIsFunction)
    1162         m_lexer->setIsReparsing();
     1145        m_lexer->setIsReparsingFunction();
    11631146
    11641147    m_sourceElements = 0;
     
    11711154    unsigned startColumn = m_source->startColumn() - 1;
    11721155
    1173     String parseError = parseInner();
     1156    String parseError = parseInner(calleeName, parseMode);
    11741157
    11751158    int lineNumber = m_lexer->lineNumber();
     
    12011184                                    m_funcDeclarations,
    12021185                                    currentScope()->finalizeLexicalEnvironment(),
     1186                                    m_parameters,
    12031187                                    *m_source,
    12041188                                    m_features,
     
    12341218template <class ParsedNode>
    12351219std::unique_ptr<ParsedNode> parse(
    1236     VM* vm, const SourceCode& source, FunctionParameters* parameters,
     1220    VM* vm, const SourceCode& source,
    12371221    const Identifier& name, JSParserBuiltinMode builtinMode,
    12381222    JSParserStrictMode strictMode, JSParserCodeType codeType,
    1239     ParserError& error, JSTextPosition* positionBeforeLastNewline = 0,
    1240     ConstructorKind defaultConstructorKind = ConstructorKind::None, ThisTDZMode thisTDZMode = ThisTDZMode::CheckIfNeeded)
     1223    ParserError& error, JSTextPosition* positionBeforeLastNewline = nullptr,
     1224    FunctionParseMode parseMode = NotAFunctionMode, ConstructorKind defaultConstructorKind = ConstructorKind::None,
     1225    ThisTDZMode thisTDZMode = ThisTDZMode::CheckIfNeeded)
    12411226{
    12421227    SamplingRegion samplingRegion("Parsing");
     
    12441229    ASSERT(!source.provider()->source().isNull());
    12451230    if (source.provider()->source().is8Bit()) {
    1246         Parser<Lexer<LChar>> parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
    1247         std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error);
     1231        Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
     1232        std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
    12481233        if (positionBeforeLastNewline)
    12491234            *positionBeforeLastNewline = parser.positionBeforeLastNewline();
     
    12571242    }
    12581243    ASSERT_WITH_MESSAGE(defaultConstructorKind == ConstructorKind::None, "BuiltinExecutables::createDefaultConstructor should always use a 8-bit string");
    1259     Parser<Lexer<UChar>> parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
    1260     std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error);
     1244    Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
     1245    std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
    12611246    if (positionBeforeLastNewline)
    12621247        *positionBeforeLastNewline = parser.positionBeforeLastNewline();
  • trunk/Source/JavaScriptCore/parser/ParserFunctionInfo.h

    r185989 r186959  
    2929namespace JSC {
    3030
    31 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    32 enum FunctionBodyType { ArrowFunctionBodyExpression, ArrowFunctionBodyBlock, StandardFunctionBodyBlock };
    33 #endif
    34 
    3531template <class TreeBuilder>
    3632struct ParserFunctionInfo {
     
    3834    typename TreeBuilder::FormalParameterList parameters = 0;
    3935    typename TreeBuilder::FunctionBody body = 0;
    40     unsigned startFunctionOffset = 0;
    41     unsigned endFunctionOffset = 0;
    42     int bodyStartLine = 0;
    43     int bodyEndLine = 0;
     36    unsigned parameterCount = 0;
     37    unsigned startOffset = 0;
     38    unsigned endOffset = 0;
     39    int startLine = 0;
     40    int endLine = 0;
    4441    unsigned bodyStartColumn = 0;
    45 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    46     unsigned arrowFunctionOffset = 0;
    47     unsigned arrowFunctionNextTockenEndOffset = 0;
    48     bool isArrowFunction { false };
    49     bool isEndByTerminator { false };
    50     FunctionBodyType functionBodyType { StandardFunctionBodyBlock };
    51 #endif
    5242};
    5343
  • trunk/Source/JavaScriptCore/parser/ParserModes.h

    r182198 r186959  
    4545enum FunctionMode { FunctionExpression, FunctionDeclaration };
    4646
     47enum FunctionParseMode {
     48    NormalFunctionMode,
     49    GetterMode,
     50    SetterMode,
     51    MethodMode,
     52    NotAFunctionMode,
     53    ArrowFunctionMode
     54};
     55
    4756inline bool functionNameIsInScope(const Identifier& name, FunctionMode functionMode)
    4857{
  • trunk/Source/JavaScriptCore/parser/SourceCode.h

    r185989 r186959  
    106106        SourceCode subExpression(unsigned openBrace, unsigned closeBrace, int firstLine, int startColumn);
    107107
    108 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    109         SourceCode subArrowExpression(unsigned startArrowFunction, unsigned endArrowFunction, int firstLine, int startColumn);
    110 #endif
    111108    private:
    112109        RefPtr<SourceProvider> m_provider;
     
    122119    }
    123120   
    124 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    125     inline SourceCode SourceCode::subArrowExpression(unsigned startArrowFunction, unsigned endArrowFunction, int firstLine, int startColumn)
    126     {
    127         ASSERT(provider()->source()[startArrowFunction] == '=' && provider()->source()[startArrowFunction + 1] == '>');
    128 
    129         startColumn += 1; // Convert to base 1.
    130         return SourceCode(provider(), startArrowFunction, endArrowFunction, firstLine, startColumn);
    131     }
    132 #endif
    133 
    134121    inline SourceCode SourceCode::subExpression(unsigned openBrace, unsigned closeBrace, int firstLine, int startColumn)
    135122    {
    136         ASSERT(provider()->source()[openBrace] == '{');
    137         ASSERT(provider()->source()[closeBrace] == '}');
    138123        startColumn += 1; // Convert to base 1.
    139124        return SourceCode(provider(), openBrace, closeBrace + 1, firstLine, startColumn);
  • trunk/Source/JavaScriptCore/parser/SourceProviderCache.h

    r177130 r186959  
    4444
    4545private:
    46     HashMap<int, std::unique_ptr<SourceProviderCacheItem>> m_map;
     46    HashMap<int, std::unique_ptr<SourceProviderCacheItem>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> m_map;
    4747};
    4848
  • trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h

    r185989 r186959  
    4141    unsigned lastTockenLineStartOffset;
    4242    unsigned endFunctionOffset;
     43    unsigned parameterCount;
    4344    bool needsFullActivation;
    4445    bool usesEval;
     
    4647    Vector<RefPtr<UniquedStringImpl>> usedVariables;
    4748    Vector<RefPtr<UniquedStringImpl>> writtenVariables;
    48 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    4949    bool isBodyArrowExpression { false };
    5050    JSTokenType tokenType { CLOSEBRACE };
    51 #endif
    5251};
    5352
     
    6665    {
    6766        JSToken token;
    68 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    6967        token.m_type = isBodyArrowExpression ? tokenType : CLOSEBRACE;
    70 #else
    71         token.m_type = CLOSEBRACE;
    72 #endif
    7368        token.m_data.offset = lastTockenStartOffset;
    7469        token.m_location.startOffset = lastTockenStartOffset;
     
    8883    unsigned lastTockenStartOffset : 31;
    8984    unsigned lastTockenEndOffset: 31;
     85    unsigned parameterCount;
    9086   
    9187    bool usesEval : 1;
     
    9995    UniquedStringImpl** usedVariables() const { return const_cast<UniquedStringImpl**>(m_variables); }
    10096    UniquedStringImpl** writtenVariables() const { return const_cast<UniquedStringImpl**>(&m_variables[usedVariablesCount]); }
    101 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    10297    bool isBodyArrowExpression;
    10398    JSTokenType tokenType;
    104 #endif
    10599
    106100private:
     
    131125    , lastTockenStartOffset(parameters.lastTockenStartOffset)
    132126    , lastTockenEndOffset(parameters.lastTockenEndOffset)
     127    , parameterCount(parameters.parameterCount)
    133128    , usesEval(parameters.usesEval)
    134129    , strictMode(parameters.strictMode)
     
    136131    , usedVariablesCount(parameters.usedVariables.size())
    137132    , writtenVariablesCount(parameters.writtenVariables.size())
    138 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
    139133    , isBodyArrowExpression(parameters.isBodyArrowExpression)
    140134    , tokenType(parameters.tokenType)
    141 #endif
    142135{
    143136    unsigned j = 0;
  • trunk/Source/JavaScriptCore/parser/SyntaxChecker.h

    r186860 r186959  
    7070    }
    7171
    72     typedef SyntaxChecker FunctionBodyBuilder;
    7372    enum { NoneExpr = 0,
    7473        ResolveEvalExpr, ResolveExpr, IntegerExpr, DoubleExpr, StringExpr,
     
    180179#endif
    181180    ExpressionType createFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
    182     int createFunctionBody(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind) { return FunctionBodyResult; }
    183 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
     181    int createFunctionBody(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind, unsigned, int) { return FunctionBodyResult; }
    184182    ExpressionType createArrowFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
    185 #endif
    186183    void setFunctionNameStart(int, int) { }
    187184    int createArguments() { return ArgumentsResult; }
     
    222219    int createElementList(int, int) { return ElementsListResult; }
    223220    int createElementList(int, int, int) { return ElementsListResult; }
    224     int createFormalParameterList(DestructuringPattern) { return FormalParameterListResult; }
    225     int createFormalParameterList(int, DestructuringPattern) { return FormalParameterListResult; }
     221    int createFormalParameterList() { return FormalParameterListResult; }
     222    void appendParameter(int, DestructuringPattern) { }
    226223    int createClause(int, int) { return ClauseResult; }
    227224    int createClauseList(int) { return ClauseListResult; }
  • trunk/Source/JavaScriptCore/runtime/CodeCache.cpp

    r186860 r186959  
    9595    typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode;
    9696    std::unique_ptr<RootNode> rootNode = parse<RootNode>(
    97         &vm, source, 0, Identifier(), builtinMode, strictMode,
    98         JSParserCodeType::Program, error, 0, ConstructorKind::None, thisTDZMode);
     97        &vm, source, Identifier(), builtinMode, strictMode,
     98        JSParserCodeType::Program, error, nullptr, FunctionParseMode::NotAFunctionMode, ConstructorKind::None, thisTDZMode);
    9999    if (!rootNode)
    100100        return nullptr;
     
    146146    JSTextPosition positionBeforeLastNewline;
    147147    std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
    148         &vm, source, 0, Identifier(), JSParserBuiltinMode::NotBuiltin,
     148        &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    149149        JSParserStrictMode::NotStrict, JSParserCodeType::Program,
    150150        error, &positionBeforeLastNewline);
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r185608 r186959  
    5858    RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
    5959    return !!parse<ProgramNode>(
    60         &vm, source, 0, Identifier(), JSParserBuiltinMode::NotBuiltin,
     60        &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    6161        JSParserStrictMode::NotStrict, JSParserCodeType::Program, error);
    6262}
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r186860 r186959  
    476476    JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
    477477    std::unique_ptr<ProgramNode> programNode = parse<ProgramNode>(
    478         vm, m_source, 0, Identifier(), JSParserBuiltinMode::NotBuiltin,
     478        vm, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    479479        JSParserStrictMode::NotStrict, JSParserCodeType::Program, error);
    480480    if (programNode)
  • trunk/Source/JavaScriptCore/tests/controlFlowProfiler/conditional-expression.js

    r180518 r186959  
    2525}
    2626testConditionalFunctionCall(false, false);
    27 checkBasicBlock(testConditionalFunctionCall, "x", ShouldHaveExecuted);
     27checkBasicBlock(testConditionalFunctionCall, "x ?", ShouldHaveExecuted);
    2828checkBasicBlock(testConditionalFunctionCall, "? y", ShouldHaveExecuted);
    2929checkBasicBlock(testConditionalFunctionCall, "bar", ShouldHaveExecuted);
    3030checkBasicBlock(testConditionalFunctionCall, ": bar", ShouldHaveExecuted);
    31 checkBasicBlock(testConditionalFunctionCall, "y", ShouldNotHaveExecuted);
     31checkBasicBlock(testConditionalFunctionCall, "y ?", ShouldNotHaveExecuted);
    3232checkBasicBlock(testConditionalFunctionCall, "? foo", ShouldNotHaveExecuted);
    3333checkBasicBlock(testConditionalFunctionCall, "foo", ShouldNotHaveExecuted);
     
    3535
    3636testConditionalFunctionCall(true, false);
    37 checkBasicBlock(testConditionalFunctionCall, "y", ShouldHaveExecuted);
     37checkBasicBlock(testConditionalFunctionCall, "y ?", ShouldHaveExecuted);
    3838checkBasicBlock(testConditionalFunctionCall, "? foo", ShouldHaveExecuted);
    3939checkBasicBlock(testConditionalFunctionCall, ": baz", ShouldHaveExecuted);
Note: See TracChangeset for help on using the changeset viewer.