Changeset 206268 in webkit


Ignore:
Timestamp:
Sep 22, 2016 12:11:23 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

test262: Function length should be number of parameters before parameters with default values
https://bugs.webkit.org/show_bug.cgi?id=162377

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-09-22
Reviewed by Saam Barati.

JSTests:

  • stress/es6-default-parameters.js:

Add our own tests for function lengths with default parameters.

  • test262.yaml:

We now pass all dflt-length tests.

Source/JavaScriptCore:

https://tc39.github.io/ecma262/#sec-function-definitions-static-semantics-expectedargumentcount

NOTE: The ExpectedArgumentCount of a FormalParameterList is the number of
FormalParameters to the left of either the rest parameter or the first
FormalParameter with an Initializer. A FormalParameter without an
initializer is allowed after the first parameter with an initializer
but such parameters are considered to be optional with undefined as
their default value.

Alongside the parameterCount value, maintain a separate count,
functionLength, which will be the count before seeing a rest parameter
or parameter with a default value. This will be the function's length.

  • bytecode/UnlinkedCodeBlock.h:
  • bytecode/UnlinkedFunctionExecutable.cpp:

(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):

  • bytecode/UnlinkedFunctionExecutable.h:
  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createFunctionMetadata):

  • parser/Nodes.cpp:

(JSC::FunctionMetadataNode::FunctionMetadataNode):

  • parser/Nodes.h:
  • parser/Parser.cpp:

(JSC::Parser<LexerType>::isArrowFunctionParameters):
(JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
(JSC::Parser<LexerType>::parseFormalParameters):
(JSC::Parser<LexerType>::parseFunctionBody):
(JSC::Parser<LexerType>::parseFunctionParameters):
(JSC::Parser<LexerType>::parseFunctionInfo):

  • parser/Parser.h:
  • parser/ParserFunctionInfo.h:
  • parser/SourceProviderCacheItem.h:

(JSC::SourceProviderCacheItem::SourceProviderCacheItem):

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::createFunctionMetadata):

  • runtime/Executable.h:
  • runtime/JSFunction.cpp:

(JSC::JSFunction::createBuiltinFunction):
(JSC::JSFunction::reifyLength):

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r206171 r206268  
     12016-09-22  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        test262: Function length should be number of parameters before parameters with default values
     4        https://bugs.webkit.org/show_bug.cgi?id=162377
     5
     6        Reviewed by Saam Barati.
     7
     8        * stress/es6-default-parameters.js:
     9        Add our own tests for function lengths with default parameters.
     10
     11        * test262.yaml:
     12        We now pass all dflt-length tests.
     13
    1142016-09-20  Benjamin Poulain  <bpoulain@apple.com>
    215
  • trunk/JSTests/stress/es6-default-parameters.js

    r205969 r206268  
    221221    }
    222222})();
     223
     224// Length
     225
     226function named1(a){};
     227function named2(a=1){};
     228function named3(a,b){};
     229function named4(a,b=1){};
     230function named5(a=1,b=1){};
     231function named6(a,b,c){};
     232function named7(a=1,b,c){};
     233function named8(a,b=1,c){};
     234function named9(a,b,c=1){};
     235function named10(a,...b){};
     236function named11(a=1,...b){};
     237function named12(a=10,b,c=20,...r){};
     238
     239assert( named1.length === 1 );
     240assert( named2.length === 0 );
     241assert( named3.length === 2 );
     242assert( named4.length === 1 );
     243assert( named5.length === 0 );
     244assert( named6.length === 3 );
     245assert( named7.length === 0 );
     246assert( named8.length === 1 );
     247assert( named9.length === 2 );
     248assert( named10.length === 1 );
     249assert( named11.length === 0 );
     250assert( named12.length === 0 );
     251
     252assert( (function(a){}).length === 1 );
     253assert( (function(a=1){}).length === 0 );
     254assert( (function(a,b){}).length === 2 );
     255assert( (function(a,b=1){}).length === 1 );
     256assert( (function(a=1,b=1){}).length === 0 );
     257assert( (function(a,b,c){}).length === 3 );
     258assert( (function(a=1,b,c){}).length === 0 );
     259assert( (function(a,b=1,c){}).length === 1 );
     260assert( (function(a,b,c=1){}).length === 2 );
     261assert( (function(a,...b){}).length === 1 );
     262assert( (function(a=1,...b){}).length === 0 );
     263assert( (function(a=10,b,c=20,...r){}).length === 0 );
     264
     265assert( (function*(a){}).length === 1 );
     266assert( (function*(a=1){}).length === 0 );
     267assert( (function*(a,b){}).length === 2 );
     268assert( (function*(a,b=1){}).length === 1 );
     269assert( (function*(a=1,b=1){}).length === 0 );
     270assert( (function*(a,b,c){}).length === 3 );
     271assert( (function*(a=1,b,c){}).length === 0 );
     272assert( (function*(a,b=1,c){}).length === 1 );
     273assert( (function*(a,b,c=1){}).length === 2 );
     274assert( (function*(a,...b){}).length === 1 );
     275assert( (function*(a=1,...b){}).length === 0 );
     276assert( (function*(a=10,b,c=20,...r){}).length === 0 );
     277
     278assert( ((a)=>{}).length === 1 );
     279assert( ((a=1)=>{}).length === 0 );
     280assert( ((a,b)=>{}).length === 2 );
     281assert( ((a,b=1)=>{}).length === 1 );
     282assert( ((a=1,b=1)=>{}).length === 0 );
     283assert( ((a,b,c)=>{}).length === 3 );
     284assert( ((a=1,b,c)=>{}).length === 0 );
     285assert( ((a,b=1,c)=>{}).length === 1 );
     286assert( ((a,b,c=1)=>{}).length === 2 );
     287assert( ((a,...b)=>{}).length === 1 );
     288assert( ((a=1,...b)=>{}).length === 0 );
     289assert( ((a=10,b,c=20,...r)=>{}).length === 0 );
     290
     291assert( Object.getOwnPropertyDescriptor({set setter(a){}}, "setter").set.length === 1 );
     292assert( Object.getOwnPropertyDescriptor({set setter(a=1){}}, "setter").set.length === 0 );
     293
     294assert( ({method(a){}}).method.length === 1 );
     295assert( ({method(a=1){}}).method.length === 0 );
     296assert( ({method(a,b){}}).method.length === 2 );
     297assert( ({method(a,b=1){}}).method.length === 1 );
     298assert( ({method(a=1,b=1){}}).method.length === 0 );
     299assert( ({method(a,b,c){}}).method.length === 3 );
     300assert( ({method(a=1,b,c){}}).method.length === 0 );
     301assert( ({method(a,b=1,c){}}).method.length === 1 );
     302assert( ({method(a,b,c=1){}}).method.length === 2 );
     303assert( ({method(a,...b){}}).method.length === 1 );
     304assert( ({method(a=1,...b){}}).method.length === 0 );
     305assert( ({method(a=10,b,c=20,...r){}}).method.length === 0 );
     306
     307assert( ({*method(a){}}).method.length === 1 );
     308assert( ({*method(a=1){}}).method.length === 0 );
     309assert( ({*method(a,b){}}).method.length === 2 );
     310assert( ({*method(a,b=1){}}).method.length === 1 );
     311assert( ({*method(a=1,b=1){}}).method.length === 0 );
     312assert( ({*method(a,b,c){}}).method.length === 3 );
     313assert( ({*method(a=1,b,c){}}).method.length === 0 );
     314assert( ({*method(a,b=1,c){}}).method.length === 1 );
     315assert( ({*method(a,b,c=1){}}).method.length === 2 );
     316assert( ({*method(a,...b){}}).method.length === 1 );
     317assert( ({*method(a=1,...b){}}).method.length === 0 );
     318assert( ({*method(a=10,b,c=20,...r){}}).method.length === 0 );
     319
     320assert( (class {static method(a){}}).method.length === 1 );
     321assert( (class {static method(a=1){}}).method.length === 0 );
     322assert( (class {static method(a,b){}}).method.length === 2 );
     323assert( (class {static method(a,b=1){}}).method.length === 1 );
     324assert( (class {static method(a=1,b=1){}}).method.length === 0 );
     325assert( (class {static method(a,b,c){}}).method.length === 3 );
     326assert( (class {static method(a=1,b,c){}}).method.length === 0 );
     327assert( (class {static method(a,b=1,c){}}).method.length === 1 );
     328assert( (class {static method(a,b,c=1){}}).method.length === 2 );
     329assert( (class {static method(a,...b){}}).method.length === 1 );
     330assert( (class {static method(a=1,...b){}}).method.length === 0 );
     331assert( (class {static method(a=10,b,c=20,...r){}}).method.length === 0 );
    223332
    224333// TDZ errors.
  • trunk/JSTests/test262.yaml

    r206064 r206268  
    5400154001  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    5400254002- path: test262/test/language/expressions/arrow-function/length-dflt.js
    54003   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     54003  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    5400454004- path: test262/test/language/expressions/arrow-function/length-dflt.js
    54005   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     54005  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    5400654006- path: test262/test/language/expressions/arrow-function/lexical-arguments.js
    5400754007  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    5885358853  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    5885458854- path: test262/test/language/expressions/class/gen-method-length-dflt.js
    58855   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     58855  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    5885658856- path: test262/test/language/expressions/class/gen-method-length-dflt.js
    58857   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     58857  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    5885858858- path: test262/test/language/expressions/class/gen-method-param-dflt-yield.js
    5885958859  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    5886558865  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    5886658866- path: test262/test/language/expressions/class/method-length-dflt.js
    58867   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     58867  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    5886858868- path: test262/test/language/expressions/class/method-length-dflt.js
    58869   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     58869  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    5887058870- path: test262/test/language/expressions/class/method-param-dflt-yield.js
    5887158871  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    5910159101  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    5910259102- path: test262/test/language/expressions/class/setter-length-dflt.js
    59103   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     59103  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    5910459104- path: test262/test/language/expressions/class/setter-length-dflt.js
    59105   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     59105  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    5910659106- path: test262/test/language/expressions/class/static-gen-method-param-dflt-yield.js
    5910759107  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    5910959109  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    5911059110- path: test262/test/language/expressions/class/static-method-length-dflt.js
    59111   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     59111  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    5911259112- path: test262/test/language/expressions/class/static-method-length-dflt.js
    59113   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     59113  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    5911459114- path: test262/test/language/expressions/class/static-method-param-dflt-yield.js
    5911559115  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    6214962149  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    6215062150- path: test262/test/language/expressions/function/length-dflt.js
    62151   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     62151  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    6215262152- path: test262/test/language/expressions/function/length-dflt.js
    62153   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     62153  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    6215462154- path: test262/test/language/expressions/function/name.js
    6215562155  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     
    6295962959  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    6296062960- path: test262/test/language/expressions/generators/length-dflt.js
    62961   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     62961  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    6296262962- path: test262/test/language/expressions/generators/length-dflt.js
    62963   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     62963  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    6296462964- path: test262/test/language/expressions/generators/length-property-descriptor.js
    6296562965  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     
    6647566475  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
    6647666476- path: test262/test/language/expressions/object/method-definition/generator-length-dflt.js
    66477   cmd: runTest262 :fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], []
     66477  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], []
    6647866478- path: test262/test/language/expressions/object/method-definition/generator-length-dflt.js
    66479   cmd: runTest262 :fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], [:strict]
     66479  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], [:strict]
    6648066480- path: test262/test/language/expressions/object/method-definition/generator-length.js
    6648166481  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], []
     
    6656366563  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
    6656466564- path: test262/test/language/expressions/object/method-definition/name-length-dflt.js
    66565   cmd: runTest262 :fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], []
     66565  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], []
    6656666566- path: test262/test/language/expressions/object/method-definition/name-length-dflt.js
    66567   cmd: runTest262 :fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], [:strict]
     66567  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], [:strict]
    6656866568- path: test262/test/language/expressions/object/method-definition/name-length.js
    6656966569  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/propertyHelper.js"], []
     
    6687766877  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    6687866878- path: test262/test/language/expressions/object/setter-length-dflt.js
    66879   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     66879  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    6688066880- path: test262/test/language/expressions/object/setter-length-dflt.js
    66881   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     66881  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    6688266882- path: test262/test/language/expressions/object/setter-prop-desc.js
    6688366883  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     
    7612376123  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    7612476124- path: test262/test/language/statements/class/gen-method-length-dflt.js
    76125   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     76125  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    7612676126- path: test262/test/language/statements/class/gen-method-length-dflt.js
    76127   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     76127  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    7612876128- path: test262/test/language/statements/class/gen-method-param-dflt-yield.js
    7612976129  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    7613576135  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    7613676136- path: test262/test/language/statements/class/method-length-dflt.js
    76137   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     76137  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    7613876138- path: test262/test/language/statements/class/method-length-dflt.js
    76139   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     76139  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    7614076140- path: test262/test/language/statements/class/method-param-yield.js
    7614176141  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    7639576395  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    7639676396- path: test262/test/language/statements/class/setter-length-dflt.js
    76397   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     76397  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    7639876398- path: test262/test/language/statements/class/setter-length-dflt.js
    76399   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     76399  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    7640076400- path: test262/test/language/statements/class/static-gen-method-param-dflt-yield.js
    7640176401  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    7640776407  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    7640876408- path: test262/test/language/statements/class/static-method-length-dflt.js
    76409   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     76409  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    7641076410- path: test262/test/language/statements/class/static-method-length-dflt.js
    76411   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     76411  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    7641276412- path: test262/test/language/statements/class/static-method-non-configurable-err.js
    7641376413  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    8332583325  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    8332683326- path: test262/test/language/statements/function/length-dflt.js
    83327   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     83327  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    8332883328- path: test262/test/language/statements/function/length-dflt.js
    83329   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     83329  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    8333083330- path: test262/test/language/statements/function/name.js
    8333183331  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     
    8412784127  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    8412884128- path: test262/test/language/statements/generators/length-dflt.js
    84129   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
     84129  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
    8413084130- path: test262/test/language/statements/generators/length-dflt.js
    84131   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
     84131  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
    8413284132- path: test262/test/language/statements/generators/length-property-descriptor.js
    8413384133  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
  • trunk/Source/JavaScriptCore/ChangeLog

    r206267 r206268  
     12016-09-22  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        test262: Function length should be number of parameters before parameters with default values
     4        https://bugs.webkit.org/show_bug.cgi?id=162377
     5
     6        Reviewed by Saam Barati.
     7
     8        https://tc39.github.io/ecma262/#sec-function-definitions-static-semantics-expectedargumentcount
     9
     10        > NOTE: The ExpectedArgumentCount of a FormalParameterList is the number of
     11        > FormalParameters to the left of either the rest parameter or the first
     12        > FormalParameter with an Initializer. A FormalParameter without an
     13        > initializer is allowed after the first parameter with an initializer
     14        > but such parameters are considered to be optional with undefined as
     15        > their default value.
     16
     17        Alongside the parameterCount value, maintain a separate count,
     18        functionLength, which will be the count before seeing a rest parameter
     19        or parameter with a default value. This will be the function's length.
     20
     21        * bytecode/UnlinkedCodeBlock.h:
     22        * bytecode/UnlinkedFunctionExecutable.cpp:
     23        (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
     24        * bytecode/UnlinkedFunctionExecutable.h:
     25        * parser/ASTBuilder.h:
     26        (JSC::ASTBuilder::createFunctionMetadata):
     27        * parser/Nodes.cpp:
     28        (JSC::FunctionMetadataNode::FunctionMetadataNode):
     29        * parser/Nodes.h:
     30        * parser/Parser.cpp:
     31        (JSC::Parser<LexerType>::isArrowFunctionParameters):
     32        (JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
     33        (JSC::Parser<LexerType>::parseFormalParameters):
     34        (JSC::Parser<LexerType>::parseFunctionBody):
     35        (JSC::Parser<LexerType>::parseFunctionParameters):
     36        (JSC::Parser<LexerType>::parseFunctionInfo):
     37        * parser/Parser.h:
     38        * parser/ParserFunctionInfo.h:
     39        * parser/SourceProviderCacheItem.h:
     40        (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
     41        * parser/SyntaxChecker.h:
     42        (JSC::SyntaxChecker::createFunctionMetadata):
     43        * runtime/Executable.h:
     44        * runtime/JSFunction.cpp:
     45        (JSC::JSFunction::createBuiltinFunction):
     46        (JSC::JSFunction::reifyLength):
     47
    1482016-09-22  Joseph Pecoraro  <pecoraro@apple.com>
    249
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r206267 r206268  
    4848class BytecodeRewriter;
    4949class Debugger;
    50 class FunctionMetadataNode;
    5150class FunctionExecutable;
    5251class ParserError;
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp

    r204714 r206268  
    8989    , m_typeProfilingEndOffset(node->startStartOffset() + node->source().length() - 1)
    9090    , m_parameterCount(node->parameterCount())
     91    , m_functionLength(node->functionLength())
    9192    , m_features(0)
    9293    , m_isInStrictContext(node->isInStrictContext())
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h

    r204714 r206268  
    7878    const Identifier& inferredName() const { return m_inferredName; }
    7979    unsigned parameterCount() const { return m_parameterCount; };
     80    unsigned functionLength() const { return m_functionLength; }
    8081    SourceParseMode parseMode() const { return static_cast<SourceParseMode>(m_sourceParseMode); };
    8182
     
    155156    unsigned m_typeProfilingEndOffset;
    156157    unsigned m_parameterCount;
     158    unsigned m_functionLength;
    157159    CodeFeatures m_features;
    158160    unsigned m_isInStrictContext : 1;
  • trunk/Source/JavaScriptCore/parser/ASTBuilder.h

    r204078 r206268  
    395395        unsigned startColumn, unsigned endColumn, int functionKeywordStart,
    396396        int functionNameStart, int parametersStart, bool inStrictContext,
    397         ConstructorKind constructorKind, SuperBinding superBinding, unsigned parameterCount, SourceParseMode mode, bool isArrowFunctionBodyExpression)
     397        ConstructorKind constructorKind, SuperBinding superBinding,
     398        unsigned parameterCount, unsigned functionLength,
     399        SourceParseMode mode, bool isArrowFunctionBodyExpression)
    398400    {
    399401        return new (m_parserArena) FunctionMetadataNode(
    400402            m_parserArena, startLocation, endLocation, startColumn, endColumn,
    401403            functionKeywordStart, functionNameStart, parametersStart,
    402             inStrictContext, constructorKind, superBinding, parameterCount, mode, isArrowFunctionBodyExpression);
     404            inStrictContext, constructorKind, superBinding,
     405            parameterCount, functionLength, mode, isArrowFunctionBodyExpression);
    403406    }
    404407
  • trunk/Source/JavaScriptCore/parser/Nodes.cpp

    r204470 r206268  
    136136    const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn,
    137137    int functionKeywordStart, int functionNameStart, int parametersStart, bool isInStrictContext,
    138     ConstructorKind constructorKind, SuperBinding superBinding, unsigned parameterCount, SourceParseMode mode, bool isArrowFunctionBodyExpression)
     138    ConstructorKind constructorKind, SuperBinding superBinding, unsigned parameterCount, unsigned functionLength, SourceParseMode mode, bool isArrowFunctionBodyExpression)
    139139        : Node(endLocation)
    140140        , m_startColumn(startColumn)
     
    145145        , m_startStartOffset(startLocation.startOffset)
    146146        , m_parameterCount(parameterCount)
     147        , m_functionLength(functionLength)
    147148        , m_parseMode(mode)
    148149        , m_isInStrictContext(isInStrictContext)
  • trunk/Source/JavaScriptCore/parser/Nodes.h

    r206267 r206268  
    18601860            unsigned startColumn, unsigned endColumn, int functionKeywordStart,
    18611861            int functionNameStart, int parametersStart, bool isInStrictContext,
    1862             ConstructorKind, SuperBinding, unsigned, SourceParseMode, bool isArrowFunctionBodyExpression);
     1862            ConstructorKind, SuperBinding, unsigned parameterCount, unsigned functionLength,
     1863            SourceParseMode, bool isArrowFunctionBodyExpression);
    18631864
    18641865        void finishParsing(const SourceCode&, const Identifier&, FunctionMode);
     
    18791880        unsigned endColumn() const { return m_endColumn; }
    18801881        unsigned parameterCount() const { return m_parameterCount; }
     1882        unsigned functionLength() const { return m_functionLength; }
    18811883        SourceParseMode parseMode() const { return m_parseMode; }
    18821884
     
    19151917        int m_startStartOffset;
    19161918        unsigned m_parameterCount;
     1919        unsigned m_functionLength;
    19171920        int m_lastLine;
    19181921        SourceParseMode m_parseMode;
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r206267 r206268  
    379379
    380380            unsigned parametersCount = 0;
    381             isArrowFunction = parseFormalParameters(syntaxChecker, syntaxChecker.createFormalParameterList(), parametersCount) && consume(CLOSEPAREN) && match(ARROWFUNCTION);
     381            unsigned functionLength = 0;
     382            isArrowFunction = parseFormalParameters(syntaxChecker, syntaxChecker.createFormalParameterList(), parametersCount, functionLength) && consume(CLOSEPAREN) && match(ARROWFUNCTION);
    382383               
    383384            popScope(fakeScope, syntaxChecker.NeedsFreeVariableInfo);
     
    526527        popScope(generatorBodyScope, TreeBuilder::NeedsFreeVariableInfo);
    527528    }
    528     info.body = context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, tokenColumn(), functionKeywordStart, functionNameStart, parametersStart, strictMode(), ConstructorKind::None, m_superBinding, info.parameterCount, SourceParseMode::GeneratorBodyMode, false);
     529    info.body = context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, tokenColumn(), functionKeywordStart, functionNameStart, parametersStart, strictMode(), ConstructorKind::None, m_superBinding, info.parameterCount, info.functionLength, SourceParseMode::GeneratorBodyMode, false);
    529530
    530531    info.endLine = tokenLine();
     
    17441745
    17451746template <typename LexerType>
    1746 template <class TreeBuilder> bool Parser<LexerType>::parseFormalParameters(TreeBuilder& context, TreeFormalParameterList list, unsigned& parameterCount)
     1747template <class TreeBuilder> bool Parser<LexerType>::parseFormalParameters(TreeBuilder& context, TreeFormalParameterList list, unsigned& parameterCount, unsigned& functionLength)
    17471748{
    17481749#define failIfDuplicateIfViolation() \
     
    17841785            currentScope()->setHasNonSimpleParameterList();
    17851786        context.appendParameter(list, parameter, defaultValue);
    1786         if (!isRestParameter)
     1787        if (!isRestParameter) {
    17871788            parameterCount++;
     1789            if (!hasDefaultParameterValues)
     1790                functionLength++;
     1791        }
    17881792    } while (!isRestParameter && consume(COMMA));
    17891793
     
    17941798template <typename LexerType>
    17951799template <class TreeBuilder> TreeFunctionBody Parser<LexerType>::parseFunctionBody(
    1796     TreeBuilder& context, SyntaxChecker& syntaxChecker, const JSTokenLocation& startLocation, int startColumn, int functionKeywordStart, int functionNameStart, int parametersStart, 
    1797     ConstructorKind constructorKind, SuperBinding superBinding, FunctionBodyType bodyType, unsigned parameterCount, SourceParseMode parseMode)
     1800    TreeBuilder& context, SyntaxChecker& syntaxChecker, const JSTokenLocation& startLocation, int startColumn, int functionKeywordStart, int functionNameStart, int parametersStart,
     1801    ConstructorKind constructorKind, SuperBinding superBinding, FunctionBodyType bodyType, unsigned parameterCount, unsigned functionLength, SourceParseMode parseMode)
    17981802{
    17991803    bool isArrowFunctionBodyExpression = bodyType == ArrowFunctionBodyExpression;
     
    18021806        if (match(CLOSEBRACE)) {
    18031807            unsigned endColumn = tokenColumn();
    1804             return context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind, superBinding, parameterCount, parseMode, isArrowFunctionBodyExpression);
     1808            return context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind, superBinding, parameterCount, functionLength, parseMode, isArrowFunctionBodyExpression);
    18051809        }
    18061810    }
     
    18131817        failIfFalse(parseSourceElements(syntaxChecker, CheckForStrictMode), bodyType == StandardFunctionBodyBlock ? "Cannot parse body of this function" : "Cannot parse body of this arrow function");
    18141818    unsigned endColumn = tokenColumn();
    1815     return context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind, superBinding, parameterCount, parseMode, isArrowFunctionBodyExpression);
     1819    return context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind, superBinding, parameterCount, functionLength, parseMode, isArrowFunctionBodyExpression);
    18161820}
    18171821
     
    18571861                next();
    18581862               
    1859                 if (match(CLOSEPAREN))
     1863                if (match(CLOSEPAREN)) {
    18601864                    functionInfo.parameterCount = 0;
    1861                 else
    1862                     failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount), "Cannot parse parameters for this ", stringForFunctionMode(mode));
     1865                    functionInfo.functionLength = 0;
     1866                } else
     1867                    failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount, functionInfo.functionLength), "Cannot parse parameters for this ", stringForFunctionMode(mode));
    18631868               
    18641869                consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration");
    18651870            } else {
    18661871                functionInfo.parameterCount = 1;
     1872                functionInfo.functionLength = 1;
    18671873                auto parameter = parseDestructuringPattern(context, DestructuringKind::DestructureToParameters, ExportType::NotExported);
    18681874                failIfFalse(parameter, "Cannot parse parameter pattern");
     
    18821888        consumeOrFail(CLOSEPAREN, "getter functions must have no parameters");
    18831889        functionInfo.parameterCount = 0;
     1890        functionInfo.functionLength = 0;
    18841891    } else if (mode == SourceParseMode::SetterMode) {
    18851892        failIfTrue(match(CLOSEPAREN), "setter functions must have one parameter");
     
    18921899        context.appendParameter(parameterList, parameter, defaultValue);
    18931900        functionInfo.parameterCount = 1;
     1901        functionInfo.functionLength = defaultValue ? 0 : 1;
    18941902        failIfTrue(match(COMMA), "setter functions must have one parameter");
    18951903        consumeOrFail(CLOSEPAREN, "Expected a ')' after a parameter declaration");
    18961904    } else {
    1897         if (match(CLOSEPAREN))
     1905        if (match(CLOSEPAREN)) {
    18981906            functionInfo.parameterCount = 0;
    1899         else
    1900             failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount), "Cannot parse parameters for this ", stringForFunctionMode(mode));
     1907            functionInfo.functionLength = 0;
     1908        } else
     1909            failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount, functionInfo.functionLength), "Cannot parse parameters for this ", stringForFunctionMode(mode));
    19011910        consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration");
    19021911    }
     
    19912000                startLocation, endLocation, startColumn, bodyEndColumn,
    19922001                functionKeywordStart, functionNameStart, parametersStart,
    1993                 cachedInfo->strictMode, constructorKind, expectedSuperBinding, cachedInfo->parameterCount, mode, functionBodyType == ArrowFunctionBodyExpression);
     2002                cachedInfo->strictMode, constructorKind, expectedSuperBinding,
     2003                cachedInfo->parameterCount, cachedInfo->functionLength,
     2004                mode, functionBodyType == ArrowFunctionBodyExpression);
    19942005            functionInfo.endOffset = cachedInfo->endFunctionOffset;
    19952006            functionInfo.parameterCount = cachedInfo->parameterCount;
     2007            functionInfo.functionLength = cachedInfo->functionLength;
    19962008
    19972009            functionScope->restoreFromSourceProviderCache(cachedInfo);
     
    21502162
    21512163    auto performParsingFunctionBody = [&] {
    2152         return parseFunctionBody(context, syntaxChecker, startLocation, startColumn, functionKeywordStart, functionNameStart, parametersStart, constructorKind, expectedSuperBinding, functionBodyType, functionInfo.parameterCount, mode);
     2164        return parseFunctionBody(context, syntaxChecker, startLocation, startColumn, functionKeywordStart, functionNameStart, parametersStart, constructorKind, expectedSuperBinding, functionBodyType, functionInfo.parameterCount, functionInfo.functionLength, mode);
    21532165    };
    21542166
     
    22032215        parameters.lastTokenLineStartOffset = location.lineStartOffset;
    22042216        parameters.parameterCount = functionInfo.parameterCount;
     2217        parameters.functionLength = functionInfo.functionLength;
    22052218        parameters.constructorKind = constructorKind;
    22062219        parameters.expectedSuperBinding = expectedSuperBinding;
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r206267 r206268  
    2121 */
    2222
    23 #ifndef Parser_h
    24 #define Parser_h
     23#pragma once
    2524
    2625#include "ExceptionHelpers.h"
     
    13981397    template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator);
    13991398    template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind, bool isClassProperty);
    1400     template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, SyntaxChecker&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, SuperBinding, FunctionBodyType, unsigned, SourceParseMode);
    1401     template <class TreeBuilder> ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&, TreeFormalParameterList, unsigned&);
     1399    template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, SyntaxChecker&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, SuperBinding, FunctionBodyType, unsigned, unsigned, SourceParseMode);
     1400    template <class TreeBuilder> ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&, TreeFormalParameterList, unsigned&, unsigned&);
    14021401    enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext };
    14031402    template <class TreeBuilder> TreeExpression parseVariableDeclarationList(TreeBuilder&, int& declarations, TreeDestructuringPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd, VarDeclarationListContext, DeclarationType, ExportType, bool& forLoopConstDoesNotHaveInitializer);
     
    17421741
    17431742} // namespace
    1744 #endif
  • trunk/Source/JavaScriptCore/parser/ParserFunctionInfo.h

    r200038 r206268  
    2424 */
    2525
    26 #ifndef ParserFunctionInfo_h
    27 #define ParserFunctionInfo_h
     26#pragma once
    2827
    2928namespace JSC {
     
    3433    typename TreeBuilder::FunctionBody body = 0;
    3534    unsigned parameterCount = 0;
     35    unsigned functionLength = 0;
    3636    unsigned startOffset = 0;
    3737    unsigned endOffset = 0;
     
    5151
    5252}
    53 
    54 #endif
  • trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h

    r200038 r206268  
    4242    unsigned endFunctionOffset;
    4343    unsigned parameterCount;
     44    unsigned functionLength;
    4445    bool needsFullActivation;
    4546    bool usesEval;
     
    8990    unsigned parameterCount : 31;
    9091    unsigned expectedSuperBinding : 1; // SuperBinding
     92    unsigned functionLength;
    9193    unsigned lastTokenLineStartOffset;
    9294    unsigned usedVariablesCount;
     
    129131    , parameterCount(parameters.parameterCount)
    130132    , expectedSuperBinding(static_cast<unsigned>(parameters.expectedSuperBinding))
     133    , functionLength(parameters.functionLength)
    131134    , lastTokenLineStartOffset(parameters.lastTokenLineStartOffset)
    132135    , usedVariablesCount(parameters.usedVariables.size())
  • trunk/Source/JavaScriptCore/parser/SyntaxChecker.h

    r204078 r206268  
    185185    ClassExpression createClassExpr(const JSTokenLocation&, const ParserClassInfo<SyntaxChecker>&, VariableEnvironment&, ExpressionType, ExpressionType, PropertyList, PropertyList) { return ClassExpr; }
    186186    ExpressionType createFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
    187     int createFunctionMetadata(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind, SuperBinding, unsigned, SourceParseMode, bool, InnerArrowFunctionCodeFeatures = NoInnerArrowFunctionFeatures) { return FunctionBodyResult; }
     187    int createFunctionMetadata(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind, SuperBinding, unsigned, int, SourceParseMode, bool, InnerArrowFunctionCodeFeatures = NoInnerArrowFunctionFeatures) { return FunctionBodyResult; }
    188188    ExpressionType createArrowFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
    189189    ExpressionType createMethodDefinition(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r206267 r206268  
    658658    const Identifier& ecmaName() { return m_unlinkedExecutable->ecmaName(); }
    659659    const Identifier& inferredName() { return m_unlinkedExecutable->inferredName(); }
    660     size_t parameterCount() const { return m_unlinkedExecutable->parameterCount(); } // Excluding 'this'!
     660    unsigned parameterCount() const { return m_unlinkedExecutable->parameterCount(); } // Excluding 'this'!
     661    unsigned functionLength() const { return m_unlinkedExecutable->functionLength(); }
    661662    SourceParseMode parseMode() const { return m_unlinkedExecutable->parseMode(); }
    662663    JSParserCommentMode commentMode() const { return m_unlinkedExecutable->commentMode(); }
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r205856 r206268  
    115115    JSFunction* function = create(vm, executable, globalObject);
    116116    function->putDirect(vm, vm.propertyNames->name, jsString(&vm, executable->name().string()), ReadOnly | DontEnum);
    117     function->putDirect(vm, vm.propertyNames->length, jsNumber(executable->parameterCount()), ReadOnly | DontEnum);
     117    function->putDirect(vm, vm.propertyNames->length, jsNumber(executable->functionLength()), ReadOnly | DontEnum);
    118118    return function;
    119119}
     
    123123    JSFunction* function = create(vm, executable, globalObject);
    124124    function->putDirect(vm, vm.propertyNames->name, jsString(&vm, name), ReadOnly | DontEnum);
    125     function->putDirect(vm, vm.propertyNames->length, jsNumber(executable->parameterCount()), ReadOnly | DontEnum);
     125    function->putDirect(vm, vm.propertyNames->length, jsNumber(executable->functionLength()), ReadOnly | DontEnum);
    126126    return function;
    127127}
     
    628628    ASSERT(!hasReifiedLength());
    629629    ASSERT(!isHostFunction());
    630     JSValue initialValue = jsNumber(jsExecutable()->parameterCount());
     630    JSValue initialValue = jsNumber(jsExecutable()->functionLength());
    631631    unsigned initialAttributes = DontEnum | ReadOnly;
    632632    const Identifier& identifier = vm.propertyNames->length;
Note: See TracChangeset for help on using the changeset viewer.