Skip to content

Instantly share code, notes, and snippets.

@mgaudet
Created May 24, 2019 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgaudet/f7ec9bd753731adf0235e8ff7e427471 to your computer and use it in GitHub Desktop.
Save mgaudet/f7ec9bd753731adf0235e8ff7e427471 to your computer and use it in GitHub Desktop.
Where are Functions allocated before the function boxes

FunctionNode* Parser<FullParseHandler, Unit>::standaloneFunction

  • Has a Function argument, Called from
  • FunctionNode* frontend::StandaloneFunctionCompiler<Unit>::parse which has a function argument, called from
  • static bool CompileStandaloneFunction which has a function argument. Called from
    • bool frontend::CompileStandaloneGenerator
    • bool frontend::CompileStandaloneAsyncFunction
    • bool frontend::CompileStandaloneAsyncGenerator
      • All of the above CompileStandAlones, plus the below CompileStandAloneFunction are called from CreateDynamicFunction: the function is allocated there. The above three are -only- called from CreateDynamicFunction.
    • bool frontend::CompileStandaloneFunction which has a function argument. Called from
      • JSFunction* FunctionCompiler::finish which allocates the function
      • CompileStandAloneFunction is called from HandleInstantiationFailure, which allocates a JSFunction for when AsmJS compilation fails for some reason.

bool Parser<FullParseHandler, Unit>::skipLazyInnerFunction

  • Function comes from RootedFunction fun(cx_, handler_.nextLazyInnerFunction()); I can't quite figure out how this works (how do you get the 'right' lazyInnerFunction, does it matter?) -- is this infix related.

bool Parser<FullParseHandler, Unit>::trySyntaxParseInnerFunction

  • Has a function argument, called from
  • GeneralParser<ParseHandler, Unit>::functionDefinition which allocates the function

GeneralParser<ParseHandler, Unit>::innerFunction

  • Has function argument, called from
    • bool Parser<FullParseHandler, Unit>::trySyntaxParseInnerFunction, has function argument. Called from: See above (GeneralParser<>::functionDefinition)
      • An aside: This happens if we fail to do a syntax parse.
    • bool Parser<SyntaxParseHandler, Unit>::trySyntaxParseInnerFunction, has function argument, called from: see above (GeneralParser<>::functionDefinition)

Parser<FullParseHandler, Unit>::standaloneLazyFunction

  • Has function argument called from
  • static bool CompileLazyFunctionImpl. Uses Rooted<JSFunction*> fun(cx, lazy->functionNonDelazifying()); as the function
    • Not sure how that works

GeneralParser<ParseHandler, Unit>::synthesizeConstructor

  • allocates a new function directly

GeneralParser<ParseHandler, Unit>::fieldInitializerOpt(

  • Allocates a new function directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment