V8's compilers compile functions. When you execute the string "1", it's
first turned into a function. You can read the dumped AST to see what it
does: assignment of literal 1 to a temporary variable named ".result",
which is then returned. In other words: { var .result = 1; return .result;
}.On Thu, Aug 18, 2016 at 9:37 AM, Dmitriy - <[email protected]> wrote: > Hello, I run > ./d8 with --print_ast key > and when type something (for example "1" or "print(1 + 2)") > First of all d8 print this ast: > > [generating full code for user-defined function: ] > --- AST --- > FUNC at 0 > . NAME "" > . INFERRED NAME "" > . EXPRESSION STATEMENT at 0 > . . ASSIGN at -1 > . . . VAR PROXY local[0] (mode = TEMPORARY) ".result" > . . . LITERAL 1 > . RETURN at -1 > . . VAR PROXY local[0] (mode = TEMPORARY) ".result" > > This function doesn't have a name and I don't know what it does. > > What are purposes of this function? > > -- > -- > v8-dev mailing list > [email protected] > http://groups.google.com/group/v8-dev > --- > You received this message because you are subscribed to the Google Groups > "v8-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
