v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
ast.h
Go to the documentation of this file.
1// Copyright 2012 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_AST_AST_H_
6#define V8_AST_AST_H_
7
8#include <memory>
9
11#include "src/ast/modules.h"
12#include "src/ast/variables.h"
17#include "src/codegen/label.h"
18#include "src/common/globals.h"
19#include "src/heap/factory.h"
24#include "src/objects/smi.h"
25#include "src/parsing/token.h"
26#include "src/runtime/runtime.h"
27#include "src/zone/zone-list.h"
28
29namespace v8 {
30namespace internal {
31
32// The abstract syntax tree is an intermediate, light-weight
33// representation of the parsed JavaScript code suitable for
34// compilation to native code.
35
36// Nodes are allocated in a separate zone, which allows faster
37// allocation and constant-time deallocation of the entire syntax
38// tree.
39
40
41// ----------------------------------------------------------------------------
42// Nodes of the abstract syntax tree. Only concrete classes are
43// enumerated here.
44
45#define DECLARATION_NODE_LIST(V) \
46 V(VariableDeclaration) \
47 V(FunctionDeclaration)
48
49#define ITERATION_NODE_LIST(V) \
50 V(DoWhileStatement) \
51 V(WhileStatement) \
52 V(ForStatement) \
53 V(ForInStatement) \
54 V(ForOfStatement)
55
56#define BREAKABLE_NODE_LIST(V) \
57 V(Block) \
58 V(SwitchStatement)
59
60#define STATEMENT_NODE_LIST(V) \
61 ITERATION_NODE_LIST(V) \
62 BREAKABLE_NODE_LIST(V) \
63 V(ExpressionStatement) \
64 V(EmptyStatement) \
65 V(SloppyBlockFunctionStatement) \
66 V(IfStatement) \
67 V(ContinueStatement) \
68 V(BreakStatement) \
69 V(ReturnStatement) \
70 V(WithStatement) \
71 V(TryCatchStatement) \
72 V(TryFinallyStatement) \
73 V(DebuggerStatement) \
74 V(InitializeClassMembersStatement) \
75 V(InitializeClassStaticElementsStatement) \
76 V(AutoAccessorGetterBody) \
77 V(AutoAccessorSetterBody)
78
79#define LITERAL_NODE_LIST(V) \
80 V(RegExpLiteral) \
81 V(ObjectLiteral) \
82 V(ArrayLiteral)
83
84#define EXPRESSION_NODE_LIST(V) \
85 LITERAL_NODE_LIST(V) \
86 V(Assignment) \
87 V(Await) \
88 V(BinaryOperation) \
89 V(NaryOperation) \
90 V(Call) \
91 V(SuperCallForwardArgs) \
92 V(CallNew) \
93 V(CallRuntime) \
94 V(ClassLiteral) \
95 V(CompareOperation) \
96 V(CompoundAssignment) \
97 V(ConditionalChain) \
98 V(Conditional) \
99 V(CountOperation) \
100 V(EmptyParentheses) \
101 V(FunctionLiteral) \
102 V(GetTemplateObject) \
103 V(ImportCallExpression) \
104 V(Literal) \
105 V(NativeFunctionLiteral) \
106 V(OptionalChain) \
107 V(Property) \
108 V(Spread) \
109 V(SuperCallReference) \
110 V(SuperPropertyReference) \
111 V(TemplateLiteral) \
112 V(ThisExpression) \
113 V(Throw) \
114 V(UnaryOperation) \
115 V(VariableProxy) \
116 V(Yield) \
117 V(YieldStar)
118
119#define FAILURE_NODE_LIST(V) V(FailureExpression)
120
121#define AST_NODE_LIST(V) \
122 DECLARATION_NODE_LIST(V) \
123 STATEMENT_NODE_LIST(V) \
124 EXPRESSION_NODE_LIST(V)
125
126// Forward declarations
127class Isolate;
128
129class AstNode;
130class AstNodeFactory;
131class Declaration;
132class BreakableStatement;
133class Expression;
134class IterationStatement;
135class MaterializedLiteral;
136class NestedVariableDeclaration;
137class ProducedPreparseData;
138class Statement;
139
140#define DEF_FORWARD_DECLARATION(type) class type;
143#undef DEF_FORWARD_DECLARATION
144
145class AstNode: public ZoneObject {
146 public:
147#define DECLARE_TYPE_ENUM(type) k##type,
152#undef DECLARE_TYPE_ENUM
153
155 int position() const { return position_; }
156
157#ifdef DEBUG
158 void Print(Isolate* isolate);
159#endif // DEBUG
160
161 // Type testing & conversion functions overridden by concrete subclasses.
162#define DECLARE_NODE_FUNCTIONS(type) \
163 V8_INLINE bool Is##type() const; \
164 V8_INLINE type* As##type(); \
165 V8_INLINE const type* As##type() const;
168#undef DECLARE_NODE_FUNCTIONS
169
170 IterationStatement* AsIterationStatement();
171 MaterializedLiteral* AsMaterializedLiteral();
172
173 private:
176
177 protected:
178 uint32_t bit_field_;
179
180 template <class T, int size>
182
184 : position_(position), bit_field_(NodeTypeField::encode(type)) {}
185};
186
187
188class Statement : public AstNode {
189 protected:
191};
192
193
194class Expression : public AstNode {
195 public:
196 enum Context {
197 // Not assigned a context yet, or else will not be visited during
198 // code generation.
200 // Evaluated for its side effects.
202 // Evaluated for its value (and side effects).
204 // Evaluated for control flow (and side effects).
205 kTest
206 };
207
208 // True iff the expression is a valid reference expression.
209 bool IsValidReferenceExpression() const;
210
211 // True iff the expression is a private name.
212 bool IsPrivateName() const;
213
214 // Helpers for ToBoolean conversion.
215 bool ToBooleanIsTrue() const;
216 bool ToBooleanIsFalse() const;
217
218 // Symbols that cannot be parsed as array indices are considered property
219 // names. We do not treat symbols that can be array indexes as property
220 // names because [] for string objects is handled only by keyed ICs.
221 bool IsPropertyName() const;
222
223 // True iff the expression is a class or function expression without
224 // a syntactic name.
226
227 // True iff the expression is a concise method definition.
228 bool IsConciseMethodDefinition() const;
229
230 // True iff the expression is an accessor function definition.
231 bool IsAccessorFunctionDefinition() const;
232
233 // True iff the expression is a literal represented as a smi.
234 bool IsSmiLiteral() const;
235
236 // True iff the expression is a literal represented as a number.
238
239 // True iff the expression is a string literal.
240 bool IsStringLiteral() const;
241
242 // True iff the expression is a cons string literal.
243 bool IsConsStringLiteral() const;
244
245 // True iff the expression is the null literal.
246 bool IsNullLiteral() const;
247
248 bool IsBooleanLiteral() const;
249
250 // True iff the expression is the hole literal.
251 bool IsTheHoleLiteral() const;
252
253 // True if we can prove that the expression is the undefined literal. Note
254 // that this also checks for loads of the global "undefined" variable.
255 bool IsUndefinedLiteral() const;
256
257 // True if either null literal or undefined literal.
258 inline bool IsNullOrUndefinedLiteral() const {
259 return IsNullLiteral() || IsUndefinedLiteral();
260 }
261
262 // True if a literal and not null or undefined.
264
265 bool IsCompileTimeValue();
266
267 bool IsPattern() {
268 static_assert(kObjectLiteral + 1 == kArrayLiteral);
269 return base::IsInRange(node_type(), kObjectLiteral, kArrayLiteral);
270 }
271
275
279
283
284 private:
286
287 protected:
288 Expression(int pos, NodeType type) : AstNode(pos, type) {
290 }
291
292 template <class T, int size>
294};
295
297 private:
298 friend class AstNodeFactory;
299 friend Zone;
301};
302
303// V8's notion of BreakableStatement does not correspond to the notion of
304// BreakableStatement in ECMAScript. In V8, the idea is that a
305// BreakableStatement is a statement that can be the target of a break
306// statement.
307//
308// Since we don't want to track a list of labels for all kinds of statements, we
309// only declare switches, loops, and blocks as BreakableStatements. This means
310// that we implement breaks targeting other statement forms as breaks targeting
311// a substatement thereof. For instance, in "foo: if (b) { f(); break foo; }" we
312// pretend that foo is the label of the inner block. That's okay because one
313// can't observe the difference.
314// TODO(verwaest): Reconsider this optimization now that the tracking of labels
315// is done at runtime.
317 protected:
319};
320
321class Block final : public BreakableStatement {
322 public:
331
332 Scope* scope() const { return scope_; }
334
336 Zone* zone) {
337 DCHECK_EQ(0, statements_.length());
338 statements_ = ZonePtrList<Statement>(statements.ToConstVector(), zone);
339 }
340
341 private:
342 friend class AstNodeFactory;
343 friend Zone;
344
347
352
353 protected:
364
369};
370
371class Declaration : public AstNode {
372 public:
374
375 Variable* var() const { return var_; }
377
378 protected:
379 Declaration(int pos, NodeType type) : AstNode(pos, type), next_(nullptr) {}
380
381 private:
383 // Declarations list threaded through the declarations.
384 Declaration** next() { return &next_; }
386 friend List;
388};
389
391 public:
393
394 private:
395 friend class AstNodeFactory;
396 friend Zone;
397
399
400 protected:
401 explicit VariableDeclaration(int pos, bool is_nested = false)
402 : Declaration(pos, kVariableDeclaration) {
404 }
405
406 template <class T, int size>
408};
409
410// For var declarations that appear in a block scope.
411// Only distinguished from VariableDeclaration during Scope analysis,
412// so it doesn't get its own NodeType.
414 public:
415 Scope* scope() const { return scope_; }
416
417 private:
418 friend class AstNodeFactory;
419 friend Zone;
420
423
424 // Nested scope from which the declaration originated.
426};
427
433
434class FunctionDeclaration final : public Declaration {
435 public:
436 FunctionLiteral* fun() const { return fun_; }
437
438 private:
439 friend class AstNodeFactory;
440 friend Zone;
441
443 : Declaration(pos, kFunctionDeclaration), fun_(fun) {}
444
446};
447
448
450 public:
451 Statement* body() const { return body_; }
452 void set_body(Statement* s) { body_ = s; }
453
454 protected:
456 : BreakableStatement(pos, type), body_(nullptr) {}
458
459 private:
461};
462
463
465 public:
470
471 Expression* cond() const { return cond_; }
472
473 private:
474 friend class AstNodeFactory;
475 friend Zone;
476
477 explicit DoWhileStatement(int pos)
478 : IterationStatement(pos, kDoWhileStatement), cond_(nullptr) {}
479
481};
482
483
484class WhileStatement final : public IterationStatement {
485 public:
490
491 Expression* cond() const { return cond_; }
492
493 private:
494 friend class AstNodeFactory;
495 friend Zone;
496
497 explicit WhileStatement(int pos)
498 : IterationStatement(pos, kWhileStatement), cond_(nullptr) {}
499
501};
502
503
504class ForStatement final : public IterationStatement {
505 public:
513
514 Statement* init() const { return init_; }
515 Expression* cond() const { return cond_; }
516 Statement* next() const { return next_; }
517
518 private:
519 friend class AstNodeFactory;
520 friend Zone;
521
522 explicit ForStatement(int pos)
523 : IterationStatement(pos, kForStatement),
524 init_(nullptr),
525 cond_(nullptr),
526 next_(nullptr) {}
527
531};
532
533// Shared class for for-in and for-of statements.
535 public:
537 ENUMERATE, // for (each in subject) body;
538 ITERATE // for (each of subject) body;
539 };
540
542
543 static const char* VisitModeString(VisitMode mode) {
544 return mode == ITERATE ? "for-of" : "for-in";
545 }
546
554
555 Expression* each() const { return each_; }
556 Expression* subject() const { return subject_; }
557
558 // The parser wraps the `subject` expression into a hidden block scope
559 // in some cases. Otherwise the debugger gets confused when pausing in the
560 // `subject` expression.
561 Scope* subject_scope() const { return subject_scope_; }
562
563 protected:
564 friend class AstNodeFactory;
565 friend Zone;
566
568 : IterationStatement(pos, type),
569 each_(nullptr),
570 subject_(nullptr),
571 subject_scope_(nullptr) {}
572
576};
577
578class ForInStatement final : public ForEachStatement {
579 private:
580 friend class AstNodeFactory;
581 friend Zone;
582
583 explicit ForInStatement(int pos) : ForEachStatement(pos, kForInStatement) {}
584};
585
587class ForOfStatement final : public ForEachStatement {
588 public:
589 IteratorType type() const { return type_; }
590
591 private:
592 friend class AstNodeFactory;
593 friend Zone;
594
596 : ForEachStatement(pos, kForOfStatement), type_(type) {}
597
599};
600
601class ExpressionStatement final : public Statement {
602 public:
604 Expression* expression() const { return expression_; }
605
606 private:
607 friend class AstNodeFactory;
608 friend Zone;
609
611 : Statement(pos, kExpressionStatement), expression_(expression) {}
612
614};
615
616
617class JumpStatement : public Statement {
618 protected:
619 JumpStatement(int pos, NodeType type) : Statement(pos, type) {}
620};
621
622
623class ContinueStatement final : public JumpStatement {
624 public:
625 IterationStatement* target() const { return target_; }
626
627 private:
628 friend class AstNodeFactory;
629 friend Zone;
630
632 : JumpStatement(pos, kContinueStatement), target_(target) {}
633
635};
636
637
638class BreakStatement final : public JumpStatement {
639 public:
640 BreakableStatement* target() const { return target_; }
641
642 private:
643 friend class AstNodeFactory;
644 friend Zone;
645
647 : JumpStatement(pos, kBreakStatement), target_(target) {}
648
650};
651
652
653class ReturnStatement final : public JumpStatement {
654 public:
656 Expression* expression() const { return expression_; }
657
659 bool is_async_return() const { return type() != kNormal; }
661 return type() == kSyntheticAsyncReturn;
662 }
663
664 // This constant is used to indicate that the return position
665 // from the FunctionLiteral should be used when emitting code.
666 static constexpr int kFunctionLiteralReturnPosition = -2;
668
669 int end_position() const { return end_position_; }
670
671 private:
672 friend class AstNodeFactory;
673 friend Zone;
674
675 ReturnStatement(Expression* expression, Type type, int pos, int end_position)
676 : JumpStatement(pos, kReturnStatement),
677 expression_(expression),
680 }
681
684
686};
687
688
689class WithStatement final : public Statement {
690 public:
691 Scope* scope() { return scope_; }
692 Expression* expression() const { return expression_; }
693 Statement* statement() const { return statement_; }
695
696 private:
697 friend class AstNodeFactory;
698 friend Zone;
699
701 int pos)
702 : Statement(pos, kWithStatement),
703 scope_(scope),
704 expression_(expression),
706
710};
711
712class CaseClause final : public ZoneObject {
713 public:
714 bool is_default() const { return label_ == nullptr; }
715 Expression* label() const {
716 DCHECK(!is_default());
717 return label_;
718 }
720
721 private:
722 friend class AstNodeFactory;
723 friend Zone;
724
727
730};
731
732
734 public:
735 Expression* tag() const { return tag_; }
736 void set_tag(Expression* t) { tag_ = t; }
737
739
740 private:
741 friend class AstNodeFactory;
742 friend Zone;
743
745 : BreakableStatement(pos, kSwitchStatement), tag_(tag), cases_(4, zone) {}
746
749};
750
751
752// If-statements always have non-null references to their then- and
753// else-parts. When parsing if-statements with no explicit else-part,
754// the parser implicitly creates an empty statement. Use the
755// HasThenStatement() and HasElseStatement() functions to check if a
756// given if-statement has a then- or an else-part containing code.
757class IfStatement final : public Statement {
758 public:
759 bool HasThenStatement() const { return !then_statement_->IsEmptyStatement(); }
760 bool HasElseStatement() const { return !else_statement_->IsEmptyStatement(); }
761
762 Expression* condition() const { return condition_; }
765
768
769 private:
770 friend class AstNodeFactory;
771 friend Zone;
772
779
783};
784
785
786class TryStatement : public Statement {
787 public:
788 Block* try_block() const { return try_block_; }
790
791 protected:
794
795 private:
797};
798
799
800class TryCatchStatement final : public TryStatement {
801 public:
802 Scope* scope() { return scope_; }
803 Block* catch_block() const { return catch_block_; }
805
806 // Prediction of whether exceptions thrown into the handler for this try block
807 // will be caught.
808 //
809 // BytecodeGenerator tracks the state of catch prediction, which can change
810 // with each TryCatchStatement encountered. The tracked catch prediction is
811 // later compiled into the code's handler table. The runtime uses this
812 // information to implement a feature that notifies the debugger when an
813 // uncaught exception is thrown, _before_ the exception propagates to the top.
814 //
815 // If this try/catch statement is meant to rethrow (HandlerTable::UNCAUGHT),
816 // the catch prediction value is set to the same value as the surrounding
817 // catch prediction.
818 //
819 // Since it's generally undecidable whether an exception will be caught, our
820 // prediction is only an approximation.
821 // ---------------------------------------------------------------------------
823 HandlerTable::CatchPrediction outer_catch_prediction) const {
825 return outer_catch_prediction;
826 }
827 return catch_prediction_;
828 }
829
830 // Indicates whether or not code should be generated to clear the pending
831 // exception. The exception is cleared for cases where the exception
832 // is not guaranteed to be rethrown, indicated by the value
833 // HandlerTable::UNCAUGHT. If both the current and surrounding catch handler's
834 // are predicted uncaught, the exception is not cleared.
835 //
836 // If this handler is not going to simply rethrow the exception, this method
837 // indicates that the isolate's exception message should be cleared
838 // before executing the catch_block.
839 // In the normal use case, this flag is always on because the message object
840 // is not needed anymore when entering the catch block and should not be
841 // kept alive.
842 // The use case where the flag is off is when the catch block is guaranteed
843 // to rethrow the caught exception (using %ReThrow), which reuses the
844 // pending message instead of generating a new one.
845 // (When the catch block doesn't rethrow but is guaranteed to perform an
846 // ordinary throw, not clearing the old message is safe but not very
847 // useful.)
848 //
849 // For scripts in repl mode there is exactly one catch block with
850 // UNCAUGHT_ASYNC_AWAIT prediction. This catch block needs to preserve
851 // the exception so it can be reused later by the inspector.
853 HandlerTable::CatchPrediction outer_catch_prediction) const {
855 DCHECK_EQ(outer_catch_prediction, HandlerTable::UNCAUGHT);
856 return false;
857 }
858
860 outer_catch_prediction != HandlerTable::UNCAUGHT;
861 }
862
866
867 private:
868 friend class AstNodeFactory;
869 friend Zone;
870
872 HandlerTable::CatchPrediction catch_prediction, int pos)
873 : TryStatement(try_block, pos, kTryCatchStatement),
874 scope_(scope),
876 catch_prediction_(catch_prediction) {}
877
881};
882
883
884class TryFinallyStatement final : public TryStatement {
885 public:
886 Block* finally_block() const { return finally_block_; }
888
889 private:
890 friend class AstNodeFactory;
891 friend Zone;
892
896
898};
899
900
901class DebuggerStatement final : public Statement {
902 private:
903 friend class AstNodeFactory;
904 friend Zone;
905
906 explicit DebuggerStatement(int pos) : Statement(pos, kDebuggerStatement) {}
907};
908
909
910class EmptyStatement final : public Statement {
911 private:
912 friend class AstNodeFactory;
913 friend Zone;
915};
916
917
918// Delegates to another statement, which may be overwritten.
919// This was introduced to implement ES2015 Annex B3.3 for conditionally making
920// sloppy-mode block-scoped functions have a var binding, which is changed
921// from one statement to another during parsing.
951
952
953class Literal final : public Expression {
954 public:
966
968
969 // Returns true if literal represents a property name (i.e. cannot be parsed
970 // as array indices).
971 bool IsPropertyName() const;
972
973 // Returns true if literal represents an array index.
974 // Note, that in general the following statement is not true:
975 // key->IsPropertyName() != key->AsArrayIndex(...)
976 // but for non-computed LiteralProperty properties the following is true:
977 // property->key()->IsPropertyName() != property->key()->AsArrayIndex(...)
978 bool AsArrayIndex(uint32_t* index) const;
979
982 return string_;
983 }
984
986 DCHECK_EQ(kSmi, type());
987 return Smi::FromInt(smi_);
988 }
989
990 bool AsBooleanLiteral() const {
992 return boolean_;
993 }
994
995 // Returns true if literal represents a Number.
996 bool IsNumber() const { return type() == kHeapNumber || type() == kSmi; }
997 double AsNumber() const {
998 DCHECK(IsNumber());
999 switch (type()) {
1000 case kSmi:
1001 return smi_;
1002 case kHeapNumber:
1003 return number_;
1004 default:
1005 UNREACHABLE();
1006 }
1007 }
1008
1011 return bigint_;
1012 }
1013
1014 bool IsRawString() const { return type() == kString; }
1017 return string_;
1018 }
1019
1020 bool IsConsString() const { return type() == kConsString; }
1025
1027 bool ToBooleanIsFalse() const { return !ToBooleanIsTrue(); }
1028
1029 bool ToUint32(uint32_t* value) const;
1030
1031 // Returns an appropriate Object representing this Literal, allocating
1032 // a heap object if needed.
1033 template <typename IsolateT>
1034 DirectHandle<Object> BuildValue(IsolateT* isolate) const;
1035
1036 // Support for using Literal as a HashMap key. NOTE: Currently, this works
1037 // only for string and number literals!
1038 uint32_t Hash();
1039 static bool Match(void* literal1, void* literal2);
1040
1041 private:
1042 friend class AstNodeFactory;
1043 friend Zone;
1044
1046
1050
1051 Literal(double number, int position)
1052 : Expression(position, kLiteral), number_(number) {
1054 }
1055
1060
1065
1070
1071 Literal(bool boolean, int position)
1072 : Expression(position, kLiteral), boolean_(boolean) {
1074 }
1075
1077 DCHECK(type == kNull || type == kUndefined || type == kTheHole);
1079 }
1080
1081 union {
1084 int smi_;
1085 double number_;
1088 };
1089};
1090
1091// Base class for literals that need space in the type feedback vector.
1093 public:
1094 // A Materializedliteral is simple if the values consist of only
1095 // constants and simple object and array literals.
1096 bool IsSimple() const;
1097
1098 protected:
1100
1102
1103 friend class CompileTimeValue;
1104
1108};
1109
1110// Node for capturing a regexp literal.
1112 public:
1113 DirectHandle<String> pattern() const { return pattern_->string(); }
1114 const AstRawString* raw_pattern() const { return pattern_; }
1115 int flags() const { return flags_; }
1116
1117 private:
1118 friend class AstNodeFactory;
1119 friend Zone;
1120
1121 RegExpLiteral(const AstRawString* pattern, int flags, int pos)
1122 : MaterializedLiteral(pos, kRegExpLiteral),
1123 flags_(flags),
1124 pattern_(pattern) {}
1125
1126 int const flags_;
1128};
1129
1130// Base class for Array and Object literals
1144
1145// Base class for build literal boilerplate, providing common code for handling
1146// nested subliterals.
1148 public:
1150
1151 static constexpr int kDepthKindBits = 2;
1152 static_assert((1 << kDepthKindBits) > kNotShallow);
1153
1154 bool is_initialized() const {
1156 }
1160 }
1161
1162 // If the expression is a literal, return the literal value;
1163 // if the expression is a materialized literal and is_simple
1164 // then return an Array or Object Boilerplate Description
1165 // Otherwise, return undefined literal as the placeholder
1166 // in the object literal boilerplate.
1167 template <typename IsolateT>
1169 IsolateT* isolate);
1170
1171 bool is_shallow() const { return depth() == kShallow; }
1175
1176 int ComputeFlags(bool disable_mementos = false) const {
1177 int flags = AggregateLiteral::kNoFlags;
1179 if (disable_mementos) flags |= AggregateLiteral::kDisableMementos;
1182 return flags;
1183 }
1184
1185 // An AggregateLiteral is simple if the values consist of only
1186 // constants and simple object and array literals.
1188
1192
1193 private:
1194 // we actually only care three conditions for depth
1195 // - depth == kUninitialized, DCHECK(!is_initialized())
1196 // - depth == kShallow, which means depth = 1
1197 // - depth == kNotShallow, which means depth > 1
1203
1204 protected:
1205 uint32_t bit_field_;
1206
1214
1218
1223
1228
1232
1233 // Populate the depth field and any flags the literal builder has
1234 static void InitDepthAndFlags(MaterializedLiteral* expr);
1235
1236 // Populate the constant properties/elements fixed array.
1237 template <typename IsolateT>
1238 void BuildConstants(IsolateT* isolate, MaterializedLiteral* expr);
1239
1240 template <class T, int size>
1242};
1243
1244// Common supertype for ObjectLiteralProperty and ClassLiteralProperty
1246 public:
1247 Expression* key() const { return key_and_is_computed_name_.GetPointer(); }
1248 Expression* value() const { return value_; }
1249
1250 bool is_computed_name() const {
1251 return key_and_is_computed_name_.GetPayload();
1252 }
1253 bool NeedsSetFunctionName() const;
1254
1255 protected:
1258
1261};
1262
1263// Property is used for passing information
1264// about an object literal's properties from the parser
1265// to the code generator.
1267 public:
1268 enum Kind : uint8_t {
1269 CONSTANT, // Property with constant value (compile time).
1270 COMPUTED, // Property with computed value (execution time).
1271 MATERIALIZED_LITERAL, // Property value is a materialized literal.
1273 SETTER, // Property is an accessor function.
1274 PROTOTYPE, // Property is __proto__.
1275 SPREAD
1277
1278 Kind kind() const { return kind_; }
1279
1280 bool IsCompileTimeValue() const;
1281
1282 void set_emit_store(bool emit_store);
1283 bool emit_store() const;
1284
1285 bool IsNullPrototype() const {
1286 return IsPrototype() && value()->IsNullLiteral();
1287 }
1288 bool IsPrototype() const { return kind() == PROTOTYPE; }
1289
1290 private:
1291 friend class AstNodeFactory;
1292 friend Zone;
1293
1295 bool is_computed_name);
1297 Expression* value, bool is_computed_name);
1298
1301};
1302
1303// class for build object boilerplate
1305 public:
1307
1309 uint32_t boilerplate_properties,
1310 bool has_rest_property)
1311 : properties_(properties),
1312 boilerplate_properties_(boilerplate_properties) {
1317 }
1322 // Determines whether the {CreateShallowArrayLiteral} builtin can be used.
1324
1328 bool has_rest_property() const {
1330 }
1335
1336 // Populate the boilerplate description.
1337 template <typename IsolateT>
1338 void BuildBoilerplateDescription(IsolateT* isolate);
1339
1340 // Get the boilerplate description, populating it if necessary.
1341 template <typename IsolateT>
1349
1350 bool is_empty() const {
1352 return !has_elements() && properties_count() == 0 &&
1353 properties()->length() == 0;
1354 }
1355 // Assemble bitfield of flags for the CreateObjectLiteral helper.
1356 int ComputeFlags(bool disable_mementos = false) const;
1357
1359 return is_empty() && !has_null_prototype();
1360 }
1361
1362 int EncodeLiteralType();
1363
1364 // Populate the depth field and flags, returns the depth.
1365 void InitDepthAndFlags();
1366
1367 private:
1369
1382
1387};
1388
1389// An object literal has a boilerplate object that is used
1390// for minimizing the work when constructing it at runtime.
1391class ObjectLiteral final : public AggregateLiteral {
1392 public:
1394
1395 enum Flags {
1398 };
1399 static_assert(
1401 static_cast<int>(kFastElements));
1402
1403 // Mark all computed expressions that are bound to a key that
1404 // is shadowed by a later occurrence of the same key. For the
1405 // marked expressions, no store code is emitted.
1406 void CalculateEmitStore(Zone* zone);
1407
1409
1411
1413
1414 Variable* home_object() const { return home_object_; }
1415
1416 private:
1417 friend class AstNodeFactory;
1418 friend Zone;
1419
1421 uint32_t boilerplate_properties, int pos,
1422 bool has_rest_property, Variable* home_object)
1423 : AggregateLiteral(pos, kObjectLiteral),
1424 properties_(properties.ToConstVector(), zone),
1426 builder_(&properties_, boilerplate_properties, has_rest_property) {}
1427
1431};
1432
1433// class for build boilerplate for array literal, including
1434// array_literal, spread call elements
1436 public:
1443
1444 // Determines whether the {CreateShallowArrayLiteral} builtin can be used.
1446
1447 // Assemble bitfield of flags for the CreateArrayLiteral helper.
1448 int ComputeFlags(bool disable_mementos = false) const {
1449 return LiteralBoilerplateBuilder::ComputeFlags(disable_mementos);
1450 }
1451
1453
1454 // Populate the depth field and flags
1456
1457 // Get the boilerplate description, populating it if necessary.
1458 template <typename IsolateT>
1466
1467 // Populate the boilerplate description.
1468 template <typename IsolateT>
1469 void BuildBoilerplateDescription(IsolateT* isolate);
1470
1474};
1475
1476// An array literal has a literals object that is used
1477// for minimizing the work when constructing it at runtime.
1478class ArrayLiteral final : public AggregateLiteral {
1479 public:
1480 const ZonePtrList<Expression>* values() const { return &values_; }
1481
1484
1485 private:
1486 friend class AstNodeFactory;
1487 friend Zone;
1488
1490 int first_spread_index, int pos)
1491 : AggregateLiteral(pos, kArrayLiteral),
1492 values_(values.ToConstVector(), zone),
1493 builder_(&values_, first_spread_index) {}
1494
1497};
1498
1500
1501class ThisExpression final : public Expression {
1502 private:
1503 friend class AstNodeFactory;
1504 friend Zone;
1505 explicit ThisExpression(int pos) : Expression(pos, kThisExpression) {}
1506};
1507
1508class VariableProxy final : public Expression {
1509 public:
1510 bool IsValidReferenceExpression() const { return !is_new_target(); }
1511
1512 DirectHandle<String> name() const { return raw_name()->string(); }
1513 const AstRawString* raw_name() const {
1514 return is_resolved() ? var_->raw_name() : raw_name_;
1515 }
1516
1517 Variable* var() const {
1519 return var_;
1520 }
1522 DCHECK(!is_resolved());
1523 DCHECK_NOT_NULL(v);
1524 var_ = v;
1525 }
1526
1530
1534 if (is_resolved()) {
1535 var()->SetMaybeAssigned();
1536 }
1537 }
1541
1546
1551
1555 var()->binding_needs_init() ||
1556 var()->local_if_not_shadowed()->binding_needs_init());
1557 return mode;
1558 }
1563
1564 bool IsPrivateName() const { return raw_name()->IsPrivateName(); }
1565
1566 // Bind this proxy to the variable var.
1567 void BindTo(Variable* var);
1568
1573
1577
1579
1583
1584 // Provides filtered access to the unresolved variable proxy threaded list.
1587 VariableProxy** n = t;
1588 // Skip over possibly removed values.
1589 while (*n != nullptr && (*n)->is_removed_from_unresolved()) {
1590 n = (*n)->next();
1591 }
1592 return n;
1593 }
1594
1595 static VariableProxy** start(VariableProxy** head) { return filter(head); }
1596
1597 static VariableProxy** next(VariableProxy* t) { return filter(t->next()); }
1598 };
1599
1600 private:
1601 friend class AstNodeFactory;
1602 friend Zone;
1603
1604 VariableProxy(Variable* var, int start_position);
1605
1606 VariableProxy(const AstRawString* name, VariableKind variable_kind,
1607 int start_position)
1608 : Expression(start_position, kVariableProxy),
1609 raw_name_(name),
1610 next_unresolved_(nullptr) {
1611 DCHECK_NE(THIS_VARIABLE, variable_kind);
1617 }
1618
1619 explicit VariableProxy(const VariableProxy* copy_from);
1620
1627
1628 union {
1629 const AstRawString* raw_name_; // if !is_resolved_
1630 Variable* var_; // if is_resolved_
1631 };
1632
1635
1637};
1638
1639// Wraps an optional chain to provide a wrapper for jump labels.
1640class OptionalChain final : public Expression {
1641 public:
1642 Expression* expression() const { return expression_; }
1643
1644 private:
1645 friend class AstNodeFactory;
1646 friend Zone;
1647
1648 explicit OptionalChain(Expression* expression)
1649 : Expression(0, kOptionalChain), expression_(expression) {}
1650
1652};
1653
1654// Assignments to a property will use one of several types of property access.
1655// Otherwise, the assignment is to a non-property (a global, a local slot, a
1656// parameter slot, or a destructuring pattern).
1658 NON_PROPERTY, // destructuring
1659 NAMED_PROPERTY, // obj.key
1660 KEYED_PROPERTY, // obj[key] and obj.#key when #key is a private field
1663 PRIVATE_METHOD, // obj.#key: #key is a private method
1664 PRIVATE_GETTER_ONLY, // obj.#key: #key only has a getter defined
1665 PRIVATE_SETTER_ONLY, // obj.#key: #key only has a setter defined
1666 PRIVATE_GETTER_AND_SETTER, // obj.#key: #key has both accessors defined
1667 PRIVATE_DEBUG_DYNAMIC, // obj.#key: #key is private that requires dynamic
1668 // lookup in debug-evaluate.
1669};
1670
1671class Property final : public Expression {
1672 public:
1676
1677 bool IsValidReferenceExpression() const { return true; }
1678
1679 Expression* obj() const { return obj_; }
1680 Expression* key() const { return key_; }
1681
1682 bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); }
1683 bool IsPrivateReference() const { return key()->IsPrivateName(); }
1684
1685 // Returns the properties assign type.
1687 if (property == nullptr) return NON_PROPERTY;
1688 if (property->IsPrivateReference()) {
1689 DCHECK(!property->IsSuperAccess());
1690 VariableProxy* proxy = property->key()->AsVariableProxy();
1691 DCHECK_NOT_NULL(proxy);
1692 Variable* var = proxy->var();
1693
1694 switch (var->mode()) {
1696 return PRIVATE_METHOD;
1698 return KEYED_PROPERTY; // Use KEYED_PROPERTY for private fields.
1700 return PRIVATE_GETTER_ONLY;
1702 return PRIVATE_SETTER_ONLY;
1706 // From debug-evaluate.
1707 return PRIVATE_DEBUG_DYNAMIC;
1708 default:
1709 UNREACHABLE();
1710 }
1711 }
1712 bool super_access = property->IsSuperAccess();
1713 return (property->key()->IsPropertyName())
1714 ? (super_access ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY)
1715 : (super_access ? KEYED_SUPER_PROPERTY : KEYED_PROPERTY);
1716 }
1717
1718 private:
1719 friend class AstNodeFactory;
1720 friend Zone;
1721
1722 Property(Expression* obj, Expression* key, int pos, bool optional_chain)
1725 }
1726
1728
1731};
1732
1733class CallBase : public Expression {
1734 public:
1735 Expression* expression() const { return expression_; }
1737
1742
1743 protected:
1744 CallBase(Zone* zone, NodeType type, Expression* expression,
1745 const ScopedPtrList<Expression>& arguments, int pos, bool has_spread)
1746 : Expression(pos, type),
1747 expression_(expression),
1748 arguments_(arguments.ToConstVector(), zone) {
1749 DCHECK(type == kCall || type == kCallNew);
1750 if (has_spread) {
1752 } else {
1754 }
1755 }
1756
1757 // Only valid to be called if there is a spread in arguments_.
1758 void ComputeSpreadPosition();
1759
1761
1762 template <class T, int size>
1764
1767};
1768
1769class Call final : public CallBase {
1770 public:
1771 bool is_possibly_eval() const {
1773 }
1774
1778
1782
1786
1791
1806
1807 // Helpers to determine how to handle the call.
1808 CallType GetCallType() const;
1809
1810 enum class TaggedTemplateTag { kTrue };
1811
1812 private:
1813 friend class AstNodeFactory;
1814 friend Zone;
1815
1816 Call(Zone* zone, Expression* expression,
1817 const ScopedPtrList<Expression>& arguments, int pos, bool has_spread,
1818 int eval_scope_info_index, bool optional_chain)
1819 : CallBase(zone, kCall, expression, arguments, pos, has_spread) {
1821 IsOptionalChainLinkField::encode(optional_chain) |
1824 }
1825
1826 Call(Zone* zone, Expression* expression,
1827 const ScopedPtrList<Expression>& arguments, int pos,
1829 : CallBase(zone, kCall, expression, arguments, pos, false) {
1833 }
1834
1838};
1839
1840class CallNew final : public CallBase {
1841 private:
1842 friend class AstNodeFactory;
1843 friend Zone;
1844
1845 CallNew(Zone* zone, Expression* expression,
1846 const ScopedPtrList<Expression>& arguments, int pos, bool has_spread)
1847 : CallBase(zone, kCallNew, expression, arguments, pos, has_spread) {}
1848};
1849
1850// SuperCallForwardArgs is not utterable in JavaScript. It is used to
1851// implement the default derived constructor, which forwards all arguments to
1852// the super constructor without going through the user-visible spread
1853// machinery.
1854class SuperCallForwardArgs final : public Expression {
1855 public:
1857
1858 private:
1859 friend class AstNodeFactory;
1860 friend Zone;
1861
1863 : Expression(pos, kSuperCallForwardArgs), expression_(expression) {}
1864
1866};
1867
1868// The CallRuntime class does not represent any official JavaScript
1869// language construct. Instead it is used to call a runtime function
1870// with a set of arguments.
1871class CallRuntime final : public Expression {
1872 public:
1874 const Runtime::Function* function() const { return function_; }
1875
1876 private:
1877 friend class AstNodeFactory;
1878 friend Zone;
1879
1880 CallRuntime(Zone* zone, const Runtime::Function* function,
1881 const ScopedPtrList<Expression>& arguments, int pos)
1882 : Expression(pos, kCallRuntime),
1883 function_(function),
1884 arguments_(arguments.ToConstVector(), zone) {
1886 }
1887
1890};
1891
1892
1893class UnaryOperation final : public Expression {
1894 public:
1896 Expression* expression() const { return expression_; }
1897
1898 private:
1899 friend class AstNodeFactory;
1900 friend Zone;
1901
1903 : Expression(pos, kUnaryOperation), expression_(expression) {
1906 }
1907
1909
1911};
1912
1913
1914class BinaryOperation final : public Expression {
1915 public:
1917 Expression* left() const { return left_; }
1918 Expression* right() const { return right_; }
1919
1920 // Returns true if one side is a Smi literal, returning the other side's
1921 // sub-expression in |subexpr| and the literal Smi in |literal|.
1923
1924 private:
1925 friend class AstNodeFactory;
1926 friend Zone;
1927
1929 : Expression(pos, kBinaryOperation), left_(left), right_(right) {
1932 }
1933
1936
1938};
1939
1940class NaryOperation final : public Expression {
1941 public:
1943 Expression* first() const { return first_; }
1944 Expression* subsequent(size_t index) const {
1945 return subsequent_[index].expression;
1946 }
1947
1948 size_t subsequent_length() const { return subsequent_.size(); }
1949 int subsequent_op_position(size_t index) const {
1950 return subsequent_[index].op_position;
1951 }
1952
1953 void AddSubsequent(Expression* expr, int pos) {
1954 subsequent_.emplace_back(expr, pos);
1955 }
1956
1957 private:
1958 friend class AstNodeFactory;
1959 friend Zone;
1960
1962 size_t initial_subsequent_size)
1963 : Expression(first->position(), kNaryOperation),
1964 first_(first),
1965 subsequent_(zone) {
1968 DCHECK_NE(op, Token::kExp);
1969 subsequent_.reserve(initial_subsequent_size);
1970 }
1971
1972 // Nary operations store the first (lhs) child expression inline, and the
1973 // child expressions (rhs of each op) are stored out-of-line, along with
1974 // their operation's position. Note that the Nary operation expression's
1975 // position has no meaning.
1976 //
1977 // So an nary add:
1978 //
1979 // expr + expr + expr + ...
1980 //
1981 // is stored as:
1982 //
1983 // (expr) [(+ expr), (+ expr), ...]
1984 // '-.--' '-----------.-----------'
1985 // first subsequent entry list
1986
1988
1996
1998};
1999
2000class CountOperation final : public Expression {
2001 public:
2003 bool is_postfix() const { return !is_prefix(); }
2004
2006
2007 Expression* expression() const { return expression_; }
2008
2009 private:
2010 friend class AstNodeFactory;
2011 friend Zone;
2012
2017
2020
2022};
2023
2024
2025class CompareOperation final : public Expression {
2026 public:
2028 Expression* left() const { return left_; }
2029 Expression* right() const { return right_; }
2030
2031 // Match special cases.
2034 bool IsLiteralCompareNull(Expression** expr);
2036
2037 private:
2038 friend class AstNodeFactory;
2039 friend Zone;
2040
2042 int pos)
2043 : Expression(pos, kCompareOperation), left_(left), right_(right) {
2046 }
2047
2050
2052};
2053
2054
2055class Spread final : public Expression {
2056 public:
2057 Expression* expression() const { return expression_; }
2058
2059 int expression_position() const { return expr_pos_; }
2060
2061 private:
2062 friend class AstNodeFactory;
2063 friend Zone;
2064
2065 Spread(Expression* expression, int pos, int expr_pos)
2067 expr_pos_(expr_pos),
2068 expression_(expression) {}
2069
2072};
2073
2075 public:
2076 Expression* condition_at(size_t index) const {
2077 return conditional_chain_entries_[index].condition;
2078 }
2079 Expression* then_expression_at(size_t index) const {
2080 return conditional_chain_entries_[index].then_expression;
2081 }
2082 int condition_position_at(size_t index) const {
2083 return conditional_chain_entries_[index].condition_position;
2084 }
2086 return conditional_chain_entries_.size();
2087 }
2090
2091 void AddChainEntry(Expression* cond, Expression* then, int pos) {
2092 conditional_chain_entries_.emplace_back(cond, then, pos);
2093 }
2094
2095 private:
2096 friend class AstNodeFactory;
2097 friend Zone;
2098
2099 ConditionalChain(Zone* zone, size_t initial_size, int pos)
2100 : Expression(pos, kConditionalChain),
2102 else_expression_(nullptr) {
2103 conditional_chain_entries_.reserve(initial_size);
2104 }
2105
2106 // Conditional Chain Expression stores the conditional chain entries out of
2107 // line, along with their operation's position. The else expression is stored
2108 // inline. This Expression is reserved for ternary operations that have more
2109 // than one conditional chain entry. For ternary operations with only one
2110 // conditional chain entry, the Conditional Expression is used instead.
2111 //
2112 // So an conditional chain:
2113 //
2114 // cond ? then : cond ? then : cond ? then : else
2115 //
2116 // is stored as:
2117 //
2118 // [(cond, then), (cond, then),...] else
2119 // '-----------------------------' '----'
2120 // conditional chain entries else
2121 //
2122 // Example:
2123 //
2124 // Expression: v1 == 1 ? "a" : v2 == 2 ? "b" : "c"
2125 //
2126 // conditionat_chain_entries_: [(v1 == 1, "a", 0), (v2 == 2, "b", 14)]
2127 // else_expression_: "c"
2128 //
2129 // Example of a _not_ expected expression (only one chain entry):
2130 //
2131 // Expression: v1 == 1 ? "a" : "b"
2132 //
2133
2143};
2144
2166
2167class Assignment : public Expression {
2168 public:
2170 Expression* target() const { return target_; }
2171 Expression* value() const { return value_; }
2172
2173 // The assignment was generated as part of block-scoped sloppy-mode
2174 // function hoisting, see
2175 // ES#sec-block-level-function-declarations-web-legacy-compatibility-semantics
2184
2185 protected:
2187 Expression* value, int pos);
2188
2189 private:
2190 friend class AstNodeFactory;
2191 friend Zone;
2192
2195
2198};
2199
2200class CompoundAssignment final : public Assignment {
2201 public:
2203
2204 private:
2205 friend class AstNodeFactory;
2206 friend Zone;
2207
2210 : Assignment(kCompoundAssignment, op, target, value, pos),
2212
2214};
2215
2216// There are several types of Suspend node:
2217//
2218// Yield
2219// YieldStar
2220// Await
2221//
2222// Our Yield is different from the JS yield in that it "returns" its argument as
2223// is, without wrapping it in an iterator result object. Such wrapping, if
2224// desired, must be done beforehand (see the parser).
2225class Suspend : public Expression {
2226 public:
2227 // With {kNoControl}, the {Suspend} behaves like yield, except that it never
2228 // throws and never causes the current generator to return. This is used to
2229 // desugar yield*.
2230 // TODO(caitp): remove once yield* desugaring for async generators is handled
2231 // in BytecodeGenerator.
2233
2234 Expression* expression() const { return expression_; }
2238
2239 private:
2240 friend class AstNodeFactory;
2241 friend Zone;
2242 friend class Yield;
2243 friend class YieldStar;
2244 friend class Await;
2245
2251
2253
2255};
2256
2257class Yield final : public Suspend {
2258 private:
2259 friend class AstNodeFactory;
2260 friend Zone;
2262 : Suspend(kYield, expression, pos, on_abrupt_resume) {}
2263};
2264
2265class YieldStar final : public Suspend {
2266 private:
2267 friend class AstNodeFactory;
2268 friend Zone;
2269 YieldStar(Expression* expression, int pos)
2270 : Suspend(kYieldStar, expression, pos,
2272};
2273
2274class Await final : public Suspend {
2275 private:
2276 friend class AstNodeFactory;
2277 friend Zone;
2278
2279 Await(Expression* expression, int pos)
2280 : Suspend(kAwait, expression, pos, Suspend::kOnExceptionThrow) {}
2281};
2282
2283class Throw final : public Expression {
2284 public:
2285 Expression* exception() const { return exception_; }
2286
2287 private:
2288 friend class AstNodeFactory;
2289 friend Zone;
2290
2291 Throw(Expression* exception, int pos)
2292 : Expression(pos, kThrow), exception_(exception) {}
2293
2295};
2296
2297
2298class FunctionLiteral final : public Expression {
2299 public:
2305
2306 // Empty handle means that the function does not have a shared name (i.e.
2307 // the name will be set dynamically after creation of the function closure).
2308 template <typename IsolateT>
2309 MaybeHandle<String> GetName(IsolateT* isolate) const {
2310 return raw_name_ ? raw_name_->AllocateFlat(isolate) : MaybeHandle<String>();
2311 }
2312 bool has_shared_name() const { return raw_name_ != nullptr; }
2313 const AstConsString* raw_name() const { return raw_name_; }
2314 void set_raw_name(const AstConsString* name) { raw_name_ = name; }
2315 DeclarationScope* scope() const { return scope_; }
2319 int start_position() const;
2320 int end_position() const;
2324
2325 bool is_toplevel() const {
2327 }
2329
2330 void add_expected_properties(int number_properties) {
2331 expected_property_count_ += number_properties;
2332 }
2336
2337 bool AllowsLazyCompilation();
2338
2339 bool CanSuspend() {
2340 if (suspend_count() > 0) {
2342 return true;
2343 }
2344 return false;
2345 }
2346
2347 // Returns either name or inferred name as a cstring.
2348 std::unique_ptr<char[]> GetDebugName() const;
2349
2355
2361
2363 // This should only be called if we don't have a shared function info yet.
2365
2366 bool pretenure() const { return Pretenure::decode(bit_field_); }
2368
2370 // Not valid for lazy functions.
2373 }
2374
2381
2382 // This is used as a heuristic on when to eagerly compile a function
2383 // literal. We consider the following constructs as hints that the
2384 // function will be called immediately:
2385 // - (function() { ... })();
2386 // - var x = function() { ... }();
2389
2393 FunctionKind kind() const;
2394
2396 return is_anonymous_expression();
2397 }
2398
2401
2403 return std::max(
2406 }
2407
2412
2419
2427
2428 void set_class_scope_has_private_brand(bool value);
2429 bool class_scope_has_private_brand() const;
2430
2432
2436
2437 private:
2438 friend class AstNodeFactory;
2439 friend Zone;
2440
2471
2482
2483 // expected_property_count_ is the sum of instance fields and properties.
2484 // It can vary depending on whether a function is lazily or eagerly parsed.
2491
2498};
2499
2500class AutoAccessorInfo final : public ZoneObject {
2501 public:
2512
2519
2520 private:
2521 friend class AstNodeFactory;
2522 friend Zone;
2523
2531
2534 // `accessor_storage_name_proxy_` is used to store the internal name of the
2535 // backing storage property associated with the generated getter/setters.
2537 // `property_private_name_proxy_` only has a value if the accessor keyword
2538 // was applied to a private field.
2540};
2541
2542// Property is used for passing information
2543// about a class literal's properties from the parser to the code generator.
2545 public:
2546 enum Kind : uint8_t { METHOD, GETTER, SETTER, FIELD, AUTO_ACCESSOR };
2547
2548 Kind kind() const { return kind_; }
2549
2550 bool is_static() const { return is_static_; }
2551
2552 bool is_private() const { return is_private_; }
2553
2554 bool is_auto_accessor() const { return kind() == AUTO_ACCESSOR; }
2555
2561
2567
2569 DCHECK(is_private());
2570 if (is_auto_accessor()) {
2572 return;
2573 }
2575 }
2581
2587
2588 private:
2589 friend class AstNodeFactory;
2590 friend Zone;
2591
2593 bool is_static, bool is_computed_name, bool is_private);
2596 bool is_computed_name, bool is_private);
2597
2601 union {
2604 };
2605};
2606
2608 public:
2609 enum Kind : uint8_t { PROPERTY, STATIC_BLOCK };
2610
2611 Kind kind() const { return kind_; }
2612
2614 DCHECK(kind() == PROPERTY);
2615 return property_;
2616 }
2617
2619 DCHECK(kind() == STATIC_BLOCK);
2620 return static_block_;
2621 }
2622
2623 private:
2624 friend class AstNodeFactory;
2625 friend Zone;
2626
2628 : kind_(PROPERTY), property_(property) {}
2629
2632
2634
2635 union {
2638 };
2639};
2640
2642 public:
2644
2646
2647 private:
2648 friend class AstNodeFactory;
2649 friend Zone;
2650
2652 : Statement(pos, kInitializeClassMembersStatement), fields_(fields) {}
2653
2655};
2656
2658 public:
2660
2662
2663 private:
2664 friend class AstNodeFactory;
2665 friend Zone;
2666
2668 int pos)
2669 : Statement(pos, kInitializeClassStaticElementsStatement),
2671
2673};
2674
2675class AutoAccessorGetterBody final : public Statement {
2676 public:
2678
2679 private:
2680 friend class AstNodeFactory;
2681 friend Zone;
2682
2686};
2687
2688class AutoAccessorSetterBody final : public Statement {
2689 public:
2691
2692 private:
2693 friend class AstNodeFactory;
2694 friend Zone;
2695
2699};
2700
2701class ClassLiteral final : public Expression {
2702 public:
2705
2706 ClassScope* scope() const { return scope_; }
2707 Expression* extends() const { return extends_; }
2711 int start_position() const { return position(); }
2712 int end_position() const { return end_position_; }
2716
2721 return is_anonymous_expression();
2722 }
2723
2725
2729
2730 Variable* home_object() const { return home_object_; }
2731
2733
2734 private:
2735 friend class AstNodeFactory;
2736 friend Zone;
2737
2762
2775};
2776
2777class NativeFunctionLiteral final : public Expression {
2778 public:
2779 DirectHandle<String> name() const { return name_->string(); }
2780 const AstRawString* raw_name() const { return name_; }
2782
2783 private:
2784 friend class AstNodeFactory;
2785 friend Zone;
2786
2788 int pos)
2789 : Expression(pos, kNativeFunctionLiteral),
2790 name_(name),
2792
2795};
2796
2797
2799 public:
2801
2802 private:
2803 friend class AstNodeFactory;
2804 friend Zone;
2805
2807 : Expression(pos, kSuperPropertyReference), home_object_(home_object) {}
2808
2810};
2811
2812
2813class SuperCallReference final : public Expression {
2814 public:
2817
2818 private:
2819 friend class AstNodeFactory;
2820 friend Zone;
2821
2822 // We take in ThisExpression* only as a proof that it was accessed.
2825 : Expression(pos, kSuperCallReference),
2828 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target"));
2829 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function"));
2830 }
2831
2834};
2835
2836// This AST Node is used to represent a dynamic import call --
2837// import(argument).
2865
2866// This class is produced when parsing the () in arrow functions without any
2867// arguments and is not actually a valid expression.
2868class EmptyParentheses final : public Expression {
2869 private:
2870 friend class AstNodeFactory;
2871 friend Zone;
2872
2873 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {
2875 }
2876};
2877
2878// Represents the spec operation `GetTemplateObject(templateLiteral)`
2879// (defined at https://tc39.github.io/ecma262/#sec-gettemplateobject).
2905
2906class TemplateLiteral final : public Expression {
2907 public:
2909 return string_parts_;
2910 }
2912 return substitutions_;
2913 }
2914
2915 private:
2916 friend class AstNodeFactory;
2917 friend Zone;
2923
2926};
2927
2928// ----------------------------------------------------------------------------
2929// Basic visitor
2930// Sub-class should parametrize AstVisitor with itself, e.g.:
2931// class SpecificVisitor : public AstVisitor<SpecificVisitor> { ... }
2932
2933template <class Subclass>
2935 public:
2936 void Visit(AstNode* node) { impl()->Visit(node); }
2937
2939 for (Declaration* decl : *declarations) Visit(decl);
2940 }
2941
2942 void VisitStatements(const ZonePtrList<Statement>* statements) {
2943 for (int i = 0; i < statements->length(); i++) {
2944 Statement* stmt = statements->at(i);
2945 Visit(stmt);
2946 }
2947 }
2948
2950 for (int i = 0; i < expressions->length(); i++) {
2951 // The variable statement visiting code may pass null expressions
2952 // to this code. Maybe this should be handled by introducing an
2953 // undefined expression or literal? Revisit this code if this
2954 // changes.
2955 Expression* expression = expressions->at(i);
2956 if (expression != nullptr) Visit(expression);
2957 }
2958 }
2959
2960 protected:
2961 Subclass* impl() { return static_cast<Subclass*>(this); }
2962};
2963
2964#define GENERATE_VISIT_CASE(NodeType) \
2965 case AstNode::k##NodeType: \
2966 return this->impl()->Visit##NodeType(static_cast<NodeType*>(node));
2967
2968#define GENERATE_FAILURE_CASE(NodeType) \
2969 case AstNode::k##NodeType: \
2970 UNREACHABLE();
2971
2972#define GENERATE_AST_VISITOR_SWITCH() \
2973 switch (node->node_type()) { \
2974 AST_NODE_LIST(GENERATE_VISIT_CASE) \
2975 FAILURE_NODE_LIST(GENERATE_FAILURE_CASE) \
2976 }
2977
2978#define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
2979 public: \
2980 void VisitNoStackOverflowCheck(AstNode* node) { \
2981 GENERATE_AST_VISITOR_SWITCH() \
2982 } \
2983 \
2984 void Visit(AstNode* node) { \
2985 if (CheckStackOverflow()) return; \
2986 VisitNoStackOverflowCheck(node); \
2987 } \
2988 \
2989 void SetStackOverflow() { stack_overflow_ = true; } \
2990 void ClearStackOverflow() { stack_overflow_ = false; } \
2991 bool HasStackOverflow() const { return stack_overflow_; } \
2992 \
2993 bool CheckStackOverflow() { \
2994 if (stack_overflow_) return true; \
2995 if (GetCurrentStackPosition() < stack_limit_) { \
2996 stack_overflow_ = true; \
2997 return true; \
2998 } \
2999 return false; \
3000 } \
3001 \
3002 protected: \
3003 uintptr_t stack_limit() const { return stack_limit_; } \
3004 \
3005 private: \
3006 void InitializeAstVisitor(Isolate* isolate) { \
3007 stack_limit_ = isolate->stack_guard()->real_climit(); \
3008 stack_overflow_ = false; \
3009 } \
3010 \
3011 void InitializeAstVisitor(uintptr_t stack_limit) { \
3012 stack_limit_ = stack_limit; \
3013 stack_overflow_ = false; \
3014 } \
3015 \
3016 uintptr_t stack_limit_; \
3017 bool stack_overflow_
3018
3019#define DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() \
3020 public: \
3021 void Visit(AstNode* node) { GENERATE_AST_VISITOR_SWITCH() } \
3022 \
3023 private:
3024
3025// ----------------------------------------------------------------------------
3026// AstNode factory
3027
3028class AstNodeFactory final {
3029 public:
3036
3039
3043
3048
3052
3053 Block* NewBlock(int capacity, bool ignore_completion_value) {
3054 return zone_->New<Block>(zone_, capacity, ignore_completion_value, false,
3055 false);
3056 }
3057
3058 Block* NewBlock(bool ignore_completion_value, bool is_breakable) {
3059 return zone_->New<Block>(ignore_completion_value, is_breakable, false);
3060 }
3061
3062 Block* NewBlock(bool ignore_completion_value,
3063 const ScopedPtrList<Statement>& statements) {
3064 Block* result = NewBlock(ignore_completion_value, false);
3065 result->InitializeStatements(statements, zone_);
3066 return result;
3067 }
3068
3070 const ScopedPtrList<Statement>& statements) {
3071 Block* result = zone_->New<Block>(
3072 /* ignore_completion_value */ true, /* is_breakable */ false,
3073 /* is_initialization_block_for_parameters */ true);
3074 result->InitializeStatements(statements, zone_);
3075 return result;
3076 }
3077
3078#define STATEMENT_WITH_POSITION(NodeType) \
3079 NodeType* New##NodeType(int pos) { return zone_->New<NodeType>(pos); }
3080 STATEMENT_WITH_POSITION(DoWhileStatement)
3081 STATEMENT_WITH_POSITION(WhileStatement)
3082 STATEMENT_WITH_POSITION(ForStatement)
3083#undef STATEMENT_WITH_POSITION
3084
3088
3090 int pos) {
3091 switch (visit_mode) {
3093 return zone_->New<ForInStatement>(pos);
3094 }
3097 }
3098 }
3099 UNREACHABLE();
3100 }
3101
3105
3109
3113
3117
3119 Expression* expression, int pos,
3122 pos, end_position);
3123 }
3124
3131
3138
3140 Expression* expression,
3142 int pos) {
3143 return zone_->New<WithStatement>(scope, expression, statement, pos);
3144 }
3145
3147 Statement* else_statement, int pos) {
3148 return zone_->New<IfStatement>(condition, then_statement, else_statement,
3149 pos);
3150 }
3151
3153 Block* catch_block, int pos) {
3154 return zone_->New<TryCatchStatement>(try_block, scope, catch_block,
3156 }
3157
3159 Scope* scope,
3160 Block* catch_block,
3161 int pos) {
3162 return zone_->New<TryCatchStatement>(try_block, scope, catch_block,
3164 }
3165
3167 Scope* scope,
3168 Block* catch_block,
3169 int pos) {
3170 return zone_->New<TryCatchStatement>(try_block, scope, catch_block,
3172 }
3173
3175 Scope* scope,
3176 Block* catch_block,
3177 int pos) {
3178 return zone_->New<TryCatchStatement>(
3179 try_block, scope, catch_block, HandlerTable::UNCAUGHT_ASYNC_AWAIT, pos);
3180 }
3181
3183 Block* finally_block, int pos) {
3184 return zone_->New<TryFinallyStatement>(try_block, finally_block, pos);
3185 }
3186
3190
3192 return empty_statement_;
3193 }
3194
3196 // Clear any previously set "parenthesized" flag on this_expression_ so this
3197 // particular token does not inherit the it. The flag is used to check
3198 // during arrow function head parsing whether we came from parenthesized
3199 // exprssion parsing, since additional arrow function verification was done
3200 // there. It does not matter whether a flag is unset after arrow head
3201 // verification, so clearing at this point is fine.
3203 return this_expression_;
3204 }
3205
3208 return zone_->New<class ThisExpression>(pos);
3209 }
3210
3214
3220
3222 const ScopedPtrList<Statement>& statements) {
3223 return zone_->New<CaseClause>(zone_, label, statements);
3224 }
3225
3227 DCHECK_NOT_NULL(string);
3228 return zone_->New<Literal>(string, pos);
3229 }
3230
3232 DCHECK_NOT_NULL(string);
3233 return zone_->New<Literal>(string, pos);
3234 }
3235
3236 Literal* NewNumberLiteral(double number, int pos);
3237
3238 Literal* NewSmiLiteral(int number, int pos) {
3239 return zone_->New<Literal>(number, pos);
3240 }
3241
3243 return zone_->New<Literal>(bigint, pos);
3244 }
3245
3247 return zone_->New<Literal>(b, pos);
3248 }
3249
3251 return zone_->New<Literal>(Literal::kNull, pos);
3252 }
3253
3257
3261
3264 uint32_t boilerplate_properties, int pos, bool has_rest_property,
3265 Variable* home_object = nullptr) {
3266 return zone_->New<ObjectLiteral>(zone_, properties, boilerplate_properties,
3267 pos, has_rest_property, home_object);
3268 }
3269
3272 bool is_computed_name) {
3274 is_computed_name);
3275 }
3276
3278 Expression* value,
3279 bool is_computed_name) {
3281 is_computed_name);
3282 }
3283
3285 int pos) {
3286 return zone_->New<RegExpLiteral>(pattern, flags, pos);
3287 }
3288
3290 int pos) {
3291 return zone_->New<ArrayLiteral>(zone_, values, -1, pos);
3292 }
3293
3295 int first_spread_index, int pos) {
3296 return zone_->New<ArrayLiteral>(zone_, values, first_spread_index, pos);
3297 }
3298
3300 int start_position = kNoSourcePosition) {
3301 return zone_->New<VariableProxy>(var, start_position);
3302 }
3303
3305 VariableKind variable_kind,
3306 int start_position = kNoSourcePosition) {
3307 DCHECK_NOT_NULL(name);
3308 return zone_->New<VariableProxy>(name, variable_kind, start_position);
3309 }
3310
3311 // Recreates the VariableProxy in this Zone.
3313 return zone_->New<VariableProxy>(proxy);
3314 }
3315
3317 return zone_->New<Variable>(variable);
3318 }
3319
3323
3325 bool optional_chain = false) {
3326 return zone_->New<Property>(obj, key, pos, optional_chain);
3327 }
3328
3330 const ScopedPtrList<Expression>& arguments, int pos,
3331 bool has_spread, int eval_scope_info_index = 0,
3332 bool optional_chain = false) {
3333 DCHECK_IMPLIES(eval_scope_info_index > 0, !optional_chain);
3334 return zone_->New<Call>(zone_, expression, arguments, pos, has_spread,
3335 eval_scope_info_index, optional_chain);
3336 }
3337
3342
3344 const ScopedPtrList<Expression>& arguments, int pos) {
3345 return zone_->New<Call>(zone_, expression, arguments, pos,
3347 }
3348
3350 const ScopedPtrList<Expression>& arguments, int pos,
3351 bool has_spread) {
3352 return zone_->New<CallNew>(zone_, expression, arguments, pos, has_spread);
3353 }
3354
3356 const ScopedPtrList<Expression>& arguments,
3357 int pos) {
3358 return zone_->New<CallRuntime>(zone_, Runtime::FunctionForId(id), arguments,
3359 pos);
3360 }
3361
3363 const ScopedPtrList<Expression>& arguments,
3364 int pos) {
3365 return zone_->New<CallRuntime>(zone_, function, arguments, pos);
3366 }
3367
3369 Expression* expression,
3370 int pos) {
3371 return zone_->New<UnaryOperation>(op, expression, pos);
3372 }
3373
3375 Expression* left,
3376 Expression* right,
3377 int pos) {
3378 return zone_->New<BinaryOperation>(op, left, right, pos);
3379 }
3380
3382 size_t initial_subsequent_size) {
3383 return zone_->New<NaryOperation>(zone_, op, first, initial_subsequent_size);
3384 }
3385
3387 bool is_prefix,
3388 Expression* expr,
3389 int pos) {
3390 return zone_->New<CountOperation>(op, is_prefix, expr, pos);
3391 }
3392
3394 Expression* left,
3395 Expression* right,
3396 int pos) {
3397 return zone_->New<CompareOperation>(op, left, right, pos);
3398 }
3399
3400 Spread* NewSpread(Expression* expression, int pos, int expr_pos) {
3401 return zone_->New<Spread>(expression, pos, expr_pos);
3402 }
3403
3404 ConditionalChain* NewConditionalChain(size_t initial_size, int pos) {
3405 return zone_->New<ConditionalChain>(zone_, initial_size, pos);
3406 }
3407
3409 Expression* then_expression,
3410 Expression* else_expression,
3411 int position) {
3412 return zone_->New<Conditional>(condition, then_expression, else_expression,
3413 position);
3414 }
3415
3417 Expression* target,
3418 Expression* value,
3419 int pos) {
3421 DCHECK_NOT_NULL(target);
3422 DCHECK_NOT_NULL(value);
3423
3424 if (op != Token::kInit && target->IsVariableProxy()) {
3425 target->AsVariableProxy()->set_is_assigned();
3426 }
3427
3428 if (op == Token::kAssign || op == Token::kInit) {
3429 return zone_->New<Assignment>(AstNode::kAssignment, op, target, value,
3430 pos);
3431 } else {
3432 return zone_->New<CompoundAssignment>(
3433 op, target, value, pos,
3435 pos + 1));
3436 }
3437 }
3438
3439 Suspend* NewYield(Expression* expression, int pos,
3440 Suspend::OnAbruptResume on_abrupt_resume) {
3441 if (!expression) expression = NewUndefinedLiteral(pos);
3442 return zone_->New<Yield>(expression, pos, on_abrupt_resume);
3443 }
3444
3446 return zone_->New<YieldStar>(expression, pos);
3447 }
3448
3449 Await* NewAwait(Expression* expression, int pos) {
3450 if (!expression) expression = NewUndefinedLiteral(pos);
3451 return zone_->New<Await>(expression, pos);
3452 }
3453
3454 Throw* NewThrow(Expression* exception, int pos) {
3455 return zone_->New<Throw>(exception, pos);
3456 }
3457
3459 const AstRawString* name, DeclarationScope* scope,
3460 const ScopedPtrList<Statement>& body, int expected_property_count,
3461 int parameter_count, int function_length,
3463 FunctionSyntaxKind function_syntax_kind,
3464 FunctionLiteral::EagerCompileHint eager_compile_hint, int position,
3465 bool has_braces, int function_literal_id,
3466 ProducedPreparseData* produced_preparse_data = nullptr) {
3467 return zone_->New<FunctionLiteral>(
3468 zone_, name ? ast_value_factory_->NewConsString(name) : nullptr,
3469 ast_value_factory_, scope, body, expected_property_count,
3470 parameter_count, function_length, function_syntax_kind,
3471 has_duplicate_parameters, eager_compile_hint, position, has_braces,
3472 function_literal_id, produced_preparse_data);
3473 }
3474
3475 // Creates a FunctionLiteral representing a top-level script, the
3476 // result of an eval (top-level or otherwise), or the result of calling
3477 // the Function constructor.
3489
3491 FunctionLiteral* generated_getter, FunctionLiteral* generated_setter,
3492 VariableProxy* accessor_storage_name_proxy) {
3493 return zone_->New<AutoAccessorInfo>(generated_getter, generated_setter,
3494 accessor_storage_name_proxy);
3495 }
3496
3499 bool is_static, bool is_computed_name, bool is_private) {
3500 return zone_->New<ClassLiteral::Property>(key, value, kind, is_static,
3501 is_computed_name, is_private);
3502 }
3504 Expression* key, Expression* value, AutoAccessorInfo* auto_accessor_info,
3505 bool is_static, bool is_computed_name, bool is_private) {
3506 return zone_->New<ClassLiteral::Property>(key, value, auto_accessor_info,
3507 is_static, is_computed_name,
3508 is_private);
3509 }
3510
3515
3517 Block* static_block) {
3518 return zone_->New<ClassLiteral::StaticElement>(static_block);
3519 }
3520
3522 ClassScope* scope, Expression* extends, FunctionLiteral* constructor,
3524 ZonePtrList<ClassLiteral::Property>* private_members,
3525 FunctionLiteral* static_initializer,
3526 FunctionLiteral* instance_members_initializer_function,
3527 int start_position, int end_position, bool has_static_computed_names,
3528 bool is_anonymous, Variable* home_object, Variable* static_home_object) {
3529 return zone_->New<ClassLiteral>(
3530 scope, extends, constructor, public_members, private_members,
3531 static_initializer, instance_members_initializer_function,
3532 start_position, end_position, has_static_computed_names, is_anonymous,
3533 home_object, static_home_object);
3534 }
3535
3541
3543 VariableProxy* home_object_var, int pos) {
3544 return zone_->New<SuperPropertyReference>(home_object_var, pos);
3545 }
3546
3548 VariableProxy* this_function_var,
3549 int pos) {
3550 return zone_->New<SuperCallReference>(new_target_var, this_function_var,
3551 pos);
3552 }
3553
3557
3559 const ZonePtrList<const AstRawString>* cooked_strings,
3560 const ZonePtrList<const AstRawString>* raw_strings, int pos) {
3561 return zone_->New<GetTemplateObject>(cooked_strings, raw_strings, pos);
3562 }
3563
3565 const ZonePtrList<const AstRawString>* string_parts,
3566 const ZonePtrList<Expression>* substitutions, int pos) {
3567 return zone_->New<TemplateLiteral>(string_parts, substitutions, pos);
3568 }
3569
3571 ModuleImportPhase phase,
3572 int pos) {
3573 return zone_->New<ImportCallExpression>(specifier, phase, pos);
3574 }
3575
3577 ModuleImportPhase phase,
3578 Expression* import_options,
3579 int pos) {
3580 return zone_->New<ImportCallExpression>(specifier, phase, import_options,
3581 pos);
3582 }
3583
3588
3594
3596 int pos) {
3597 return zone_->New<AutoAccessorGetterBody>(name_proxy, pos);
3598 }
3599
3601 int pos) {
3602 return zone_->New<AutoAccessorSetterBody>(name_proxy, pos);
3603 }
3604
3605 Zone* zone() const { return zone_; }
3606
3607 private:
3608 // This zone may be deallocated upon returning from parsing a function body
3609 // which we can guarantee is not going to be compiled or have its AST
3610 // inspected.
3611 // See ParseFunctionLiteral in parser.cc for preconditions.
3617};
3618
3619
3620// Type testing & conversion functions overridden by concrete subclasses.
3621// Inline functions for AstNode.
3622
3623#define DECLARE_NODE_FUNCTIONS(type) \
3624 bool AstNode::Is##type() const { return node_type() == AstNode::k##type; } \
3625 type* AstNode::As##type() { \
3626 return node_type() == AstNode::k##type ? reinterpret_cast<type*>(this) \
3627 : nullptr; \
3628 } \
3629 const type* AstNode::As##type() const { \
3630 return node_type() == AstNode::k##type \
3631 ? reinterpret_cast<const type*>(this) \
3632 : nullptr; \
3633 }
3636#undef DECLARE_NODE_FUNCTIONS
3637
3638} // namespace internal
3639} // namespace v8
3640
3641#endif // V8_AST_AST_H_
#define DEF_FORWARD_DECLARATION(type)
Definition ast.h:140
#define DECLARE_TYPE_ENUM(type)
Definition ast.h:147
#define STATEMENT_WITH_POSITION(NodeType)
Definition ast.h:3078
#define AST_NODE_LIST(V)
Definition ast.h:121
#define FAILURE_NODE_LIST(V)
Definition ast.h:119
#define DECLARE_NODE_FUNCTIONS(type)
Definition ast.h:162
int16_t parameter_count
Definition builtins.cc:67
Builtins::Kind kind
Definition builtins.cc:40
SourcePosition pos
static constexpr T decode(U value)
Definition bit-field.h:66
static constexpr U encode(T value)
Definition bit-field.h:55
static V8_NODISCARD constexpr U update(U previous, T value)
Definition bit-field.h:61
AggregateLiteral(int pos, NodeType type)
Definition ast.h:1142
ArrayLiteralBoilerplateBuilder(const ZonePtrList< Expression > *values, int first_spread_index)
Definition ast.h:1437
DirectHandle< ArrayBoilerplateDescription > boilerplate_description() const
Definition ast.h:1440
const ZonePtrList< Expression > * values_
Definition ast.h:1471
IndirectHandle< ArrayBoilerplateDescription > boilerplate_description_
Definition ast.h:1473
int ComputeFlags(bool disable_mementos=false) const
Definition ast.h:1448
void BuildBoilerplateDescription(IsolateT *isolate)
Definition ast.cc:662
Handle< ArrayBoilerplateDescription > GetOrBuildBoilerplateDescription(IsolateT *isolate)
Definition ast.h:1459
const ArrayLiteralBoilerplateBuilder * builder() const
Definition ast.h:1482
ArrayLiteralBoilerplateBuilder builder_
Definition ast.h:1496
ArrayLiteral(Zone *zone, const ScopedPtrList< Expression > &values, int first_spread_index, int pos)
Definition ast.h:1489
ArrayLiteralBoilerplateBuilder * builder()
Definition ast.h:1483
const ZonePtrList< Expression > * values() const
Definition ast.h:1480
ZonePtrList< Expression > values_
Definition ast.h:1495
Token::Value op() const
Definition ast.h:2169
void set_lookup_hoisting_mode(LookupHoistingMode mode)
Definition ast.h:2180
Expression * target() const
Definition ast.h:2170
Expression * target_
Definition ast.h:2196
Expression * value_
Definition ast.h:2197
Expression * value() const
Definition ast.h:2171
LookupHoistingMode lookup_hoisting_mode() const
Definition ast.h:2176
Assignment(NodeType type, Token::Value op, Expression *target, Expression *value, int pos)
Definition ast.cc:181
IndirectHandle< String > GetString(IsolateT *isolate)
Variable * CopyVariable(Variable *variable)
Definition ast.h:3316
FunctionLiteral * NewFunctionLiteral(const AstRawString *name, DeclarationScope *scope, const ScopedPtrList< Statement > &body, int expected_property_count, int parameter_count, int function_length, FunctionLiteral::ParameterFlag has_duplicate_parameters, FunctionSyntaxKind function_syntax_kind, FunctionLiteral::EagerCompileHint eager_compile_hint, int position, bool has_braces, int function_literal_id, ProducedPreparseData *produced_preparse_data=nullptr)
Definition ast.h:3458
Block * NewBlock(bool ignore_completion_value, bool is_breakable)
Definition ast.h:3058
ImportCallExpression * NewImportCallExpression(Expression *specifier, ModuleImportPhase phase, int pos)
Definition ast.h:3570
AstValueFactory * ast_value_factory_
Definition ast.h:3613
SuperCallForwardArgs * NewSuperCallForwardArgs(SuperCallReference *expression, int pos)
Definition ast.h:3338
Conditional * NewConditional(Expression *condition, Expression *then_expression, Expression *else_expression, int position)
Definition ast.h:3408
Literal * NewStringLiteral(const AstRawString *string, int pos)
Definition ast.h:3226
Await * NewAwait(Expression *expression, int pos)
Definition ast.h:3449
Block * NewParameterInitializationBlock(const ScopedPtrList< Statement > &statements)
Definition ast.h:3069
FunctionDeclaration * NewFunctionDeclaration(FunctionLiteral *fun, int pos)
Definition ast.h:3049
ClassLiteral::Property * NewClassLiteralProperty(Expression *key, Expression *value, ClassLiteralProperty::Kind kind, bool is_static, bool is_computed_name, bool is_private)
Definition ast.h:3497
BreakStatement * NewBreakStatement(BreakableStatement *target, int pos)
Definition ast.h:3114
Call * NewTaggedTemplate(Expression *expression, const ScopedPtrList< Expression > &arguments, int pos)
Definition ast.h:3343
Throw * NewThrow(Expression *exception, int pos)
Definition ast.h:3454
WithStatement * NewWithStatement(Scope *scope, Expression *expression, Statement *statement, int pos)
Definition ast.h:3139
class FailureExpression * FailureExpression()
Definition ast.h:3211
GetTemplateObject * NewGetTemplateObject(const ZonePtrList< const AstRawString > *cooked_strings, const ZonePtrList< const AstRawString > *raw_strings, int pos)
Definition ast.h:3558
ReturnStatement * NewAsyncReturnStatement(Expression *expression, int pos, int end_position=ReturnStatement::kFunctionLiteralReturnPosition)
Definition ast.h:3125
class FailureExpression * failure_expression_
Definition ast.h:3616
class EmptyStatement * EmptyStatement()
Definition ast.h:3191
TryCatchStatement * NewTryCatchStatement(Block *try_block, Scope *scope, Block *catch_block, int pos)
Definition ast.h:3152
NestedVariableDeclaration * NewNestedVariableDeclaration(Scope *scope, int pos)
Definition ast.h:3044
VariableProxy * CopyVariableProxy(VariableProxy *proxy)
Definition ast.h:3312
SloppyBlockFunctionStatement * NewSloppyBlockFunctionStatement(int pos, Variable *var, Token::Value init)
Definition ast.h:3215
TryCatchStatement * NewTryCatchStatementForReplAsyncAwait(Block *try_block, Scope *scope, Block *catch_block, int pos)
Definition ast.h:3174
ClassLiteral::Property * NewClassLiteralProperty(Expression *key, Expression *value, AutoAccessorInfo *auto_accessor_info, bool is_static, bool is_computed_name, bool is_private)
Definition ast.h:3503
Property * NewProperty(Expression *obj, Expression *key, int pos, bool optional_chain=false)
Definition ast.h:3324
ClassLiteral * NewClassLiteral(ClassScope *scope, Expression *extends, FunctionLiteral *constructor, ZonePtrList< ClassLiteral::Property > *public_members, ZonePtrList< ClassLiteral::Property > *private_members, FunctionLiteral *static_initializer, FunctionLiteral *instance_members_initializer_function, int start_position, int end_position, bool has_static_computed_names, bool is_anonymous, Variable *home_object, Variable *static_home_object)
Definition ast.h:3521
ObjectLiteral::Property * NewObjectLiteralProperty(Expression *key, Expression *value, bool is_computed_name)
Definition ast.h:3277
RegExpLiteral * NewRegExpLiteral(const AstRawString *pattern, int flags, int pos)
Definition ast.h:3284
AutoAccessorSetterBody * NewAutoAccessorSetterBody(VariableProxy *name_proxy, int pos)
Definition ast.h:3600
ClassLiteral::StaticElement * NewClassLiteralStaticElement(ClassLiteral::Property *property)
Definition ast.h:3511
DebuggerStatement * NewDebuggerStatement(int pos)
Definition ast.h:3187
ForEachStatement * NewForEachStatement(ForEachStatement::VisitMode visit_mode, int pos)
Definition ast.h:3089
CallRuntime * NewCallRuntime(Runtime::FunctionId id, const ScopedPtrList< Expression > &arguments, int pos)
Definition ast.h:3355
ContinueStatement * NewContinueStatement(IterationStatement *target, int pos)
Definition ast.h:3110
SuperCallReference * NewSuperCallReference(VariableProxy *new_target_var, VariableProxy *this_function_var, int pos)
Definition ast.h:3547
BinaryOperation * NewBinaryOperation(Token::Value op, Expression *left, Expression *right, int pos)
Definition ast.h:3374
EmptyParentheses * NewEmptyParentheses(int pos)
Definition ast.h:3554
ArrayLiteral * NewArrayLiteral(const ScopedPtrList< Expression > &values, int first_spread_index, int pos)
Definition ast.h:3294
Literal * NewNullLiteral(int pos)
Definition ast.h:3250
class ThisExpression * NewThisExpression(int pos)
Definition ast.h:3206
ReturnStatement * NewReturnStatement(Expression *expression, int pos, int end_position=ReturnStatement::kFunctionLiteralReturnPosition)
Definition ast.h:3118
InitializeClassMembersStatement * NewInitializeClassMembersStatement(ZonePtrList< ClassLiteral::Property > *args, int pos)
Definition ast.h:3584
IfStatement * NewIfStatement(Expression *condition, Statement *then_statement, Statement *else_statement, int pos)
Definition ast.h:3146
SwitchStatement * NewSwitchStatement(Expression *tag, int pos)
Definition ast.h:3085
Assignment * NewAssignment(Token::Value op, Expression *target, Expression *value, int pos)
Definition ast.h:3416
Suspend * NewYield(Expression *expression, int pos, Suspend::OnAbruptResume on_abrupt_resume)
Definition ast.h:3439
class ThisExpression * ThisExpression()
Definition ast.h:3195
Block * NewBlock(bool ignore_completion_value, const ScopedPtrList< Statement > &statements)
Definition ast.h:3062
ForOfStatement * NewForOfStatement(int pos, IteratorType type)
Definition ast.h:3102
ImportCallExpression * NewImportCallExpression(Expression *specifier, ModuleImportPhase phase, Expression *import_options, int pos)
Definition ast.h:3576
AutoAccessorGetterBody * NewAutoAccessorGetterBody(VariableProxy *name_proxy, int pos)
Definition ast.h:3595
Literal * NewUndefinedLiteral(int pos)
Definition ast.h:3254
AstNodeFactory(AstValueFactory *ast_value_factory, Zone *zone)
Definition ast.h:3030
InitializeClassStaticElementsStatement * NewInitializeClassStaticElementsStatement(ZonePtrList< ClassLiteral::StaticElement > *args, int pos)
Definition ast.h:3590
ObjectLiteral::Property * NewObjectLiteralProperty(Expression *key, Expression *value, ObjectLiteralProperty::Kind kind, bool is_computed_name)
Definition ast.h:3270
TryCatchStatement * NewTryCatchStatementForReThrow(Block *try_block, Scope *scope, Block *catch_block, int pos)
Definition ast.h:3158
CaseClause * NewCaseClause(Expression *label, const ScopedPtrList< Statement > &statements)
Definition ast.h:3221
VariableDeclaration * NewVariableDeclaration(int pos)
Definition ast.h:3040
VariableProxy * NewVariableProxy(Variable *var, int start_position=kNoSourcePosition)
Definition ast.h:3299
Literal * NewBooleanLiteral(bool b, int pos)
Definition ast.h:3246
AstValueFactory * ast_value_factory() const
Definition ast.h:3038
TryFinallyStatement * NewTryFinallyStatement(Block *try_block, Block *finally_block, int pos)
Definition ast.h:3182
Call * NewCall(Expression *expression, const ScopedPtrList< Expression > &arguments, int pos, bool has_spread, int eval_scope_info_index=0, bool optional_chain=false)
Definition ast.h:3329
TryCatchStatement * NewTryCatchStatementForAsyncAwait(Block *try_block, Scope *scope, Block *catch_block, int pos)
Definition ast.h:3166
UnaryOperation * NewUnaryOperation(Token::Value op, Expression *expression, int pos)
Definition ast.h:3368
CompareOperation * NewCompareOperation(Token::Value op, Expression *left, Expression *right, int pos)
Definition ast.h:3393
CallRuntime * NewCallRuntime(const Runtime::Function *function, const ScopedPtrList< Expression > &arguments, int pos)
Definition ast.h:3362
Literal * NewConsStringLiteral(AstConsString *string, int pos)
Definition ast.h:3231
Literal * NewNumberLiteral(double number, int pos)
Definition ast.cc:1141
AutoAccessorInfo * NewAutoAccessorInfo(FunctionLiteral *generated_getter, FunctionLiteral *generated_setter, VariableProxy *accessor_storage_name_proxy)
Definition ast.h:3490
Zone * zone() const
Definition ast.h:3605
ArrayLiteral * NewArrayLiteral(const ScopedPtrList< Expression > &values, int pos)
Definition ast.h:3289
VariableProxy * NewVariableProxy(const AstRawString *name, VariableKind variable_kind, int start_position=kNoSourcePosition)
Definition ast.h:3304
YieldStar * NewYieldStar(Expression *expression, int pos)
Definition ast.h:3445
Literal * NewSmiLiteral(int number, int pos)
Definition ast.h:3238
AstNodeFactory * ast_node_factory()
Definition ast.h:3037
FunctionLiteral * NewScriptOrEvalFunctionLiteral(DeclarationScope *scope, const ScopedPtrList< Statement > &body, int expected_property_count, int parameter_count)
Definition ast.h:3478
CallNew * NewCallNew(Expression *expression, const ScopedPtrList< Expression > &arguments, int pos, bool has_spread)
Definition ast.h:3349
Literal * NewBigIntLiteral(AstBigInt bigint, int pos)
Definition ast.h:3242
class EmptyStatement * empty_statement_
Definition ast.h:3614
SuperPropertyReference * NewSuperPropertyReference(VariableProxy *home_object_var, int pos)
Definition ast.h:3542
TemplateLiteral * NewTemplateLiteral(const ZonePtrList< const AstRawString > *string_parts, const ZonePtrList< Expression > *substitutions, int pos)
Definition ast.h:3564
Spread * NewSpread(Expression *expression, int pos, int expr_pos)
Definition ast.h:3400
OptionalChain * NewOptionalChain(Expression *expression)
Definition ast.h:3320
Block * NewBlock(int capacity, bool ignore_completion_value)
Definition ast.h:3053
ReturnStatement * NewSyntheticAsyncReturnStatement(Expression *expression, int pos, int end_position=ReturnStatement::kFunctionLiteralReturnPosition)
Definition ast.h:3132
ObjectLiteral * NewObjectLiteral(const ScopedPtrList< ObjectLiteral::Property > &properties, uint32_t boilerplate_properties, int pos, bool has_rest_property, Variable *home_object=nullptr)
Definition ast.h:3262
NativeFunctionLiteral * NewNativeFunctionLiteral(const AstRawString *name, v8::Extension *extension, int pos)
Definition ast.h:3536
class ThisExpression * this_expression_
Definition ast.h:3615
CountOperation * NewCountOperation(Token::Value op, bool is_prefix, Expression *expr, int pos)
Definition ast.h:3386
ExpressionStatement * NewExpressionStatement(Expression *expression, int pos)
Definition ast.h:3106
NaryOperation * NewNaryOperation(Token::Value op, Expression *first, size_t initial_subsequent_size)
Definition ast.h:3381
ClassLiteral::StaticElement * NewClassLiteralStaticElement(Block *static_block)
Definition ast.h:3516
Literal * NewTheHoleLiteral()
Definition ast.h:3258
ConditionalChain * NewConditionalChain(size_t initial_size, int pos)
Definition ast.h:3404
AstNode(int position, NodeType type)
Definition ast.h:183
uint32_t bit_field_
Definition ast.h:178
MaterializedLiteral * AsMaterializedLiteral()
Definition ast.cc:57
int position() const
Definition ast.h:155
NodeType node_type() const
Definition ast.h:154
IterationStatement * AsIterationStatement()
Definition ast.cc:49
AstConsString * empty_cons_string() const
V8_EXPORT_PRIVATE AstConsString * NewConsString()
Subclass * impl()
Definition ast.h:2961
void VisitStatements(const ZonePtrList< Statement > *statements)
Definition ast.h:2942
void Visit(AstNode *node)
Definition ast.h:2936
void VisitDeclarations(Declaration::List *declarations)
Definition ast.h:2938
void VisitExpressions(const ZonePtrList< Expression > *expressions)
Definition ast.h:2949
VariableProxy * name_proxy() const
Definition ast.h:2677
AutoAccessorGetterBody(VariableProxy *name_proxy, int pos)
Definition ast.h:2683
void set_property_private_name_proxy(VariableProxy *property_private_name_proxy)
Definition ast.h:2513
VariableProxy * accessor_storage_name_proxy_
Definition ast.h:2536
FunctionLiteral * generated_getter() const
Definition ast.h:2502
FunctionLiteral * generated_setter() const
Definition ast.h:2503
FunctionLiteral * generated_getter_
Definition ast.h:2532
VariableProxy * property_private_name_proxy_
Definition ast.h:2539
VariableProxy * property_private_name_proxy() const
Definition ast.h:2508
VariableProxy * accessor_storage_name_proxy() const
Definition ast.h:2504
FunctionLiteral * generated_setter_
Definition ast.h:2533
AutoAccessorInfo(FunctionLiteral *generated_getter, FunctionLiteral *generated_setter, VariableProxy *accessor_storage_name_proxy)
Definition ast.h:2524
AutoAccessorSetterBody(VariableProxy *name_proxy, int pos)
Definition ast.h:2696
VariableProxy * name_proxy() const
Definition ast.h:2690
Await(Expression *expression, int pos)
Definition ast.h:2279
Token::Value op() const
Definition ast.h:1916
Expression * right() const
Definition ast.h:1918
Expression * left() const
Definition ast.h:1917
bool IsSmiLiteralOperation(Expression **subexpr, Tagged< Smi > *literal)
Definition ast.cc:875
BinaryOperation(Token::Value op, Expression *left, Expression *right, int pos)
Definition ast.h:1928
void InitializeStatements(const ScopedPtrList< Statement > &statements, Zone *zone)
Definition ast.h:335
bool ignore_completion_value() const
Definition ast.h:324
void set_scope(Scope *scope)
Definition ast.h:333
Scope * scope() const
Definition ast.h:332
Block(bool ignore_completion_value, bool is_breakable, bool is_initialization_block_for_parameters)
Definition ast.h:365
Scope * scope_
Definition ast.h:346
Block(Zone *zone, int capacity, bool ignore_completion_value, bool is_breakable, bool is_initialization_block_for_parameters)
Definition ast.h:354
bool is_breakable() const
Definition ast.h:327
ZonePtrList< Statement > * statements()
Definition ast.h:323
ZonePtrList< Statement > statements_
Definition ast.h:345
bool is_initialization_block_for_parameters() const
Definition ast.h:328
BreakableStatement * target() const
Definition ast.h:640
BreakStatement(BreakableStatement *target, int pos)
Definition ast.h:646
BreakableStatement * target_
Definition ast.h:649
BreakableStatement(int position, NodeType type)
Definition ast.h:318
SpreadPosition spread_position() const
Definition ast.h:1739
void ComputeSpreadPosition()
Definition ast.cc:961
Expression * expression_
Definition ast.h:1765
CallBase(Zone *zone, NodeType type, Expression *expression, const ScopedPtrList< Expression > &arguments, int pos, bool has_spread)
Definition ast.h:1744
const ZonePtrList< Expression > * arguments() const
Definition ast.h:1736
ZonePtrList< Expression > arguments_
Definition ast.h:1766
Expression * expression() const
Definition ast.h:1735
CallNew(Zone *zone, Expression *expression, const ScopedPtrList< Expression > &arguments, int pos, bool has_spread)
Definition ast.h:1845
CallRuntime(Zone *zone, const Runtime::Function *function, const ScopedPtrList< Expression > &arguments, int pos)
Definition ast.h:1880
ZonePtrList< Expression > arguments_
Definition ast.h:1889
const ZonePtrList< Expression > * arguments() const
Definition ast.h:1873
const Runtime::Function * function_
Definition ast.h:1888
const Runtime::Function * function() const
Definition ast.h:1874
bool is_optional_chain_link() const
Definition ast.h:1779
bool is_tagged_template() const
Definition ast.h:1775
bool is_possibly_eval() const
Definition ast.h:1771
CallType GetCallType() const
Definition ast.cc:977
Call(Zone *zone, Expression *expression, const ScopedPtrList< Expression > &arguments, int pos, bool has_spread, int eval_scope_info_index, bool optional_chain)
Definition ast.h:1816
@ PRIVATE_OPTIONAL_CHAIN_CALL
Definition ast.h:1802
@ KEYED_OPTIONAL_CHAIN_PROPERTY_CALL
Definition ast.h:1798
@ NAMED_SUPER_PROPERTY_CALL
Definition ast.h:1799
@ KEYED_SUPER_PROPERTY_CALL
Definition ast.h:1800
@ NAMED_OPTIONAL_CHAIN_PROPERTY_CALL
Definition ast.h:1797
Call(Zone *zone, Expression *expression, const ScopedPtrList< Expression > &arguments, int pos, TaggedTemplateTag tag)
Definition ast.h:1826
void adjust_eval_scope_info_index(int delta)
Definition ast.h:1787
uint32_t eval_scope_info_index() const
Definition ast.h:1783
CaseClause(Zone *zone, Expression *label, const ScopedPtrList< Statement > &statements)
Definition ast.cc:1021
Expression * label() const
Definition ast.h:715
ZonePtrList< Statement > * statements()
Definition ast.h:719
Expression * label_
Definition ast.h:728
ZonePtrList< Statement > statements_
Definition ast.h:729
bool is_default() const
Definition ast.h:714
void set_computed_name_proxy(VariableProxy *proxy)
Definition ast.h:2556
VariableProxy * private_or_computed_name_proxy_
Definition ast.h:2602
Variable * computed_name_var() const
Definition ast.h:2562
Variable * private_name_var() const
Definition ast.h:2576
AutoAccessorInfo * auto_accessor_info()
Definition ast.h:2582
AutoAccessorInfo * auto_accessor_info_
Definition ast.h:2603
ClassLiteralProperty(Expression *key, Expression *value, Kind kind, bool is_static, bool is_computed_name, bool is_private)
Definition ast.cc:304
void SetPrivateNameProxy(VariableProxy *proxy)
Definition ast.h:2568
ClassLiteralProperty * property_
Definition ast.h:2636
ClassLiteralStaticElement(Block *static_block)
Definition ast.h:2630
ClassLiteralStaticElement(ClassLiteralProperty *property)
Definition ast.h:2627
ClassLiteralProperty * property() const
Definition ast.h:2613
Variable * static_home_object_
Definition ast.h:2774
bool has_static_computed_names() const
Definition ast.h:2713
Variable * home_object_
Definition ast.h:2773
ZonePtrList< Property > * private_members_
Definition ast.h:2768
FunctionLiteral * constructor_
Definition ast.h:2766
Variable * static_home_object() const
Definition ast.h:2732
int end_position() const
Definition ast.h:2712
ClassLiteral(ClassScope *scope, Expression *extends, FunctionLiteral *constructor, ZonePtrList< Property > *public_members, ZonePtrList< Property > *private_members, FunctionLiteral *static_initializer, FunctionLiteral *instance_members_initializer_function, int start_position, int end_position, bool has_static_computed_names, bool is_anonymous, Variable *home_object, Variable *static_home_object)
Definition ast.h:2738
int start_position() const
Definition ast.h:2711
FunctionLiteral * static_initializer_
Definition ast.h:2769
ZonePtrList< Property > * public_members() const
Definition ast.h:2709
FunctionLiteral * instance_members_initializer_function() const
Definition ast.h:2726
bool IsAnonymousFunctionDefinition() const
Definition ast.h:2720
ClassScope * scope_
Definition ast.h:2764
ZonePtrList< Property > * private_members() const
Definition ast.h:2710
Variable * home_object() const
Definition ast.h:2730
ClassScope * scope() const
Definition ast.h:2706
Expression * extends() const
Definition ast.h:2707
FunctionLiteral * instance_members_initializer_function_
Definition ast.h:2770
ZonePtrList< Property > * public_members_
Definition ast.h:2767
FunctionLiteral * static_initializer() const
Definition ast.h:2724
FunctionLiteral * constructor() const
Definition ast.h:2708
Expression * extends_
Definition ast.h:2765
bool is_anonymous_expression() const
Definition ast.h:2717
Token::Value op() const
Definition ast.h:2027
bool IsLiteralCompareEqualVariable(Expression **expr, Literal **literal)
Definition ast.cc:954
Expression * left() const
Definition ast.h:2028
bool IsLiteralStrictCompareBoolean(Expression **expr, Literal **literal)
Definition ast.cc:900
CompareOperation(Token::Value op, Expression *left, Expression *right, int pos)
Definition ast.h:2041
bool IsLiteralCompareUndefined(Expression **expr)
Definition ast.cc:921
bool IsLiteralCompareNull(Expression **expr)
Definition ast.cc:936
Expression * right() const
Definition ast.h:2029
BinaryOperation * binary_operation() const
Definition ast.h:2202
CompoundAssignment(Token::Value op, Expression *target, Expression *value, int pos, BinaryOperation *binary_operation)
Definition ast.h:2208
BinaryOperation * binary_operation_
Definition ast.h:2213
ConditionalChain(Zone *zone, size_t initial_size, int pos)
Definition ast.h:2099
int condition_position_at(size_t index) const
Definition ast.h:2082
Expression * else_expression() const
Definition ast.h:2088
Expression * condition_at(size_t index) const
Definition ast.h:2076
size_t conditional_chain_length() const
Definition ast.h:2085
void set_else_expression(Expression *s)
Definition ast.h:2089
void AddChainEntry(Expression *cond, Expression *then, int pos)
Definition ast.h:2091
ZoneVector< ConditionalChainEntry > conditional_chain_entries_
Definition ast.h:2141
Expression * then_expression_at(size_t index) const
Definition ast.h:2079
Expression * else_expression_
Definition ast.h:2142
Expression * else_expression_
Definition ast.h:2164
Expression * then_expression() const
Definition ast.h:2148
Expression * condition_
Definition ast.h:2162
Expression * condition() const
Definition ast.h:2147
Expression * then_expression_
Definition ast.h:2163
Conditional(Expression *condition, Expression *then_expression, Expression *else_expression, int position)
Definition ast.h:2155
Expression * else_expression() const
Definition ast.h:2149
IterationStatement * target_
Definition ast.h:634
IterationStatement * target() const
Definition ast.h:625
ContinueStatement(IterationStatement *target, int pos)
Definition ast.h:631
Expression * expression_
Definition ast.h:2021
bool is_prefix() const
Definition ast.h:2002
CountOperation(Token::Value op, bool is_prefix, Expression *expr, int pos)
Definition ast.h:2013
bool is_postfix() const
Definition ast.h:2003
Expression * expression() const
Definition ast.h:2007
Token::Value op() const
Definition ast.h:2005
Variable * var() const
Definition ast.h:375
Declaration(int pos, NodeType type)
Definition ast.h:379
void set_var(Variable *var)
Definition ast.h:376
Declaration ** next()
Definition ast.h:384
Declaration * next_
Definition ast.h:385
void Initialize(Expression *cond, Statement *body)
Definition ast.h:466
Expression * cond() const
Definition ast.h:471
Expression * expression() const
Definition ast.h:604
void set_expression(Expression *e)
Definition ast.h:603
ExpressionStatement(Expression *expression, int pos)
Definition ast.h:610
bool ToBooleanIsFalse() const
Definition ast.cc:126
bool IsUndefinedLiteral() const
Definition ast.cc:106
bool IsAccessorFunctionDefinition() const
Definition ast.cc:150
bool IsBooleanLiteral() const
Definition ast.cc:91
bool is_parenthesized() const
Definition ast.h:272
bool IsValidReferenceExpression() const
Definition ast.cc:134
bool IsPrivateName() const
Definition ast.cc:130
bool IsNullOrUndefinedLiteral() const
Definition ast.h:258
bool IsAnonymousFunctionDefinition() const
Definition ast.cc:139
void clear_parenthesized()
Definition ast.h:280
void mark_parenthesized()
Definition ast.h:276
bool IsCompileTimeValue()
Definition ast.cc:99
V8_EXPORT_PRIVATE bool IsNumberLiteral() const
Definition ast.cc:71
Expression(int pos, NodeType type)
Definition ast.h:288
bool IsStringLiteral() const
Definition ast.cc:75
bool IsConsStringLiteral() const
Definition ast.cc:79
bool ToBooleanIsTrue() const
Definition ast.cc:122
bool IsTheHoleLiteral() const
Definition ast.cc:95
bool IsNullLiteral() const
Definition ast.cc:87
bool IsLiteralButNotNullOrUndefined() const
Definition ast.cc:118
bool IsSmiLiteral() const
Definition ast.cc:67
bool IsConciseMethodDefinition() const
Definition ast.cc:146
bool IsPropertyName() const
Definition ast.cc:83
void Initialize(Expression *each, Expression *subject, Statement *body, Scope *subject_scope)
Definition ast.h:547
Expression * each() const
Definition ast.h:555
static const char * VisitModeString(VisitMode mode)
Definition ast.h:543
ForEachStatement(int pos, NodeType type)
Definition ast.h:567
Scope * subject_scope() const
Definition ast.h:561
Expression * subject() const
Definition ast.h:556
IteratorType type() const
Definition ast.h:589
ForOfStatement(int pos, IteratorType type)
Definition ast.h:595
Expression * cond_
Definition ast.h:529
Statement * init() const
Definition ast.h:514
Statement * next_
Definition ast.h:530
void Initialize(Statement *init, Expression *cond, Statement *next, Statement *body)
Definition ast.h:506
Expression * cond() const
Definition ast.h:515
Statement * init_
Definition ast.h:528
Statement * next() const
Definition ast.h:516
FunctionDeclaration(FunctionLiteral *fun, int pos)
Definition ast.h:442
FunctionLiteral * fun_
Definition ast.h:445
FunctionLiteral * fun() const
Definition ast.h:436
void set_raw_name(const AstConsString *name)
Definition ast.h:2314
FunctionSyntaxKind syntax_kind() const
Definition ast.h:2390
bool has_shared_name() const
Definition ast.h:2312
FunctionKind kind() const
Definition ast.cc:231
int function_literal_id() const
Definition ast.h:2408
bool IsAnonymousFunctionDefinition() const
Definition ast.h:2395
int function_token_position() const
Definition ast.h:2318
V8_EXPORT_PRIVATE void SetShouldEagerCompile()
Definition ast.cc:213
void add_expected_properties(int number_properties)
Definition ast.h:2330
void set_raw_inferred_name(AstConsString *raw_inferred_name)
Definition ast.cc:187
bool has_duplicate_parameters() const
Definition ast.h:2369
Handle< SharedFunctionInfo > shared_function_info() const
Definition ast.h:2356
void set_class_scope_has_private_brand(bool value)
Definition ast.cc:272
V8_EXPORT_PRIVATE LanguageMode language_mode() const
Definition ast.cc:227
ZonePtrList< Statement > * body()
Definition ast.h:2316
DeclarationScope * scope_
Definition ast.h:2493
void set_requires_instance_members_initializer(bool value)
Definition ast.h:2413
ProducedPreparseData * produced_preparse_data_
Definition ast.h:2497
const AstConsString * raw_name_
Definition ast.h:2492
MaybeHandle< String > GetName(IsolateT *isolate) const
Definition ast.h:2309
ZonePtrList< Statement > body_
Definition ast.h:2494
const AstConsString * raw_inferred_name()
Definition ast.h:2362
FunctionLiteral(Zone *zone, const AstConsString *name, AstValueFactory *ast_value_factory, DeclarationScope *scope, const ScopedPtrList< Statement > &body, int expected_property_count, int parameter_count, int function_length, FunctionSyntaxKind function_syntax_kind, ParameterFlag has_duplicate_parameters, EagerCompileHint eager_compile_hint, int position, bool has_braces, int function_literal_id, ProducedPreparseData *produced_preparse_data=nullptr)
Definition ast.h:2441
void set_function_literal_id(int function_literal_id)
Definition ast.h:2409
int start_position() const
Definition ast.cc:221
AstConsString * raw_inferred_name_
Definition ast.h:2495
bool has_static_private_methods_or_accessors() const
Definition ast.h:2424
IndirectHandle< SharedFunctionInfo > shared_function_info_
Definition ast.h:2496
ProducedPreparseData * produced_preparse_data() const
Definition ast.h:2433
bool class_scope_has_private_brand() const
Definition ast.cc:268
bool is_anonymous_expression() const
Definition ast.h:2321
Handle< String > GetInferredName(LocalIsolate *isolate) const
Definition ast.h:2351
bool private_name_lookup_skips_outer_class() const
Definition ast.cc:264
Handle< String > GetInferredName(Isolate *isolate)
Definition ast.cc:194
const AstConsString * raw_name() const
Definition ast.h:2313
bool requires_instance_members_initializer() const
Definition ast.h:2416
void set_suspend_count(int suspend_count)
Definition ast.h:2400
bool should_parallel_compile() const
Definition ast.h:2375
DeclarationScope * scope() const
Definition ast.h:2315
V8_EXPORT_PRIVATE bool ShouldEagerCompile() const
Definition ast.cc:209
void set_function_token_position(int pos)
Definition ast.h:2317
void set_has_static_private_methods_or_accessors(bool value)
Definition ast.h:2420
bool is_toplevel() const
Definition ast.h:2325
std::unique_ptr< char[]> GetDebugName() const
Definition ast.cc:233
void set_shared_function_info(Handle< SharedFunctionInfo > shared_function_info)
Definition ast.cc:202
const ZonePtrList< const AstRawString > * cooked_strings_
Definition ast.h:2902
const ZonePtrList< const AstRawString > * raw_strings() const
Definition ast.h:2885
Handle< TemplateObjectDescription > GetOrBuildDescription(IsolateT *isolate)
const ZonePtrList< const AstRawString > * cooked_strings() const
Definition ast.h:2882
const ZonePtrList< const AstRawString > * raw_strings_
Definition ast.h:2903
GetTemplateObject(const ZonePtrList< const AstRawString > *cooked_strings, const ZonePtrList< const AstRawString > *raw_strings, int pos)
Definition ast.h:2896
Statement * then_statement() const
Definition ast.h:763
Statement * else_statement_
Definition ast.h:782
void set_else_statement(Statement *s)
Definition ast.h:767
Statement * else_statement() const
Definition ast.h:764
Expression * condition_
Definition ast.h:780
bool HasThenStatement() const
Definition ast.h:759
bool HasElseStatement() const
Definition ast.h:760
Statement * then_statement_
Definition ast.h:781
IfStatement(Expression *condition, Statement *then_statement, Statement *else_statement, int pos)
Definition ast.h:773
Expression * condition() const
Definition ast.h:762
void set_then_statement(Statement *s)
Definition ast.h:766
ModuleImportPhase phase() const
Definition ast.h:2841
Expression * specifier() const
Definition ast.h:2840
ModuleImportPhase phase_
Definition ast.h:2862
ImportCallExpression(Expression *specifier, ModuleImportPhase phase, Expression *import_options, int pos)
Definition ast.h:2854
Expression * import_options() const
Definition ast.h:2842
ImportCallExpression(Expression *specifier, ModuleImportPhase phase, int pos)
Definition ast.h:2848
ZonePtrList< Property > * fields_
Definition ast.h:2654
InitializeClassMembersStatement(ZonePtrList< Property > *fields, int pos)
Definition ast.h:2651
ZonePtrList< Property > * fields() const
Definition ast.h:2645
ZonePtrList< StaticElement > * elements() const
Definition ast.h:2661
ZonePtrList< StaticElement > * elements_
Definition ast.h:2672
InitializeClassStaticElementsStatement(ZonePtrList< StaticElement > *elements, int pos)
Definition ast.h:2667
IterationStatement(int pos, NodeType type)
Definition ast.h:455
void Initialize(Statement *body)
Definition ast.h:457
void set_body(Statement *s)
Definition ast.h:452
Statement * body() const
Definition ast.h:451
JumpStatement(int pos, NodeType type)
Definition ast.h:619
void set_needs_initial_allocation_site(bool required)
Definition ast.h:1229
void set_boilerplate_descriptor_kind(ElementsKind kind)
Definition ast.h:1219
ElementsKind boilerplate_descriptor_kind() const
Definition ast.h:1189
int ComputeFlags(bool disable_mementos=false) const
Definition ast.h:1176
void set_is_simple(bool is_simple)
Definition ast.h:1215
static DirectHandle< Object > GetBoilerplateValue(Expression *expression, IsolateT *isolate)
Definition ast.cc:555
static constexpr int kDepthKindBits
Definition ast.h:1151
void BuildConstants(IsolateT *isolate, MaterializedLiteral *expr)
Definition ast.cc:791
static void InitDepthAndFlags(MaterializedLiteral *expr)
Definition ast.cc:767
void set_depth(DepthKind depth)
Definition ast.h:1224
LiteralProperty(Expression *key, Expression *value, bool is_computed_name)
Definition ast.h:1256
Expression * key() const
Definition ast.h:1247
Expression * value() const
Definition ast.h:1248
bool NeedsSetFunctionName() const
Definition ast.cc:298
base::PointerWithPayload< Expression, bool, 1 > key_and_is_computed_name_
Definition ast.h:1259
bool is_computed_name() const
Definition ast.h:1250
bool AsArrayIndex(uint32_t *index) const
Definition ast.cc:1046
static bool Match(void *literal1, void *literal2)
Definition ast.cc:1128
Tagged< Smi > AsSmiLiteral() const
Definition ast.h:985
bool ToUint32(uint32_t *value) const
Definition ast.cc:1031
Literal(double number, int position)
Definition ast.h:1051
const AstRawString * AsRawPropertyName()
Definition ast.h:980
DirectHandle< Object > BuildValue(IsolateT *isolate) const
Definition ast.cc:1051
uint32_t Hash()
Definition ast.cc:1115
Literal(bool boolean, int position)
Definition ast.h:1071
Literal(const AstRawString *string, int position)
Definition ast.h:1061
Literal(AstConsString *string, int position)
Definition ast.h:1066
AstBigInt AsBigInt() const
Definition ast.h:1009
bool IsConsString() const
Definition ast.h:1020
Literal(int smi, int position)
Definition ast.h:1047
Type type() const
Definition ast.h:967
AstConsString * AsConsString()
Definition ast.h:1021
Literal(Type type, int position)
Definition ast.h:1076
AstBigInt bigint_
Definition ast.h:1086
bool IsRawString() const
Definition ast.h:1014
bool IsPropertyName() const
Definition ast.cc:1025
bool IsNumber() const
Definition ast.h:996
const AstRawString * AsRawString()
Definition ast.h:1015
bool ToBooleanIsFalse() const
Definition ast.h:1027
Literal(AstBigInt bigint, int position)
Definition ast.h:1056
V8_EXPORT_PRIVATE bool ToBooleanIsTrue() const
double AsNumber() const
Definition ast.h:997
bool AsBooleanLiteral() const
Definition ast.h:990
const AstRawString * string_
Definition ast.h:1082
AstConsString * cons_string_
Definition ast.h:1083
MaterializedLiteral(int pos, NodeType type)
Definition ast.h:1099
Expression * subsequent(size_t index) const
Definition ast.h:1944
int subsequent_op_position(size_t index) const
Definition ast.h:1949
Expression * first_
Definition ast.h:1987
void AddSubsequent(Expression *expr, int pos)
Definition ast.h:1953
Token::Value op() const
Definition ast.h:1942
NaryOperation(Zone *zone, Token::Value op, Expression *first, size_t initial_subsequent_size)
Definition ast.h:1961
ZoneVector< NaryOperationEntry > subsequent_
Definition ast.h:1995
size_t subsequent_length() const
Definition ast.h:1948
Expression * first() const
Definition ast.h:1943
v8::Extension * extension() const
Definition ast.h:2781
DirectHandle< String > name() const
Definition ast.h:2779
NativeFunctionLiteral(const AstRawString *name, v8::Extension *extension, int pos)
Definition ast.h:2787
const AstRawString * raw_name() const
Definition ast.h:2780
const AstRawString * name_
Definition ast.h:2793
NestedVariableDeclaration(Scope *scope, int pos)
Definition ast.h:421
void set_has_elements(bool has_elements)
Definition ast.h:1370
const ZonePtrList< Property > * properties() const
Definition ast.h:1326
ObjectLiteralBoilerplateBuilder(ZoneList< Property * > *properties, uint32_t boilerplate_properties, bool has_rest_property)
Definition ast.h:1308
void BuildBoilerplateDescription(IsolateT *isolate)
Definition ast.cc:478
Handle< ObjectBoilerplateDescription > GetOrBuildBoilerplateDescription(IsolateT *isolate)
Definition ast.h:1342
ZoneList< Property * > * properties_
Definition ast.h:1379
DirectHandle< ObjectBoilerplateDescription > boilerplate_description() const
Definition ast.h:1318
IndirectHandle< ObjectBoilerplateDescription > boilerplate_description_
Definition ast.h:1381
int ComputeFlags(bool disable_mementos=false) const
Definition ast.cc:386
void set_has_null_protoype(bool has_null_prototype)
Definition ast.h:1376
void set_fast_elements(bool fast_elements)
Definition ast.h:1373
void set_emit_store(bool emit_store)
Definition ast.cc:332
ObjectLiteralProperty(Expression *key, Expression *value, Kind kind, bool is_computed_name)
Definition ast.cc:276
Variable * home_object_
Definition ast.h:1429
const ObjectLiteralBoilerplateBuilder * builder() const
Definition ast.h:1410
ObjectLiteralBoilerplateBuilder * builder()
Definition ast.h:1412
ObjectLiteralBoilerplateBuilder builder_
Definition ast.h:1430
ObjectLiteral(Zone *zone, const ScopedPtrList< Property > &properties, uint32_t boilerplate_properties, int pos, bool has_rest_property, Variable *home_object)
Definition ast.h:1420
ZoneList< Property * > * properties()
Definition ast.h:1408
ZoneList< Property * > properties_
Definition ast.h:1428
void CalculateEmitStore(Zone *zone)
Definition ast.cc:338
Variable * home_object() const
Definition ast.h:1414
OptionalChain(Expression *expression)
Definition ast.h:1648
Expression * expression() const
Definition ast.h:1642
Expression * expression_
Definition ast.h:1651
Property(Expression *obj, Expression *key, int pos, bool optional_chain)
Definition ast.h:1722
static AssignType GetAssignType(Property *property)
Definition ast.h:1686
Expression * obj() const
Definition ast.h:1679
Expression * key() const
Definition ast.h:1680
Expression * key_
Definition ast.h:1730
Expression * obj_
Definition ast.h:1729
bool is_optional_chain_link() const
Definition ast.h:1673
bool IsPrivateReference() const
Definition ast.h:1683
bool IsValidReferenceExpression() const
Definition ast.h:1677
const AstRawString * raw_pattern() const
Definition ast.h:1114
DirectHandle< String > pattern() const
Definition ast.h:1113
const AstRawString *const pattern_
Definition ast.h:1127
RegExpLiteral(const AstRawString *pattern, int flags, int pos)
Definition ast.h:1121
Expression * expression() const
Definition ast.h:656
int end_position() const
Definition ast.h:669
Expression * expression_
Definition ast.h:682
static constexpr int kFunctionLiteralReturnPosition
Definition ast.h:666
bool is_async_return() const
Definition ast.h:659
bool is_synthetic_async_return() const
Definition ast.h:660
ReturnStatement(Expression *expression, Type type, int pos, int end_position)
Definition ast.h:675
static V8_EXPORT_PRIVATE const Function * FunctionForId(FunctionId id)
Definition runtime.cc:350
SloppyBlockFunctionStatement * next_
Definition ast.h:949
SloppyBlockFunctionStatement ** next()
Definition ast.h:930
const AstRawString * name() const
Definition ast.h:929
void set_statement(Statement *statement)
Definition ast.h:925
SloppyBlockFunctionStatement(int pos, Variable *var, Token::Value init, Statement *statement)
Definition ast.h:938
static constexpr Tagged< Smi > FromInt(int value)
Definition smi.h:38
Expression * expression() const
Definition ast.h:2057
Expression * expression_
Definition ast.h:2071
int expression_position() const
Definition ast.h:2059
Spread(Expression *expression, int pos, int expr_pos)
Definition ast.h:2065
Statement(int position, NodeType type)
Definition ast.h:190
SuperCallForwardArgs(Zone *zone, SuperCallReference *expression, int pos)
Definition ast.h:1862
SuperCallReference * expression_
Definition ast.h:1865
SuperCallReference * expression() const
Definition ast.h:1856
VariableProxy * new_target_var() const
Definition ast.h:2815
SuperCallReference(VariableProxy *new_target_var, VariableProxy *this_function_var, int pos)
Definition ast.h:2823
VariableProxy * this_function_var_
Definition ast.h:2833
VariableProxy * this_function_var() const
Definition ast.h:2816
VariableProxy * new_target_var_
Definition ast.h:2832
SuperPropertyReference(VariableProxy *home_object, int pos)
Definition ast.h:2806
VariableProxy * home_object() const
Definition ast.h:2800
Expression * expression() const
Definition ast.h:2234
OnAbruptResume on_abrupt_resume() const
Definition ast.h:2235
Suspend(NodeType node_type, Expression *expression, int pos, OnAbruptResume on_abrupt_resume)
Definition ast.h:2246
Expression * expression_
Definition ast.h:2252
ZonePtrList< CaseClause > cases_
Definition ast.h:748
void set_tag(Expression *t)
Definition ast.h:736
SwitchStatement(Zone *zone, Expression *tag, int pos)
Definition ast.h:744
Expression * tag() const
Definition ast.h:735
ZonePtrList< CaseClause > * cases()
Definition ast.h:738
const ZonePtrList< Expression > * substitutions_
Definition ast.h:2925
const ZonePtrList< const AstRawString > * string_parts_
Definition ast.h:2924
const ZonePtrList< const AstRawString > * string_parts() const
Definition ast.h:2908
const ZonePtrList< Expression > * substitutions() const
Definition ast.h:2911
TemplateLiteral(const ZonePtrList< const AstRawString > *parts, const ZonePtrList< Expression > *substitutions, int pos)
Definition ast.h:2918
Expression * exception() const
Definition ast.h:2285
Throw(Expression *exception, int pos)
Definition ast.h:2291
Expression * exception_
Definition ast.h:2294
static bool IsCompareOp(Value op)
Definition token.h:297
static bool IsBinaryOp(Value op)
Definition token.h:295
static bool IsUnaryOp(Value op)
Definition token.h:318
static Value BinaryOpForAssignment(Value op)
Definition token.h:307
static bool IsAssignmentOp(Value token)
Definition token.h:287
void set_catch_block(Block *b)
Definition ast.h:804
HandlerTable::CatchPrediction GetCatchPrediction(HandlerTable::CatchPrediction outer_catch_prediction) const
Definition ast.h:822
bool ShouldClearException(HandlerTable::CatchPrediction outer_catch_prediction) const
Definition ast.h:852
Block * catch_block() const
Definition ast.h:803
HandlerTable::CatchPrediction catch_prediction_
Definition ast.h:880
TryCatchStatement(Block *try_block, Scope *scope, Block *catch_block, HandlerTable::CatchPrediction catch_prediction, int pos)
Definition ast.h:871
Block * finally_block() const
Definition ast.h:886
TryFinallyStatement(Block *try_block, Block *finally_block, int pos)
Definition ast.h:893
void set_finally_block(Block *b)
Definition ast.h:887
Block * try_block() const
Definition ast.h:788
void set_try_block(Block *b)
Definition ast.h:789
TryStatement(Block *try_block, int pos, NodeType type)
Definition ast.h:792
UnaryOperation(Token::Value op, Expression *expression, int pos)
Definition ast.h:1902
Expression * expression() const
Definition ast.h:1896
Expression * expression_
Definition ast.h:1908
Token::Value op() const
Definition ast.h:1895
VariableDeclaration(int pos, bool is_nested=false)
Definition ast.h:401
NestedVariableDeclaration * AsNested()
Definition ast.h:428
bool is_home_object() const
Definition ast.h:1578
void mark_removed_from_unresolved()
Definition ast.h:1574
bool is_new_target() const
Definition ast.h:1547
void BindTo(Variable *var)
Definition ast.cc:173
bool IsValidReferenceExpression() const
Definition ast.h:1510
V8_INLINE VariableProxy * next_unresolved()
Definition ast.h:1569
bool IsPrivateName() const
Definition ast.h:1564
Variable * var() const
Definition ast.h:1517
bool is_assigned() const
Definition ast.h:1531
const AstRawString * raw_name() const
Definition ast.h:1513
V8_INLINE VariableProxy ** next()
Definition ast.h:1633
VariableProxy(const AstRawString *name, VariableKind variable_kind, int start_position)
Definition ast.h:1606
HoleCheckMode hole_check_mode() const
Definition ast.h:1552
Scanner::Location location()
Definition ast.h:1527
void set_var(Variable *v)
Definition ast.h:1521
V8_INLINE bool is_removed_from_unresolved() const
Definition ast.h:1570
bool is_resolved() const
Definition ast.h:1542
VariableProxy * next_unresolved_
Definition ast.h:1634
DirectHandle< String > name() const
Definition ast.h:1512
const AstRawString * raw_name_
Definition ast.h:1629
VariableMode mode() const
Definition variables.h:66
Scope * scope() const
Definition variables.h:58
const AstRawString * raw_name() const
Definition variables.h:65
Expression * cond() const
Definition ast.h:491
void Initialize(Expression *cond, Statement *body)
Definition ast.h:486
void set_statement(Statement *s)
Definition ast.h:694
Statement * statement_
Definition ast.h:709
Statement * statement() const
Definition ast.h:693
Expression * expression() const
Definition ast.h:692
Expression * expression_
Definition ast.h:708
WithStatement(Scope *scope, Expression *expression, Statement *statement, int pos)
Definition ast.h:700
YieldStar(Expression *expression, int pos)
Definition ast.h:2269
Yield(Expression *expression, int pos, OnAbruptResume on_abrupt_resume)
Definition ast.h:2261
V8_INLINE int length() const
Definition zone-list.h:101
T & at(int i) const
Definition zone-list.h:88
T * New(Args &&... args)
Definition zone.h:114
base::Vector< const DirectHandle< Object > > args
Definition execution.cc:74
Label label
std::string extension
TNode< Object > target
std::string pattern
const std::string property
ZoneVector< RpoNumber > & result
FunctionLiteral * literal
Definition liveedit.cc:294
int position
Definition liveedit.cc:290
int s
Definition mul-fft.cc:297
int n
Definition mul-fft.cc:296
constexpr bool IsInRange(T value, U lower_limit, U higher_limit)
Definition bounds.h:20
constexpr int kNoSourcePosition
Definition globals.h:850
@ PRIVATE_GETTER_ONLY
Definition ast.h:1664
@ NAMED_PROPERTY
Definition ast.h:1659
@ NAMED_SUPER_PROPERTY
Definition ast.h:1661
@ PRIVATE_SETTER_ONLY
Definition ast.h:1665
@ KEYED_SUPER_PROPERTY
Definition ast.h:1662
@ NON_PROPERTY
Definition ast.h:1658
@ PRIVATE_METHOD
Definition ast.h:1663
@ KEYED_PROPERTY
Definition ast.h:1660
@ PRIVATE_DEBUG_DYNAMIC
Definition ast.h:1667
@ PRIVATE_GETTER_AND_SETTER
Definition ast.h:1666
bool IsResumableFunction(FunctionKind kind)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in name
Definition flags.cc:2086
Flag flags[]
Definition flags.cc:3797
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and force scavenge at random points between and reclaim otherwise unreachable unmodified wrapper objects when possible less compaction in non memory reducing mode use high priority threads for concurrent Marking Test mode only flag It allows an unit test to select evacuation candidates use incremental marking for CppHeap cppheap_concurrent_marking c value for membalancer A special constant to balance between memory and space tradeoff The smaller the more memory it uses enable use of SSE4 instructions if available enable use of AVX VNNI instructions if available enable use of POPCNT instruction if available force all emitted branches to be in long mode(MIPS/PPC only)") DEFINE_BOOL(partial_constant_pool
void Print(Tagged< Object > obj)
Definition objects.h:774
SharedFunctionInfo::HasStaticPrivateMethodsOrAccessorsBit SharedFunctionInfo::MaglevCompilationFailedBit SharedFunctionInfo::FunctionSyntaxKindBits has_duplicate_parameters
bool IsFastElementsKind(ElementsKind kind)
constexpr int kFunctionLiteralIdTopLevel
Definition globals.h:2767
return value
Definition map-inl.h:893
ZoneList< T * > ZonePtrList
template const char * string
ModuleImportPhase
#define DCHECK_NULL(val)
Definition logging.h:491
#define DCHECK_NOT_NULL(val)
Definition logging.h:492
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493
#define DCHECK_NE(v1, v2)
Definition logging.h:486
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define V8_EXPORT_PRIVATE
Definition macros.h:460
ConditionalChainEntry(Expression *cond, Expression *then, int pos)
Definition ast.h:2138
NaryOperationEntry(Expression *e, int pos)
Definition ast.h:1992
static VariableProxy ** filter(VariableProxy **t)
Definition ast.h:1586
static VariableProxy ** start(VariableProxy **head)
Definition ast.h:1595
static VariableProxy ** next(VariableProxy *t)
Definition ast.h:1597
Symbol * expression
Symbol statement
#define V8_INLINE
Definition v8config.h:500
wasm::ValueType type