Bug 1456765 - [BinAST] Properly compute Function.length. (r=Yoric)
authorEric Faust <efaustbmo@gmail.com>
Mon, 30 Apr 2018 23:55:36 -0700
changeset 472561 788d134870102c3333a4564db7eef0d4ea8c52ba
parent 472560 b7662a1cd8cbf0ea1bb49231a8c35d6fcb0a24b3
child 472562 a4096171bfdbea9956e8afd4d74ac0b7c89506b1
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1456765
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1456765 - [BinAST] Properly compute Function.length. (r=Yoric)
js/src/frontend/BinSource-auto.cpp
js/src/frontend/BinSource.yaml
--- a/js/src/frontend/BinSource-auto.cpp
+++ b/js/src/frontend/BinSource-auto.cpp
@@ -2173,16 +2173,18 @@ BinASTParser<Tok>::parseSumParameter(con
     switch(kind) {
       case BinKind::ArrayBinding:
         MOZ_TRY_VAR(result, parseInterfaceArrayBinding(start, kind, fields));
 
         break;
       case BinKind::BindingIdentifier:
         MOZ_TRY_VAR(result, parseInterfaceBindingIdentifier(start, kind, fields));
         BINJS_TRY(parseContext_->positionalFormalParameterNames().append(result->pn_atom));
+        if (parseContext_->isFunctionBox())
+            parseContext_->functionBox()->length++;
         break;
       case BinKind::BindingWithInitializer:
         MOZ_TRY_VAR(result, parseInterfaceBindingWithInitializer(start, kind, fields));
 
         break;
       case BinKind::ObjectBinding:
         MOZ_TRY_VAR(result, parseInterfaceObjectBinding(start, kind, fields));
 
--- a/js/src/frontend/BinSource.yaml
+++ b/js/src/frontend/BinSource.yaml
@@ -835,18 +835,20 @@ OptionalAssertedVarScope:
 
 OptionalAssertedParameterScope:
     type-ok:
         Ok
 
 Parameter:
     sum-arms:
         BindingIdentifier:
-            after:
+            after: |
                 BINJS_TRY(parseContext_->positionalFormalParameterNames().append(result->pn_atom));
+                if (parseContext_->isFunctionBox())
+                    parseContext_->functionBox()->length++;
 
 ReturnStatement:
     init: |
         if (!parseContext_->isFunctionBox()) {
             // Return statements are permitted only inside functions.
             return raiseInvalidKind("Toplevel Statement", kind);
         }