Bug 1552316 - Disconnect initWithEnclosingScope from functionbox r=tcampbell
authorMatthew Gaudet <mgaudet@mozilla.com>
Tue, 21 May 2019 13:47:50 +0000
changeset 474749 86e4c72840f20e7b524c001ef6b960f0bf9410ac
parent 474748 80dfbfe943a1942b7697eaee338e7723d4a5ebfe
child 474750 ae7096d1add7bc70cd996485b423a18fe287a4e3
push id36046
push useraiakab@mozilla.com
push dateTue, 21 May 2019 21:45:52 +0000
treeherdermozilla-central@257f2c96cef5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1552316
milestone69.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 1552316 - Disconnect initWithEnclosingScope from functionbox r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D31537
js/src/frontend/SharedContext.cpp
js/src/frontend/SharedContext.h
--- a/js/src/frontend/SharedContext.cpp
+++ b/js/src/frontend/SharedContext.cpp
@@ -178,17 +178,17 @@ void FunctionBox::initFromLazyFunction(J
   if (fun->lazyScript()->needsHomeObject()) {
     setNeedsHomeObject();
   }
   if (fun->lazyScript()->hasEnclosingScope()) {
     enclosingScope_ = fun->lazyScript()->enclosingScope();
   } else {
     enclosingScope_ = nullptr;
   }
-  initWithEnclosingScope(enclosingScope_);
+  initWithEnclosingScope(enclosingScope_, fun);
 }
 
 void FunctionBox::initStandaloneFunction(Scope* enclosingScope) {
   // Standalone functions are Function or Generator constructors and are
   // always scoped to the global.
   MOZ_ASSERT(enclosingScope->is<GlobalScope>());
   enclosingScope_ = enclosingScope;
   allowNewTarget_ = true;
@@ -244,20 +244,21 @@ void FunctionBox::initFieldInitializer(P
   this->initWithEnclosingParseContext(enclosing, fun,
                                       FunctionSyntaxKind::Expression);
   allowSuperProperty_ = false;
   allowSuperCall_ = false;
   allowArguments_ = false;
   needsThisTDZChecks_ = hasHeritage == HasHeritage::Yes;
 }
 
-void FunctionBox::initWithEnclosingScope(Scope* enclosingScope) {
+void FunctionBox::initWithEnclosingScope(Scope* enclosingScope,
+                                         JSFunction* fun) {
   if (!isArrow()) {
     allowNewTarget_ = true;
-    allowSuperProperty_ = function()->allowSuperProperty();
+    allowSuperProperty_ = fun->allowSuperProperty();
 
     if (isDerivedClassConstructor()) {
       setDerivedClassConstructor();
       allowSuperCall_ = true;
       needsThisTDZChecks_ = true;
     }
 
     thisBinding_ = ThisBinding::Function;
--- a/js/src/frontend/SharedContext.h
+++ b/js/src/frontend/SharedContext.h
@@ -299,17 +299,17 @@ class FunctionBox : public ObjectBox, pu
 
   // Names from the function scope.
   FunctionScope::Data* functionScopeBindings_;
 
   // Names from the extra 'var' scope of the function, if the parameter list
   // has expressions.
   VarScope::Data* extraVarScopeBindings_;
 
-  void initWithEnclosingScope(Scope* enclosingScope);
+  void initWithEnclosingScope(Scope* enclosingScope, JSFunction* fun);
 
  public:
   // Back pointer used by asm.js for error messages.
   FunctionNode* functionNode;
 
   uint32_t bufStart;
   uint32_t bufEnd;
   uint32_t startLine;