v8  3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ast.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 #ifndef V8_AST_H_
29 #define V8_AST_H_
30 
31 #include "v8.h"
32 
33 #include "assembler.h"
34 #include "factory.h"
35 #include "isolate.h"
36 #include "jsregexp.h"
37 #include "list-inl.h"
38 #include "runtime.h"
39 #include "small-pointer-list.h"
40 #include "smart-pointers.h"
41 #include "token.h"
42 #include "utils.h"
43 #include "variables.h"
44 #include "interface.h"
45 #include "zone-inl.h"
46 
47 namespace v8 {
48 namespace internal {
49 
50 // The abstract syntax tree is an intermediate, light-weight
51 // representation of the parsed JavaScript code suitable for
52 // compilation to native code.
53 
54 // Nodes are allocated in a separate zone, which allows faster
55 // allocation and constant-time deallocation of the entire syntax
56 // tree.
57 
58 
59 // ----------------------------------------------------------------------------
60 // Nodes of the abstract syntax tree. Only concrete classes are
61 // enumerated here.
62 
63 #define DECLARATION_NODE_LIST(V) \
64  V(VariableDeclaration) \
65  V(FunctionDeclaration) \
66  V(ModuleDeclaration) \
67  V(ImportDeclaration) \
68  V(ExportDeclaration) \
69 
70 #define MODULE_NODE_LIST(V) \
71  V(ModuleLiteral) \
72  V(ModuleVariable) \
73  V(ModulePath) \
74  V(ModuleUrl)
75 
76 #define STATEMENT_NODE_LIST(V) \
77  V(Block) \
78  V(ExpressionStatement) \
79  V(EmptyStatement) \
80  V(IfStatement) \
81  V(ContinueStatement) \
82  V(BreakStatement) \
83  V(ReturnStatement) \
84  V(WithStatement) \
85  V(SwitchStatement) \
86  V(DoWhileStatement) \
87  V(WhileStatement) \
88  V(ForStatement) \
89  V(ForInStatement) \
90  V(TryCatchStatement) \
91  V(TryFinallyStatement) \
92  V(DebuggerStatement)
93 
94 #define EXPRESSION_NODE_LIST(V) \
95  V(FunctionLiteral) \
96  V(SharedFunctionInfoLiteral) \
97  V(Conditional) \
98  V(VariableProxy) \
99  V(Literal) \
100  V(RegExpLiteral) \
101  V(ObjectLiteral) \
102  V(ArrayLiteral) \
103  V(Assignment) \
104  V(Throw) \
105  V(Property) \
106  V(Call) \
107  V(CallNew) \
108  V(CallRuntime) \
109  V(UnaryOperation) \
110  V(CountOperation) \
111  V(BinaryOperation) \
112  V(CompareOperation) \
113  V(ThisFunction)
114 
115 #define AST_NODE_LIST(V) \
116  DECLARATION_NODE_LIST(V) \
117  MODULE_NODE_LIST(V) \
118  STATEMENT_NODE_LIST(V) \
119  EXPRESSION_NODE_LIST(V)
120 
121 // Forward declarations
122 class AstConstructionVisitor;
123 template<class> class AstNodeFactory;
124 class AstVisitor;
125 class Declaration;
126 class Module;
127 class BreakableStatement;
128 class Expression;
129 class IterationStatement;
130 class MaterializedLiteral;
131 class Statement;
132 class TargetCollector;
133 class TypeFeedbackOracle;
134 
135 class RegExpAlternative;
136 class RegExpAssertion;
137 class RegExpAtom;
138 class RegExpBackReference;
139 class RegExpCapture;
141 class RegExpCompiler;
142 class RegExpDisjunction;
143 class RegExpEmpty;
144 class RegExpLookahead;
145 class RegExpQuantifier;
146 class RegExpText;
147 
148 #define DEF_FORWARD_DECLARATION(type) class type;
150 #undef DEF_FORWARD_DECLARATION
151 
152 
153 // Typedef only introduced to avoid unreadable code.
154 // Please do appreciate the required space in "> >".
157 
158 
159 #define DECLARE_NODE_TYPE(type) \
160  virtual void Accept(AstVisitor* v); \
161  virtual AstNode::Type node_type() const { return AstNode::k##type; } \
162  template<class> friend class AstNodeFactory;
163 
164 
171 };
172 
173 
174 class AstProperties BASE_EMBEDDED {
175  public:
176  class Flags : public EnumSet<AstPropertiesFlag, int> {};
177 
178  AstProperties() : node_count_(0) { }
179 
180  Flags* flags() { return &flags_; }
181  int node_count() { return node_count_; }
182  void add_node_count(int count) { node_count_ += count; }
183 
184  private:
185  Flags flags_;
186  int node_count_;
187 };
188 
189 
190 class AstNode: public ZoneObject {
191  public:
192 #define DECLARE_TYPE_ENUM(type) k##type,
193  enum Type {
195  kInvalid = -1
196  };
197 #undef DECLARE_TYPE_ENUM
198 
199  void* operator new(size_t size, Zone* zone) {
200  return zone->New(static_cast<int>(size));
201  }
202 
203  AstNode() { }
204 
205  virtual ~AstNode() { }
206 
207  virtual void Accept(AstVisitor* v) = 0;
208  virtual Type node_type() const = 0;
209 
210  // Type testing & conversion functions overridden by concrete subclasses.
211 #define DECLARE_NODE_FUNCTIONS(type) \
212  bool Is##type() { return node_type() == AstNode::k##type; } \
213  type* As##type() { return Is##type() ? reinterpret_cast<type*>(this) : NULL; }
215 #undef DECLARE_NODE_FUNCTIONS
216 
217  virtual TargetCollector* AsTargetCollector() { return NULL; }
221 
222  protected:
223  static int GetNextId(Isolate* isolate) {
224  return ReserveIdRange(isolate, 1);
225  }
226 
227  static int ReserveIdRange(Isolate* isolate, int n) {
228  int tmp = isolate->ast_node_id();
229  isolate->set_ast_node_id(tmp + n);
230  return tmp;
231  }
232 
233  // Some nodes re-use bailout IDs for type feedback.
235  return TypeFeedbackId(id.ToInt());
236  }
237 
238 
239  private:
240  // Hidden to prevent accidental usage. It would have to load the
241  // current zone from the TLS.
242  void* operator new(size_t size);
243 
244  friend class CaseClause; // Generates AST IDs.
245 };
246 
247 
248 class Statement: public AstNode {
249  public:
250  Statement() : statement_pos_(RelocInfo::kNoPosition) {}
251 
252  bool IsEmpty() { return AsEmptyStatement() != NULL; }
253 
254  void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
255  int statement_pos() const { return statement_pos_; }
256 
257  private:
258  int statement_pos_;
259 };
260 
261 
263  public:
265  SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {}
266 
267  void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); }
268  void Clear() { list_.Clear(); }
269  void Sort() { list_.Sort(); }
270 
271  bool is_empty() const { return list_.is_empty(); }
272  int length() const { return list_.length(); }
273 
274  void Add(Handle<Map> handle, Zone* zone) {
275  list_.Add(handle.location(), zone);
276  }
277 
278  Handle<Map> at(int i) const {
279  return Handle<Map>(list_.at(i));
280  }
281 
282  Handle<Map> first() const { return at(0); }
283  Handle<Map> last() const { return at(length() - 1); }
284 
285  private:
286  // The list stores pointers to Map*, that is Map**, so it's GC safe.
288 
290 };
291 
292 
293 class Expression: public AstNode {
294  public:
295  enum Context {
296  // Not assigned a context yet, or else will not be visited during
297  // code generation.
299  // Evaluated for its side effects.
301  // Evaluated for its value (and side effects).
303  // Evaluated for control flow (and side effects).
304  kTest
305  };
306 
307  virtual int position() const {
308  UNREACHABLE();
309  return 0;
310  }
311 
312  virtual bool IsValidLeftHandSide() { return false; }
313 
314  // Helpers for ToBoolean conversion.
315  virtual bool ToBooleanIsTrue() { return false; }
316  virtual bool ToBooleanIsFalse() { return false; }
317 
318  // Symbols that cannot be parsed as array indices are considered property
319  // names. We do not treat symbols that can be array indexes as property
320  // names because [] for string objects is handled only by keyed ICs.
321  virtual bool IsPropertyName() { return false; }
322 
323  // True iff the result can be safely overwritten (to avoid allocation).
324  // False for operations that can return one of their operands.
325  virtual bool ResultOverwriteAllowed() { return false; }
326 
327  // True iff the expression is a literal represented as a smi.
328  bool IsSmiLiteral();
329 
330  // True iff the expression is a string literal.
331  bool IsStringLiteral();
332 
333  // True iff the expression is the null literal.
334  bool IsNullLiteral();
335 
336  // Type feedback information for assignments and properties.
337  virtual bool IsMonomorphic() {
338  UNREACHABLE();
339  return false;
340  }
342  UNREACHABLE();
343  return NULL;
344  }
346  ASSERT(IsMonomorphic());
347  SmallMapList* types = GetReceiverTypes();
348  ASSERT(types != NULL && types->length() == 1);
349  return types->at(0);
350  }
351 
352  BailoutId id() const { return id_; }
353  TypeFeedbackId test_id() const { return test_id_; }
354 
355  protected:
356  explicit Expression(Isolate* isolate)
357  : id_(GetNextId(isolate)),
358  test_id_(GetNextId(isolate)) {}
359 
360  private:
361  const BailoutId id_;
362  const TypeFeedbackId test_id_;
363 };
364 
365 
367  public:
368  enum Type {
370  TARGET_FOR_NAMED_ONLY
371  };
372 
373  // The labels associated with this statement. May be NULL;
374  // if it is != NULL, guaranteed to contain at least one entry.
375  ZoneStringList* labels() const { return labels_; }
376 
377  // Type testing & conversion.
378  virtual BreakableStatement* AsBreakableStatement() { return this; }
379 
380  // Code generation
381  Label* break_target() { return &break_target_; }
382 
383  // Testers.
384  bool is_target_for_anonymous() const { return type_ == TARGET_FOR_ANONYMOUS; }
385 
386  BailoutId EntryId() const { return entry_id_; }
387  BailoutId ExitId() const { return exit_id_; }
388 
389  protected:
391  : labels_(labels),
392  type_(type),
393  entry_id_(GetNextId(isolate)),
394  exit_id_(GetNextId(isolate)) {
395  ASSERT(labels == NULL || labels->length() > 0);
396  }
397 
398 
399  private:
400  ZoneStringList* labels_;
401  Type type_;
402  Label break_target_;
403  const BailoutId entry_id_;
404  const BailoutId exit_id_;
405 };
406 
407 
408 class Block: public BreakableStatement {
409  public:
411 
412  void AddStatement(Statement* statement, Zone* zone) {
413  statements_.Add(statement, zone);
414  }
415 
416  ZoneList<Statement*>* statements() { return &statements_; }
417  bool is_initializer_block() const { return is_initializer_block_; }
418 
419  Scope* scope() const { return scope_; }
420  void set_scope(Scope* scope) { scope_ = scope; }
421 
422  protected:
423  Block(Isolate* isolate,
424  ZoneStringList* labels,
425  int capacity,
426  bool is_initializer_block,
427  Zone* zone)
428  : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY),
429  statements_(capacity, zone),
430  is_initializer_block_(is_initializer_block),
431  scope_(NULL) {
432  }
433 
434  private:
435  ZoneList<Statement*> statements_;
436  bool is_initializer_block_;
437  Scope* scope_;
438 };
439 
440 
441 class Declaration: public AstNode {
442  public:
443  VariableProxy* proxy() const { return proxy_; }
444  VariableMode mode() const { return mode_; }
445  Scope* scope() const { return scope_; }
446  virtual InitializationFlag initialization() const = 0;
447  virtual bool IsInlineable() const;
448 
449  protected:
451  VariableMode mode,
452  Scope* scope)
453  : proxy_(proxy),
454  mode_(mode),
455  scope_(scope) {
457  }
458 
459  private:
460  VariableProxy* proxy_;
461  VariableMode mode_;
462 
463  // Nested scope from which the declaration originated.
464  Scope* scope_;
465 };
466 
467 
469  public:
471 
472  virtual InitializationFlag initialization() const {
473  return mode() == VAR ? kCreatedInitialized : kNeedsInitialization;
474  }
475 
476  protected:
478  VariableMode mode,
479  Scope* scope)
480  : Declaration(proxy, mode, scope) {
481  }
482 };
483 
484 
486  public:
488 
489  FunctionLiteral* fun() const { return fun_; }
491  return kCreatedInitialized;
492  }
493  virtual bool IsInlineable() const;
494 
495  protected:
497  VariableMode mode,
498  FunctionLiteral* fun,
499  Scope* scope)
500  : Declaration(proxy, mode, scope),
501  fun_(fun) {
502  // At the moment there are no "const functions" in JavaScript...
503  ASSERT(mode == VAR || mode == LET);
504  ASSERT(fun != NULL);
505  }
506 
507  private:
508  FunctionLiteral* fun_;
509 };
510 
511 
513  public:
515 
516  Module* module() const { return module_; }
518  return kCreatedInitialized;
519  }
520 
521  protected:
523  Module* module,
524  Scope* scope)
525  : Declaration(proxy, LET, scope),
526  module_(module) {
527  }
528 
529  private:
530  Module* module_;
531 };
532 
533 
535  public:
537 
538  Module* module() const { return module_; }
540  return kCreatedInitialized;
541  }
542 
543  protected:
545  Module* module,
546  Scope* scope)
547  : Declaration(proxy, LET, scope),
548  module_(module) {
549  }
550 
551  private:
552  Module* module_;
553 };
554 
555 
557  public:
559 
560  virtual InitializationFlag initialization() const {
561  return kCreatedInitialized;
562  }
563 
564  protected:
566  : Declaration(proxy, LET, scope) {}
567 };
568 
569 
570 class Module: public AstNode {
571  public:
572  Interface* interface() const { return interface_; }
573  Block* body() const { return body_; }
574 
575  protected:
576  explicit Module(Zone* zone)
577  : interface_(Interface::NewModule(zone)),
578  body_(NULL) {}
579  explicit Module(Interface* interface, Block* body = NULL)
580  : interface_(interface),
581  body_(body) {}
582 
583  private:
584  Interface* interface_;
585  Block* body_;
586 };
587 
588 
589 class ModuleLiteral: public Module {
590  public:
592 
593  protected:
594  ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {}
595 };
596 
597 
598 class ModuleVariable: public Module {
599  public:
601 
602  VariableProxy* proxy() const { return proxy_; }
603 
604  protected:
605  inline explicit ModuleVariable(VariableProxy* proxy);
606 
607  private:
608  VariableProxy* proxy_;
609 };
610 
611 
612 class ModulePath: public Module {
613  public:
615 
616  Module* module() const { return module_; }
617  Handle<String> name() const { return name_; }
618 
619  protected:
620  ModulePath(Module* module, Handle<String> name, Zone* zone)
621  : Module(zone),
622  module_(module),
623  name_(name) {
624  }
625 
626  private:
627  Module* module_;
628  Handle<String> name_;
629 };
630 
631 
632 class ModuleUrl: public Module {
633  public:
635 
636  Handle<String> url() const { return url_; }
637 
638  protected:
640  : Module(zone), url_(url) {
641  }
642 
643  private:
644  Handle<String> url_;
645 };
646 
647 
649  public:
650  // Type testing & conversion.
651  virtual IterationStatement* AsIterationStatement() { return this; }
652 
653  Statement* body() const { return body_; }
654 
655  BailoutId OsrEntryId() const { return osr_entry_id_; }
656  virtual BailoutId ContinueId() const = 0;
657  virtual BailoutId StackCheckId() const = 0;
658 
659  // Code generation
660  Label* continue_target() { return &continue_target_; }
661 
662  protected:
664  : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
665  body_(NULL),
666  osr_entry_id_(GetNextId(isolate)) {
667  }
668 
669  void Initialize(Statement* body) {
670  body_ = body;
671  }
672 
673  private:
674  Statement* body_;
675  Label continue_target_;
676  const BailoutId osr_entry_id_;
677 };
678 
679 
681  public:
683 
684  void Initialize(Expression* cond, Statement* body) {
686  cond_ = cond;
687  }
688 
689  Expression* cond() const { return cond_; }
690 
691  // Position where condition expression starts. We need it to make
692  // the loop's condition a breakable location.
693  int condition_position() { return condition_position_; }
694  void set_condition_position(int pos) { condition_position_ = pos; }
695 
696  virtual BailoutId ContinueId() const { return continue_id_; }
697  virtual BailoutId StackCheckId() const { return back_edge_id_; }
698  BailoutId BackEdgeId() const { return back_edge_id_; }
699 
700  protected:
702  : IterationStatement(isolate, labels),
703  cond_(NULL),
704  condition_position_(-1),
705  continue_id_(GetNextId(isolate)),
706  back_edge_id_(GetNextId(isolate)) {
707  }
708 
709  private:
710  Expression* cond_;
711  int condition_position_;
712  const BailoutId continue_id_;
713  const BailoutId back_edge_id_;
714 };
715 
716 
718  public:
720 
721  void Initialize(Expression* cond, Statement* body) {
723  cond_ = cond;
724  }
725 
726  Expression* cond() const { return cond_; }
728  return may_have_function_literal_;
729  }
730  void set_may_have_function_literal(bool value) {
731  may_have_function_literal_ = value;
732  }
733 
734  virtual BailoutId ContinueId() const { return EntryId(); }
735  virtual BailoutId StackCheckId() const { return body_id_; }
736  BailoutId BodyId() const { return body_id_; }
737 
738  protected:
740  : IterationStatement(isolate, labels),
741  cond_(NULL),
742  may_have_function_literal_(true),
743  body_id_(GetNextId(isolate)) {
744  }
745 
746  private:
747  Expression* cond_;
748  // True if there is a function literal subexpression in the condition.
749  bool may_have_function_literal_;
750  const BailoutId body_id_;
751 };
752 
753 
755  public:
757 
758  void Initialize(Statement* init,
759  Expression* cond,
760  Statement* next,
761  Statement* body) {
763  init_ = init;
764  cond_ = cond;
765  next_ = next;
766  }
767 
768  Statement* init() const { return init_; }
769  Expression* cond() const { return cond_; }
770  Statement* next() const { return next_; }
771 
773  return may_have_function_literal_;
774  }
775  void set_may_have_function_literal(bool value) {
776  may_have_function_literal_ = value;
777  }
778 
779  virtual BailoutId ContinueId() const { return continue_id_; }
780  virtual BailoutId StackCheckId() const { return body_id_; }
781  BailoutId BodyId() const { return body_id_; }
782 
783  bool is_fast_smi_loop() { return loop_variable_ != NULL; }
784  Variable* loop_variable() { return loop_variable_; }
785  void set_loop_variable(Variable* var) { loop_variable_ = var; }
786 
787  protected:
789  : IterationStatement(isolate, labels),
790  init_(NULL),
791  cond_(NULL),
792  next_(NULL),
793  may_have_function_literal_(true),
794  loop_variable_(NULL),
795  continue_id_(GetNextId(isolate)),
796  body_id_(GetNextId(isolate)) {
797  }
798 
799  private:
800  Statement* init_;
801  Expression* cond_;
802  Statement* next_;
803  // True if there is a function literal subexpression in the condition.
804  bool may_have_function_literal_;
805  Variable* loop_variable_;
806  const BailoutId continue_id_;
807  const BailoutId body_id_;
808 };
809 
810 
812  public:
814 
815  void Initialize(Expression* each, Expression* enumerable, Statement* body) {
817  each_ = each;
818  enumerable_ = enumerable;
819  }
820 
821  Expression* each() const { return each_; }
822  Expression* enumerable() const { return enumerable_; }
823 
824  virtual BailoutId ContinueId() const { return EntryId(); }
825  virtual BailoutId StackCheckId() const { return body_id_; }
826  BailoutId BodyId() const { return body_id_; }
827  BailoutId PrepareId() const { return prepare_id_; }
828 
829  TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); }
830 
831  protected:
833  : IterationStatement(isolate, labels),
834  each_(NULL),
835  enumerable_(NULL),
836  body_id_(GetNextId(isolate)),
837  prepare_id_(GetNextId(isolate)) {
838  }
839 
840  private:
841  Expression* each_;
842  Expression* enumerable_;
843  const BailoutId body_id_;
844  const BailoutId prepare_id_;
845 };
846 
847 
849  public:
851 
852  void set_expression(Expression* e) { expression_ = e; }
853  Expression* expression() const { return expression_; }
854 
855  protected:
856  explicit ExpressionStatement(Expression* expression)
857  : expression_(expression) { }
858 
859  private:
860  Expression* expression_;
861 };
862 
863 
865  public:
867 
868  IterationStatement* target() const { return target_; }
869 
870  protected:
872  : target_(target) { }
873 
874  private:
875  IterationStatement* target_;
876 };
877 
878 
879 class BreakStatement: public Statement {
880  public:
882 
883  BreakableStatement* target() const { return target_; }
884 
885  protected:
887  : target_(target) { }
888 
889  private:
890  BreakableStatement* target_;
891 };
892 
893 
894 class ReturnStatement: public Statement {
895  public:
897 
898  Expression* expression() const { return expression_; }
899 
900  protected:
901  explicit ReturnStatement(Expression* expression)
902  : expression_(expression) { }
903 
904  private:
905  Expression* expression_;
906 };
907 
908 
909 class WithStatement: public Statement {
910  public:
912 
913  Expression* expression() const { return expression_; }
914  Statement* statement() const { return statement_; }
915 
916  protected:
917  WithStatement(Expression* expression, Statement* statement)
918  : expression_(expression),
919  statement_(statement) { }
920 
921  private:
922  Expression* expression_;
923  Statement* statement_;
924 };
925 
926 
927 class CaseClause: public ZoneObject {
928  public:
929  CaseClause(Isolate* isolate,
930  Expression* label,
931  ZoneList<Statement*>* statements,
932  int pos);
933 
934  bool is_default() const { return label_ == NULL; }
935  Expression* label() const {
936  CHECK(!is_default());
937  return label_;
938  }
939  Label* body_target() { return &body_target_; }
940  ZoneList<Statement*>* statements() const { return statements_; }
941 
942  int position() const { return position_; }
943  void set_position(int pos) { position_ = pos; }
944 
945  BailoutId EntryId() const { return entry_id_; }
946 
947  // Type feedback information.
948  TypeFeedbackId CompareId() { return compare_id_; }
949  void RecordTypeFeedback(TypeFeedbackOracle* oracle);
950  bool IsSmiCompare() { return compare_type_ == SMI_ONLY; }
951  bool IsSymbolCompare() { return compare_type_ == SYMBOL_ONLY; }
952  bool IsStringCompare() { return compare_type_ == STRING_ONLY; }
953  bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; }
954 
955  private:
956  Expression* label_;
957  Label body_target_;
958  ZoneList<Statement*>* statements_;
959  int position_;
960  enum CompareTypeFeedback {
961  NONE,
962  SMI_ONLY,
963  SYMBOL_ONLY,
964  STRING_ONLY,
965  OBJECT_ONLY
966  };
967  CompareTypeFeedback compare_type_;
968  const TypeFeedbackId compare_id_;
969  const BailoutId entry_id_;
970 };
971 
972 
974  public:
976 
977  void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
978  tag_ = tag;
979  cases_ = cases;
980  }
981 
982  Expression* tag() const { return tag_; }
983  ZoneList<CaseClause*>* cases() const { return cases_; }
984 
985  protected:
987  : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
988  tag_(NULL),
989  cases_(NULL) { }
990 
991  private:
992  Expression* tag_;
993  ZoneList<CaseClause*>* cases_;
994 };
995 
996 
997 // If-statements always have non-null references to their then- and
998 // else-parts. When parsing if-statements with no explicit else-part,
999 // the parser implicitly creates an empty statement. Use the
1000 // HasThenStatement() and HasElseStatement() functions to check if a
1001 // given if-statement has a then- or an else-part containing code.
1002 class IfStatement: public Statement {
1003  public:
1005 
1006  bool HasThenStatement() const { return !then_statement()->IsEmpty(); }
1007  bool HasElseStatement() const { return !else_statement()->IsEmpty(); }
1008 
1009  Expression* condition() const { return condition_; }
1010  Statement* then_statement() const { return then_statement_; }
1011  Statement* else_statement() const { return else_statement_; }
1012 
1013  BailoutId IfId() const { return if_id_; }
1014  BailoutId ThenId() const { return then_id_; }
1015  BailoutId ElseId() const { return else_id_; }
1016 
1017  protected:
1019  Expression* condition,
1020  Statement* then_statement,
1021  Statement* else_statement)
1022  : condition_(condition),
1023  then_statement_(then_statement),
1024  else_statement_(else_statement),
1025  if_id_(GetNextId(isolate)),
1026  then_id_(GetNextId(isolate)),
1027  else_id_(GetNextId(isolate)) {
1028  }
1029 
1030  private:
1031  Expression* condition_;
1032  Statement* then_statement_;
1033  Statement* else_statement_;
1034  const BailoutId if_id_;
1035  const BailoutId then_id_;
1036  const BailoutId else_id_;
1037 };
1038 
1039 
1040 // NOTE: TargetCollectors are represented as nodes to fit in the target
1041 // stack in the compiler; this should probably be reworked.
1042 class TargetCollector: public AstNode {
1043  public:
1044  explicit TargetCollector(Zone* zone) : targets_(0, zone) { }
1045 
1046  // Adds a jump target to the collector. The collector stores a pointer not
1047  // a copy of the target to make binding work, so make sure not to pass in
1048  // references to something on the stack.
1049  void AddTarget(Label* target, Zone* zone);
1050 
1051  // Virtual behaviour. TargetCollectors are never part of the AST.
1052  virtual void Accept(AstVisitor* v) { UNREACHABLE(); }
1053  virtual Type node_type() const { return kInvalid; }
1054  virtual TargetCollector* AsTargetCollector() { return this; }
1055 
1056  ZoneList<Label*>* targets() { return &targets_; }
1057 
1058  private:
1059  ZoneList<Label*> targets_;
1060 };
1061 
1062 
1063 class TryStatement: public Statement {
1064  public:
1066  escaping_targets_ = targets;
1067  }
1068 
1069  int index() const { return index_; }
1070  Block* try_block() const { return try_block_; }
1071  ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
1072 
1073  protected:
1074  TryStatement(int index, Block* try_block)
1075  : index_(index),
1076  try_block_(try_block),
1077  escaping_targets_(NULL) { }
1078 
1079  private:
1080  // Unique (per-function) index of this handler. This is not an AST ID.
1081  int index_;
1082 
1083  Block* try_block_;
1084  ZoneList<Label*>* escaping_targets_;
1085 };
1086 
1087 
1089  public:
1091 
1092  Scope* scope() { return scope_; }
1093  Variable* variable() { return variable_; }
1094  Block* catch_block() const { return catch_block_; }
1095 
1096  protected:
1098  Block* try_block,
1099  Scope* scope,
1100  Variable* variable,
1101  Block* catch_block)
1102  : TryStatement(index, try_block),
1103  scope_(scope),
1104  variable_(variable),
1105  catch_block_(catch_block) {
1106  }
1107 
1108  private:
1109  Scope* scope_;
1110  Variable* variable_;
1111  Block* catch_block_;
1112 };
1113 
1114 
1116  public:
1118 
1119  Block* finally_block() const { return finally_block_; }
1120 
1121  protected:
1122  TryFinallyStatement(int index, Block* try_block, Block* finally_block)
1123  : TryStatement(index, try_block),
1124  finally_block_(finally_block) { }
1125 
1126  private:
1127  Block* finally_block_;
1128 };
1129 
1130 
1132  public:
1134 
1135  protected:
1137 };
1138 
1139 
1140 class EmptyStatement: public Statement {
1141  public:
1143 
1144  protected:
1146 };
1147 
1148 
1149 class Literal: public Expression {
1150  public:
1152 
1153  virtual bool IsPropertyName() {
1154  if (handle_->IsSymbol()) {
1155  uint32_t ignored;
1156  return !String::cast(*handle_)->AsArrayIndex(&ignored);
1157  }
1158  return false;
1159  }
1160 
1162  ASSERT(IsPropertyName());
1163  return Handle<String>::cast(handle_);
1164  }
1165 
1166  virtual bool ToBooleanIsTrue() { return handle_->ToBoolean()->IsTrue(); }
1167  virtual bool ToBooleanIsFalse() { return handle_->ToBoolean()->IsFalse(); }
1168 
1169  // Identity testers.
1170  bool IsNull() const {
1171  ASSERT(!handle_.is_null());
1172  return handle_->IsNull();
1173  }
1174  bool IsTrue() const {
1175  ASSERT(!handle_.is_null());
1176  return handle_->IsTrue();
1177  }
1178  bool IsFalse() const {
1179  ASSERT(!handle_.is_null());
1180  return handle_->IsFalse();
1181  }
1182 
1183  Handle<Object> handle() const { return handle_; }
1184 
1185  // Support for using Literal as a HashMap key. NOTE: Currently, this works
1186  // only for string and number literals!
1187  uint32_t Hash() { return ToString()->Hash(); }
1188 
1189  static bool Match(void* literal1, void* literal2) {
1190  Handle<String> s1 = static_cast<Literal*>(literal1)->ToString();
1191  Handle<String> s2 = static_cast<Literal*>(literal2)->ToString();
1192  return s1->Equals(*s2);
1193  }
1194 
1195  TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
1196 
1197  protected:
1198  Literal(Isolate* isolate, Handle<Object> handle)
1199  : Expression(isolate),
1200  handle_(handle) { }
1201 
1202  private:
1203  Handle<String> ToString();
1204 
1205  Handle<Object> handle_;
1206 };
1207 
1208 
1209 // Base class for literals that needs space in the corresponding JSFunction.
1211  public:
1212  virtual MaterializedLiteral* AsMaterializedLiteral() { return this; }
1213 
1214  int literal_index() { return literal_index_; }
1215 
1216  // A materialized literal is simple if the values consist of only
1217  // constants and simple object and array literals.
1218  bool is_simple() const { return is_simple_; }
1219 
1220  int depth() const { return depth_; }
1221 
1222  protected:
1224  int literal_index,
1225  bool is_simple,
1226  int depth)
1227  : Expression(isolate),
1228  literal_index_(literal_index),
1229  is_simple_(is_simple),
1230  depth_(depth) {}
1231 
1232  private:
1233  int literal_index_;
1234  bool is_simple_;
1235  int depth_;
1236 };
1237 
1238 
1239 // An object literal has a boilerplate object that is used
1240 // for minimizing the work when constructing it at runtime.
1242  public:
1243  // Property is used for passing information
1244  // about an object literal's properties from the parser
1245  // to the code generator.
1246  class Property: public ZoneObject {
1247  public:
1248  enum Kind {
1249  CONSTANT, // Property with constant value (compile time).
1250  COMPUTED, // Property with computed value (execution time).
1251  MATERIALIZED_LITERAL, // Property value is a materialized literal.
1252  GETTER, SETTER, // Property is an accessor function.
1253  PROTOTYPE // Property is __proto__.
1254  };
1255 
1256  Property(Literal* key, Expression* value, Isolate* isolate);
1257 
1258  Literal* key() { return key_; }
1259  Expression* value() { return value_; }
1260  Kind kind() { return kind_; }
1261 
1262  // Type feedback information.
1263  void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1264  bool IsMonomorphic() { return !receiver_type_.is_null(); }
1265  Handle<Map> GetReceiverType() { return receiver_type_; }
1266 
1267  bool IsCompileTimeValue();
1268 
1269  void set_emit_store(bool emit_store);
1270  bool emit_store();
1271 
1272  protected:
1273  template<class> friend class AstNodeFactory;
1274 
1275  Property(bool is_getter, FunctionLiteral* value);
1276  void set_key(Literal* key) { key_ = key; }
1277 
1278  private:
1279  Literal* key_;
1280  Expression* value_;
1281  Kind kind_;
1282  bool emit_store_;
1283  Handle<Map> receiver_type_;
1284  };
1285 
1287 
1288  Handle<FixedArray> constant_properties() const {
1289  return constant_properties_;
1290  }
1291  ZoneList<Property*>* properties() const { return properties_; }
1292 
1293  bool fast_elements() const { return fast_elements_; }
1294 
1295  bool has_function() { return has_function_; }
1296 
1297  // Mark all computed expressions that are bound to a key that
1298  // is shadowed by a later occurrence of the same key. For the
1299  // marked expressions, no store code is emitted.
1300  void CalculateEmitStore(Zone* zone);
1301 
1302  enum Flags {
1303  kNoFlags = 0,
1304  kFastElements = 1,
1305  kHasFunction = 1 << 1
1306  };
1307 
1308  struct Accessors: public ZoneObject {
1309  Accessors() : getter(NULL), setter(NULL) { }
1312  };
1313 
1314  protected:
1316  Handle<FixedArray> constant_properties,
1317  ZoneList<Property*>* properties,
1318  int literal_index,
1319  bool is_simple,
1320  bool fast_elements,
1321  int depth,
1322  bool has_function)
1323  : MaterializedLiteral(isolate, literal_index, is_simple, depth),
1324  constant_properties_(constant_properties),
1325  properties_(properties),
1326  fast_elements_(fast_elements),
1327  has_function_(has_function) {}
1328 
1329  private:
1330  Handle<FixedArray> constant_properties_;
1331  ZoneList<Property*>* properties_;
1332  bool fast_elements_;
1333  bool has_function_;
1334 };
1335 
1336 
1337 // Node for capturing a regexp literal.
1339  public:
1341 
1342  Handle<String> pattern() const { return pattern_; }
1343  Handle<String> flags() const { return flags_; }
1344 
1345  protected:
1347  Handle<String> pattern,
1349  int literal_index)
1350  : MaterializedLiteral(isolate, literal_index, false, 1),
1351  pattern_(pattern),
1352  flags_(flags) {}
1353 
1354  private:
1355  Handle<String> pattern_;
1356  Handle<String> flags_;
1357 };
1358 
1359 // An array literal has a literals object that is used
1360 // for minimizing the work when constructing it at runtime.
1362  public:
1364 
1365  Handle<FixedArray> constant_elements() const { return constant_elements_; }
1366  ZoneList<Expression*>* values() const { return values_; }
1367 
1368  // Return an AST id for an element that is used in simulate instructions.
1370  return BailoutId(first_element_id_.ToInt() + i);
1371  }
1372 
1373  protected:
1375  Handle<FixedArray> constant_elements,
1376  ZoneList<Expression*>* values,
1377  int literal_index,
1378  bool is_simple,
1379  int depth)
1380  : MaterializedLiteral(isolate, literal_index, is_simple, depth),
1381  constant_elements_(constant_elements),
1382  values_(values),
1383  first_element_id_(ReserveIdRange(isolate, values->length())) {}
1384 
1385  private:
1386  Handle<FixedArray> constant_elements_;
1387  ZoneList<Expression*>* values_;
1388  const BailoutId first_element_id_;
1389 };
1390 
1391 
1392 class VariableProxy: public Expression {
1393  public:
1395 
1396  virtual bool IsValidLeftHandSide() {
1397  return var_ == NULL ? true : var_->IsValidLeftHandSide();
1398  }
1399 
1401  return !is_this() && name().is_identical_to(n);
1402  }
1403 
1404  bool IsArguments() { return var_ != NULL && var_->is_arguments(); }
1405 
1406  bool IsLValue() {
1407  return is_lvalue_;
1408  }
1409 
1410  Handle<String> name() const { return name_; }
1411  Variable* var() const { return var_; }
1412  bool is_this() const { return is_this_; }
1413  int position() const { return position_; }
1414  Interface* interface() const { return interface_; }
1415 
1416 
1417  void MarkAsTrivial() { is_trivial_ = true; }
1418  void MarkAsLValue() { is_lvalue_ = true; }
1419 
1420  // Bind this proxy to the variable var.
1421  void BindTo(Variable* var);
1422 
1423  protected:
1424  VariableProxy(Isolate* isolate, Variable* var);
1425 
1426  VariableProxy(Isolate* isolate,
1427  Handle<String> name,
1428  bool is_this,
1430  int position);
1431 
1433  Variable* var_; // resolved variable, or NULL
1434  bool is_this_;
1436  // True if this variable proxy is being used in an assignment
1437  // or with a increment/decrement operator.
1441 };
1442 
1443 
1444 class Property: public Expression {
1445  public:
1447 
1448  virtual bool IsValidLeftHandSide() { return true; }
1449 
1450  Expression* obj() const { return obj_; }
1451  Expression* key() const { return key_; }
1452  virtual int position() const { return pos_; }
1453 
1454  BailoutId LoadId() const { return load_id_; }
1455 
1456  bool IsStringLength() const { return is_string_length_; }
1457  bool IsStringAccess() const { return is_string_access_; }
1458  bool IsFunctionPrototype() const { return is_function_prototype_; }
1459 
1460  // Type feedback information.
1461  void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
1462  virtual bool IsMonomorphic() { return is_monomorphic_; }
1463  virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
1464  bool IsArrayLength() { return is_array_length_; }
1465  bool IsUninitialized() { return is_uninitialized_; }
1467 
1468  protected:
1469  Property(Isolate* isolate,
1470  Expression* obj,
1471  Expression* key,
1472  int pos)
1473  : Expression(isolate),
1474  obj_(obj),
1475  key_(key),
1476  pos_(pos),
1477  load_id_(GetNextId(isolate)),
1478  is_monomorphic_(false),
1479  is_uninitialized_(false),
1480  is_array_length_(false),
1481  is_string_length_(false),
1482  is_string_access_(false),
1483  is_function_prototype_(false) { }
1484 
1485  private:
1486  Expression* obj_;
1487  Expression* key_;
1488  int pos_;
1489  const BailoutId load_id_;
1490 
1491  SmallMapList receiver_types_;
1492  bool is_monomorphic_ : 1;
1493  bool is_uninitialized_ : 1;
1494  bool is_array_length_ : 1;
1495  bool is_string_length_ : 1;
1496  bool is_string_access_ : 1;
1497  bool is_function_prototype_ : 1;
1498 };
1499 
1500 
1501 class Call: public Expression {
1502  public:
1504 
1505  Expression* expression() const { return expression_; }
1506  ZoneList<Expression*>* arguments() const { return arguments_; }
1507  virtual int position() const { return pos_; }
1508 
1509  // Type feedback information.
1510  TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
1511  void RecordTypeFeedback(TypeFeedbackOracle* oracle, CallKind call_kind);
1512  virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
1513  virtual bool IsMonomorphic() { return is_monomorphic_; }
1514  CheckType check_type() const { return check_type_; }
1515  Handle<JSFunction> target() { return target_; }
1516 
1517  // A cache for the holder, set as a side effect of computing the target of the
1518  // call. Note that it contains the null handle when the receiver is the same
1519  // as the holder!
1520  Handle<JSObject> holder() { return holder_; }
1521 
1523 
1524  bool ComputeTarget(Handle<Map> type, Handle<String> name);
1525  bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup);
1526 
1527  BailoutId ReturnId() const { return return_id_; }
1528 
1529 #ifdef DEBUG
1530  // Used to assert that the FullCodeGenerator records the return site.
1531  bool return_is_recorded_;
1532 #endif
1533 
1534  protected:
1535  Call(Isolate* isolate,
1536  Expression* expression,
1537  ZoneList<Expression*>* arguments,
1538  int pos)
1539  : Expression(isolate),
1540  expression_(expression),
1541  arguments_(arguments),
1542  pos_(pos),
1543  is_monomorphic_(false),
1544  check_type_(RECEIVER_MAP_CHECK),
1545  return_id_(GetNextId(isolate)) { }
1546 
1547  private:
1548  Expression* expression_;
1549  ZoneList<Expression*>* arguments_;
1550  int pos_;
1551 
1552  bool is_monomorphic_;
1553  CheckType check_type_;
1554  SmallMapList receiver_types_;
1555  Handle<JSFunction> target_;
1556  Handle<JSObject> holder_;
1558 
1559  const BailoutId return_id_;
1560 };
1561 
1562 
1563 class CallNew: public Expression {
1564  public:
1566 
1567  Expression* expression() const { return expression_; }
1568  ZoneList<Expression*>* arguments() const { return arguments_; }
1569  virtual int position() const { return pos_; }
1570 
1571  // Type feedback information.
1572  TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); }
1573  void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1574  virtual bool IsMonomorphic() { return is_monomorphic_; }
1575  Handle<JSFunction> target() { return target_; }
1576 
1577  BailoutId ReturnId() const { return return_id_; }
1578 
1579  protected:
1580  CallNew(Isolate* isolate,
1581  Expression* expression,
1582  ZoneList<Expression*>* arguments,
1583  int pos)
1584  : Expression(isolate),
1585  expression_(expression),
1586  arguments_(arguments),
1587  pos_(pos),
1588  is_monomorphic_(false),
1589  return_id_(GetNextId(isolate)) { }
1590 
1591  private:
1592  Expression* expression_;
1593  ZoneList<Expression*>* arguments_;
1594  int pos_;
1595 
1596  bool is_monomorphic_;
1597  Handle<JSFunction> target_;
1598 
1599  const BailoutId return_id_;
1600 };
1601 
1602 
1603 // The CallRuntime class does not represent any official JavaScript
1604 // language construct. Instead it is used to call a C or JS function
1605 // with a set of arguments. This is used from the builtins that are
1606 // implemented in JavaScript (see "v8natives.js").
1607 class CallRuntime: public Expression {
1608  public:
1610 
1611  Handle<String> name() const { return name_; }
1612  const Runtime::Function* function() const { return function_; }
1613  ZoneList<Expression*>* arguments() const { return arguments_; }
1614  bool is_jsruntime() const { return function_ == NULL; }
1615 
1616  TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
1617 
1618  protected:
1620  Handle<String> name,
1621  const Runtime::Function* function,
1622  ZoneList<Expression*>* arguments)
1623  : Expression(isolate),
1624  name_(name),
1625  function_(function),
1626  arguments_(arguments) { }
1627 
1628  private:
1629  Handle<String> name_;
1630  const Runtime::Function* function_;
1631  ZoneList<Expression*>* arguments_;
1632 };
1633 
1634 
1636  public:
1638 
1639  virtual bool ResultOverwriteAllowed();
1640 
1641  Token::Value op() const { return op_; }
1642  Expression* expression() const { return expression_; }
1643  virtual int position() const { return pos_; }
1644 
1645  BailoutId MaterializeTrueId() { return materialize_true_id_; }
1646  BailoutId MaterializeFalseId() { return materialize_false_id_; }
1647 
1649 
1650  protected:
1652  Token::Value op,
1653  Expression* expression,
1654  int pos)
1655  : Expression(isolate),
1656  op_(op),
1657  expression_(expression),
1658  pos_(pos),
1659  materialize_true_id_(GetNextId(isolate)),
1660  materialize_false_id_(GetNextId(isolate)) {
1661  ASSERT(Token::IsUnaryOp(op));
1662  }
1663 
1664  private:
1665  Token::Value op_;
1666  Expression* expression_;
1667  int pos_;
1668 
1669  // For unary not (Token::NOT), the AST ids where true and false will
1670  // actually be materialized, respectively.
1671  const BailoutId materialize_true_id_;
1672  const BailoutId materialize_false_id_;
1673 };
1674 
1675 
1677  public:
1679 
1680  virtual bool ResultOverwriteAllowed();
1681 
1682  Token::Value op() const { return op_; }
1683  Expression* left() const { return left_; }
1684  Expression* right() const { return right_; }
1685  virtual int position() const { return pos_; }
1686 
1687  BailoutId RightId() const { return right_id_; }
1688 
1690 
1691  protected:
1693  Token::Value op,
1694  Expression* left,
1695  Expression* right,
1696  int pos)
1697  : Expression(isolate),
1698  op_(op),
1699  left_(left),
1700  right_(right),
1701  pos_(pos),
1702  right_id_(GetNextId(isolate)) {
1704  }
1705 
1706  private:
1707  Token::Value op_;
1708  Expression* left_;
1709  Expression* right_;
1710  int pos_;
1711  // The short-circuit logical operations need an AST ID for their
1712  // right-hand subexpression.
1713  const BailoutId right_id_;
1714 };
1715 
1716 
1718  public:
1720 
1721  bool is_prefix() const { return is_prefix_; }
1722  bool is_postfix() const { return !is_prefix_; }
1723 
1724  Token::Value op() const { return op_; }
1726  return (op() == Token::INC) ? Token::ADD : Token::SUB;
1727  }
1728 
1729  Expression* expression() const { return expression_; }
1730  virtual int position() const { return pos_; }
1731 
1732  virtual void MarkAsStatement() { is_prefix_ = true; }
1733 
1734  void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe);
1735  virtual bool IsMonomorphic() { return is_monomorphic_; }
1736  virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
1737 
1738  BailoutId AssignmentId() const { return assignment_id_; }
1739 
1740  TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; }
1741  TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
1742 
1743  protected:
1745  Token::Value op,
1746  bool is_prefix,
1747  Expression* expr,
1748  int pos)
1749  : Expression(isolate),
1750  op_(op),
1751  is_prefix_(is_prefix),
1752  expression_(expr),
1753  pos_(pos),
1754  assignment_id_(GetNextId(isolate)),
1755  count_id_(GetNextId(isolate)) {}
1756 
1757  private:
1758  Token::Value op_;
1759  bool is_prefix_;
1760  bool is_monomorphic_;
1761  Expression* expression_;
1762  int pos_;
1763  const BailoutId assignment_id_;
1764  const TypeFeedbackId count_id_;
1765  SmallMapList receiver_types_;
1766 };
1767 
1768 
1770  public:
1772 
1773  Token::Value op() const { return op_; }
1774  Expression* left() const { return left_; }
1775  Expression* right() const { return right_; }
1776  virtual int position() const { return pos_; }
1777 
1778  // Type feedback information.
1780  void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1781  bool IsSmiCompare() { return compare_type_ == SMI_ONLY; }
1782  bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; }
1783 
1784  // Match special cases.
1785  bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
1786  bool IsLiteralCompareUndefined(Expression** expr);
1787  bool IsLiteralCompareNull(Expression** expr);
1788 
1789  protected:
1791  Token::Value op,
1792  Expression* left,
1793  Expression* right,
1794  int pos)
1795  : Expression(isolate),
1796  op_(op),
1797  left_(left),
1798  right_(right),
1799  pos_(pos),
1800  compare_type_(NONE) {
1802  }
1803 
1804  private:
1805  Token::Value op_;
1806  Expression* left_;
1807  Expression* right_;
1808  int pos_;
1809 
1810  enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY };
1811  CompareTypeFeedback compare_type_;
1812 };
1813 
1814 
1815 class Conditional: public Expression {
1816  public:
1818 
1819  Expression* condition() const { return condition_; }
1820  Expression* then_expression() const { return then_expression_; }
1821  Expression* else_expression() const { return else_expression_; }
1822 
1823  int then_expression_position() const { return then_expression_position_; }
1824  int else_expression_position() const { return else_expression_position_; }
1825 
1826  BailoutId ThenId() const { return then_id_; }
1827  BailoutId ElseId() const { return else_id_; }
1828 
1829  protected:
1831  Expression* condition,
1832  Expression* then_expression,
1833  Expression* else_expression,
1834  int then_expression_position,
1835  int else_expression_position)
1836  : Expression(isolate),
1837  condition_(condition),
1838  then_expression_(then_expression),
1839  else_expression_(else_expression),
1840  then_expression_position_(then_expression_position),
1841  else_expression_position_(else_expression_position),
1842  then_id_(GetNextId(isolate)),
1843  else_id_(GetNextId(isolate)) { }
1844 
1845  private:
1846  Expression* condition_;
1847  Expression* then_expression_;
1848  Expression* else_expression_;
1849  int then_expression_position_;
1850  int else_expression_position_;
1851  const BailoutId then_id_;
1852  const BailoutId else_id_;
1853 };
1854 
1855 
1856 class Assignment: public Expression {
1857  public:
1859 
1860  Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; }
1861 
1862  Token::Value binary_op() const;
1863 
1864  Token::Value op() const { return op_; }
1865  Expression* target() const { return target_; }
1866  Expression* value() const { return value_; }
1867  virtual int position() const { return pos_; }
1868  BinaryOperation* binary_operation() const { return binary_operation_; }
1869 
1870  // This check relies on the definition order of token in token.h.
1871  bool is_compound() const { return op() > Token::ASSIGN; }
1872 
1873  BailoutId AssignmentId() const { return assignment_id_; }
1874 
1875  // Type feedback information.
1877  void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
1878  virtual bool IsMonomorphic() { return is_monomorphic_; }
1879  virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
1880 
1881  protected:
1882  Assignment(Isolate* isolate,
1883  Token::Value op,
1884  Expression* target,
1885  Expression* value,
1886  int pos);
1887 
1888  template<class Visitor>
1889  void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) {
1891  if (is_compound()) {
1892  binary_operation_ =
1893  factory->NewBinaryOperation(binary_op(), target_, value_, pos_ + 1);
1894  }
1895  }
1896 
1897  private:
1898  Token::Value op_;
1899  Expression* target_;
1900  Expression* value_;
1901  int pos_;
1902  BinaryOperation* binary_operation_;
1903  const BailoutId assignment_id_;
1904 
1905  bool is_monomorphic_;
1906  SmallMapList receiver_types_;
1907 };
1908 
1909 
1910 class Throw: public Expression {
1911  public:
1913 
1914  Expression* exception() const { return exception_; }
1915  virtual int position() const { return pos_; }
1916 
1917  protected:
1918  Throw(Isolate* isolate, Expression* exception, int pos)
1919  : Expression(isolate), exception_(exception), pos_(pos) {}
1920 
1921  private:
1922  Expression* exception_;
1923  int pos_;
1924 };
1925 
1926 
1928  public:
1929  enum Type {
1932  DECLARATION
1933  };
1934 
1936  kNoDuplicateParameters = 0,
1937  kHasDuplicateParameters = 1
1938  };
1939 
1942  kIsFunction
1943  };
1944 
1947  kNotParenthesized
1948  };
1949 
1951 
1952  Handle<String> name() const { return name_; }
1953  Scope* scope() const { return scope_; }
1954  ZoneList<Statement*>* body() const { return body_; }
1955  void set_function_token_position(int pos) { function_token_position_ = pos; }
1956  int function_token_position() const { return function_token_position_; }
1957  int start_position() const;
1958  int end_position() const;
1959  int SourceSize() const { return end_position() - start_position(); }
1960  bool is_expression() const { return IsExpression::decode(bitfield_); }
1961  bool is_anonymous() const { return IsAnonymous::decode(bitfield_); }
1962  bool is_classic_mode() const { return language_mode() == CLASSIC_MODE; }
1963  LanguageMode language_mode() const;
1964 
1965  int materialized_literal_count() { return materialized_literal_count_; }
1966  int expected_property_count() { return expected_property_count_; }
1967  int handler_count() { return handler_count_; }
1969  return HasOnlySimpleThisPropertyAssignments::decode(bitfield_);
1970  }
1972  return this_property_assignments_;
1973  }
1974  int parameter_count() { return parameter_count_; }
1975 
1976  bool AllowsLazyCompilation();
1977  bool AllowsLazyCompilationWithoutContext();
1978 
1980  if (name_->length() > 0) return name_;
1981  return inferred_name();
1982  }
1983 
1984  Handle<String> inferred_name() const { return inferred_name_; }
1985  void set_inferred_name(Handle<String> inferred_name) {
1986  inferred_name_ = inferred_name;
1987  }
1988 
1989  bool pretenure() { return Pretenure::decode(bitfield_); }
1990  void set_pretenure() { bitfield_ |= Pretenure::encode(true); }
1991 
1993  return HasDuplicateParameters::decode(bitfield_);
1994  }
1995 
1996  bool is_function() { return IsFunction::decode(bitfield_) == kIsFunction; }
1997 
1998  // This is used as a heuristic on when to eagerly compile a function
1999  // literal. We consider the following constructs as hints that the
2000  // function will be called immediately:
2001  // - (function() { ... })();
2002  // - var x = function() { ... }();
2004  return IsParenthesized::decode(bitfield_) == kIsParenthesized;
2005  }
2007  bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized);
2008  }
2009 
2010  int ast_node_count() { return ast_properties_.node_count(); }
2011  AstProperties::Flags* flags() { return ast_properties_.flags(); }
2012  void set_ast_properties(AstProperties* ast_properties) {
2013  ast_properties_ = *ast_properties;
2014  }
2015 
2016  protected:
2018  Handle<String> name,
2019  Scope* scope,
2020  ZoneList<Statement*>* body,
2021  int materialized_literal_count,
2022  int expected_property_count,
2023  int handler_count,
2024  bool has_only_simple_this_property_assignments,
2025  Handle<FixedArray> this_property_assignments,
2026  int parameter_count,
2027  Type type,
2028  ParameterFlag has_duplicate_parameters,
2029  IsFunctionFlag is_function,
2030  IsParenthesizedFlag is_parenthesized)
2031  : Expression(isolate),
2032  name_(name),
2033  scope_(scope),
2034  body_(body),
2035  this_property_assignments_(this_property_assignments),
2036  inferred_name_(isolate->factory()->empty_string()),
2037  materialized_literal_count_(materialized_literal_count),
2038  expected_property_count_(expected_property_count),
2039  handler_count_(handler_count),
2040  parameter_count_(parameter_count),
2041  function_token_position_(RelocInfo::kNoPosition) {
2042  bitfield_ =
2043  HasOnlySimpleThisPropertyAssignments::encode(
2044  has_only_simple_this_property_assignments) |
2045  IsExpression::encode(type != DECLARATION) |
2046  IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) |
2047  Pretenure::encode(false) |
2048  HasDuplicateParameters::encode(has_duplicate_parameters) |
2049  IsFunction::encode(is_function) |
2050  IsParenthesized::encode(is_parenthesized);
2051  }
2052 
2053  private:
2054  Handle<String> name_;
2055  Scope* scope_;
2056  ZoneList<Statement*>* body_;
2057  Handle<FixedArray> this_property_assignments_;
2058  Handle<String> inferred_name_;
2059  AstProperties ast_properties_;
2060 
2061  int materialized_literal_count_;
2062  int expected_property_count_;
2063  int handler_count_;
2064  int parameter_count_;
2065  int function_token_position_;
2066 
2067  unsigned bitfield_;
2068  class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {};
2069  class IsExpression: public BitField<bool, 1, 1> {};
2070  class IsAnonymous: public BitField<bool, 2, 1> {};
2071  class Pretenure: public BitField<bool, 3, 1> {};
2072  class HasDuplicateParameters: public BitField<ParameterFlag, 4, 1> {};
2073  class IsFunction: public BitField<IsFunctionFlag, 5, 1> {};
2074  class IsParenthesized: public BitField<IsParenthesizedFlag, 6, 1> {};
2075 };
2076 
2077 
2079  public:
2081 
2082  Handle<SharedFunctionInfo> shared_function_info() const {
2083  return shared_function_info_;
2084  }
2085 
2086  protected:
2088  Isolate* isolate,
2089  Handle<SharedFunctionInfo> shared_function_info)
2090  : Expression(isolate),
2091  shared_function_info_(shared_function_info) { }
2092 
2093  private:
2094  Handle<SharedFunctionInfo> shared_function_info_;
2095 };
2096 
2097 
2098 class ThisFunction: public Expression {
2099  public:
2101 
2102  protected:
2103  explicit ThisFunction(Isolate* isolate): Expression(isolate) {}
2104 };
2105 
2106 #undef DECLARE_NODE_TYPE
2107 
2108 
2109 // ----------------------------------------------------------------------------
2110 // Regular expressions
2111 
2112 
2113 class RegExpVisitor BASE_EMBEDDED {
2114  public:
2115  virtual ~RegExpVisitor() { }
2116 #define MAKE_CASE(Name) \
2117  virtual void* Visit##Name(RegExp##Name*, void* data) = 0;
2119 #undef MAKE_CASE
2120 };
2121 
2122 
2123 class RegExpTree: public ZoneObject {
2124  public:
2125  static const int kInfinity = kMaxInt;
2126  virtual ~RegExpTree() { }
2127  virtual void* Accept(RegExpVisitor* visitor, void* data) = 0;
2128  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2129  RegExpNode* on_success) = 0;
2130  virtual bool IsTextElement() { return false; }
2131  virtual bool IsAnchoredAtStart() { return false; }
2132  virtual bool IsAnchoredAtEnd() { return false; }
2133  virtual int min_match() = 0;
2134  virtual int max_match() = 0;
2135  // Returns the interval of registers used for captures within this
2136  // expression.
2138  virtual void AppendToText(RegExpText* text, Zone* zone);
2139  SmartArrayPointer<const char> ToString(Zone* zone);
2140 #define MAKE_ASTYPE(Name) \
2141  virtual RegExp##Name* As##Name(); \
2142  virtual bool Is##Name();
2144 #undef MAKE_ASTYPE
2145 };
2146 
2147 
2149  public:
2150  explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
2151  virtual void* Accept(RegExpVisitor* visitor, void* data);
2152  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2153  RegExpNode* on_success);
2154  virtual RegExpDisjunction* AsDisjunction();
2155  virtual Interval CaptureRegisters();
2156  virtual bool IsDisjunction();
2157  virtual bool IsAnchoredAtStart();
2158  virtual bool IsAnchoredAtEnd();
2159  virtual int min_match() { return min_match_; }
2160  virtual int max_match() { return max_match_; }
2161  ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
2162  private:
2163  ZoneList<RegExpTree*>* alternatives_;
2164  int min_match_;
2165  int max_match_;
2166 };
2167 
2168 
2170  public:
2171  explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
2172  virtual void* Accept(RegExpVisitor* visitor, void* data);
2173  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2174  RegExpNode* on_success);
2175  virtual RegExpAlternative* AsAlternative();
2176  virtual Interval CaptureRegisters();
2177  virtual bool IsAlternative();
2178  virtual bool IsAnchoredAtStart();
2179  virtual bool IsAnchoredAtEnd();
2180  virtual int min_match() { return min_match_; }
2181  virtual int max_match() { return max_match_; }
2182  ZoneList<RegExpTree*>* nodes() { return nodes_; }
2183  private:
2184  ZoneList<RegExpTree*>* nodes_;
2185  int min_match_;
2186  int max_match_;
2187 };
2188 
2189 
2191  public:
2192  enum Type {
2198  NON_BOUNDARY
2199  };
2200  explicit RegExpAssertion(Type type) : type_(type) { }
2201  virtual void* Accept(RegExpVisitor* visitor, void* data);
2202  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2203  RegExpNode* on_success);
2204  virtual RegExpAssertion* AsAssertion();
2205  virtual bool IsAssertion();
2206  virtual bool IsAnchoredAtStart();
2207  virtual bool IsAnchoredAtEnd();
2208  virtual int min_match() { return 0; }
2209  virtual int max_match() { return 0; }
2210  Type type() { return type_; }
2211  private:
2212  Type type_;
2213 };
2214 
2215 
2216 class CharacterSet BASE_EMBEDDED {
2217  public:
2218  explicit CharacterSet(uc16 standard_set_type)
2219  : ranges_(NULL),
2220  standard_set_type_(standard_set_type) {}
2222  : ranges_(ranges),
2223  standard_set_type_(0) {}
2224  ZoneList<CharacterRange>* ranges(Zone* zone);
2225  uc16 standard_set_type() { return standard_set_type_; }
2226  void set_standard_set_type(uc16 special_set_type) {
2227  standard_set_type_ = special_set_type;
2228  }
2229  bool is_standard() { return standard_set_type_ != 0; }
2230  void Canonicalize();
2231  private:
2232  ZoneList<CharacterRange>* ranges_;
2233  // If non-zero, the value represents a standard set (e.g., all whitespace
2234  // characters) without having to expand the ranges.
2235  uc16 standard_set_type_;
2236 };
2237 
2238 
2240  public:
2242  : set_(ranges),
2243  is_negated_(is_negated) { }
2245  : set_(type),
2246  is_negated_(false) { }
2247  virtual void* Accept(RegExpVisitor* visitor, void* data);
2248  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2249  RegExpNode* on_success);
2250  virtual RegExpCharacterClass* AsCharacterClass();
2251  virtual bool IsCharacterClass();
2252  virtual bool IsTextElement() { return true; }
2253  virtual int min_match() { return 1; }
2254  virtual int max_match() { return 1; }
2255  virtual void AppendToText(RegExpText* text, Zone* zone);
2256  CharacterSet character_set() { return set_; }
2257  // TODO(lrn): Remove need for complex version if is_standard that
2258  // recognizes a mangled standard set and just do { return set_.is_special(); }
2259  bool is_standard(Zone* zone);
2260  // Returns a value representing the standard character set if is_standard()
2261  // returns true.
2262  // Currently used values are:
2263  // s : unicode whitespace
2264  // S : unicode non-whitespace
2265  // w : ASCII word character (digit, letter, underscore)
2266  // W : non-ASCII word character
2267  // d : ASCII digit
2268  // D : non-ASCII digit
2269  // . : non-unicode non-newline
2270  // * : All characters
2271  uc16 standard_type() { return set_.standard_set_type(); }
2272  ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); }
2273  bool is_negated() { return is_negated_; }
2274 
2275  private:
2276  CharacterSet set_;
2277  bool is_negated_;
2278 };
2279 
2280 
2281 class RegExpAtom: public RegExpTree {
2282  public:
2283  explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
2284  virtual void* Accept(RegExpVisitor* visitor, void* data);
2285  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2286  RegExpNode* on_success);
2287  virtual RegExpAtom* AsAtom();
2288  virtual bool IsAtom();
2289  virtual bool IsTextElement() { return true; }
2290  virtual int min_match() { return data_.length(); }
2291  virtual int max_match() { return data_.length(); }
2292  virtual void AppendToText(RegExpText* text, Zone* zone);
2293  Vector<const uc16> data() { return data_; }
2294  int length() { return data_.length(); }
2295  private:
2296  Vector<const uc16> data_;
2297 };
2298 
2299 
2300 class RegExpText: public RegExpTree {
2301  public:
2302  explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {}
2303  virtual void* Accept(RegExpVisitor* visitor, void* data);
2304  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2305  RegExpNode* on_success);
2306  virtual RegExpText* AsText();
2307  virtual bool IsText();
2308  virtual bool IsTextElement() { return true; }
2309  virtual int min_match() { return length_; }
2310  virtual int max_match() { return length_; }
2311  virtual void AppendToText(RegExpText* text, Zone* zone);
2312  void AddElement(TextElement elm, Zone* zone) {
2313  elements_.Add(elm, zone);
2314  length_ += elm.length();
2315  }
2316  ZoneList<TextElement>* elements() { return &elements_; }
2317  private:
2318  ZoneList<TextElement> elements_;
2319  int length_;
2320 };
2321 
2322 
2324  public:
2325  enum Type { GREEDY, NON_GREEDY, POSSESSIVE };
2326  RegExpQuantifier(int min, int max, Type type, RegExpTree* body)
2327  : body_(body),
2328  min_(min),
2329  max_(max),
2330  min_match_(min * body->min_match()),
2331  type_(type) {
2332  if (max > 0 && body->max_match() > kInfinity / max) {
2333  max_match_ = kInfinity;
2334  } else {
2335  max_match_ = max * body->max_match();
2336  }
2337  }
2338  virtual void* Accept(RegExpVisitor* visitor, void* data);
2339  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2340  RegExpNode* on_success);
2341  static RegExpNode* ToNode(int min,
2342  int max,
2343  bool is_greedy,
2344  RegExpTree* body,
2345  RegExpCompiler* compiler,
2346  RegExpNode* on_success,
2347  bool not_at_start = false);
2348  virtual RegExpQuantifier* AsQuantifier();
2349  virtual Interval CaptureRegisters();
2350  virtual bool IsQuantifier();
2351  virtual int min_match() { return min_match_; }
2352  virtual int max_match() { return max_match_; }
2353  int min() { return min_; }
2354  int max() { return max_; }
2355  bool is_possessive() { return type_ == POSSESSIVE; }
2356  bool is_non_greedy() { return type_ == NON_GREEDY; }
2357  bool is_greedy() { return type_ == GREEDY; }
2358  RegExpTree* body() { return body_; }
2359 
2360  private:
2361  RegExpTree* body_;
2362  int min_;
2363  int max_;
2364  int min_match_;
2365  int max_match_;
2366  Type type_;
2367 };
2368 
2369 
2370 class RegExpCapture: public RegExpTree {
2371  public:
2372  explicit RegExpCapture(RegExpTree* body, int index)
2373  : body_(body), index_(index) { }
2374  virtual void* Accept(RegExpVisitor* visitor, void* data);
2375  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2376  RegExpNode* on_success);
2377  static RegExpNode* ToNode(RegExpTree* body,
2378  int index,
2379  RegExpCompiler* compiler,
2380  RegExpNode* on_success);
2381  virtual RegExpCapture* AsCapture();
2382  virtual bool IsAnchoredAtStart();
2383  virtual bool IsAnchoredAtEnd();
2384  virtual Interval CaptureRegisters();
2385  virtual bool IsCapture();
2386  virtual int min_match() { return body_->min_match(); }
2387  virtual int max_match() { return body_->max_match(); }
2388  RegExpTree* body() { return body_; }
2389  int index() { return index_; }
2390  static int StartRegister(int index) { return index * 2; }
2391  static int EndRegister(int index) { return index * 2 + 1; }
2392 
2393  private:
2394  RegExpTree* body_;
2395  int index_;
2396 };
2397 
2398 
2400  public:
2402  bool is_positive,
2403  int capture_count,
2404  int capture_from)
2405  : body_(body),
2406  is_positive_(is_positive),
2407  capture_count_(capture_count),
2408  capture_from_(capture_from) { }
2409 
2410  virtual void* Accept(RegExpVisitor* visitor, void* data);
2411  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2412  RegExpNode* on_success);
2413  virtual RegExpLookahead* AsLookahead();
2414  virtual Interval CaptureRegisters();
2415  virtual bool IsLookahead();
2416  virtual bool IsAnchoredAtStart();
2417  virtual int min_match() { return 0; }
2418  virtual int max_match() { return 0; }
2419  RegExpTree* body() { return body_; }
2420  bool is_positive() { return is_positive_; }
2421  int capture_count() { return capture_count_; }
2422  int capture_from() { return capture_from_; }
2423 
2424  private:
2425  RegExpTree* body_;
2426  bool is_positive_;
2427  int capture_count_;
2428  int capture_from_;
2429 };
2430 
2431 
2433  public:
2435  : capture_(capture) { }
2436  virtual void* Accept(RegExpVisitor* visitor, void* data);
2437  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2438  RegExpNode* on_success);
2439  virtual RegExpBackReference* AsBackReference();
2440  virtual bool IsBackReference();
2441  virtual int min_match() { return 0; }
2442  virtual int max_match() { return capture_->max_match(); }
2443  int index() { return capture_->index(); }
2444  RegExpCapture* capture() { return capture_; }
2445  private:
2446  RegExpCapture* capture_;
2447 };
2448 
2449 
2450 class RegExpEmpty: public RegExpTree {
2451  public:
2453  virtual void* Accept(RegExpVisitor* visitor, void* data);
2454  virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2455  RegExpNode* on_success);
2456  virtual RegExpEmpty* AsEmpty();
2457  virtual bool IsEmpty();
2458  virtual int min_match() { return 0; }
2459  virtual int max_match() { return 0; }
2461  static RegExpEmpty* instance = ::new RegExpEmpty();
2462  return instance;
2463  }
2464 };
2465 
2466 
2467 // ----------------------------------------------------------------------------
2468 // Out-of-line inline constructors (to side-step cyclic dependencies).
2469 
2471  : Module(proxy->interface()),
2472  proxy_(proxy) {
2473 }
2474 
2475 
2476 // ----------------------------------------------------------------------------
2477 // Basic visitor
2478 // - leaf node visitors are abstract.
2479 
2480 class AstVisitor BASE_EMBEDDED {
2481  public:
2482  AstVisitor() : isolate_(Isolate::Current()), stack_overflow_(false) { }
2483  virtual ~AstVisitor() { }
2484 
2485  // Stack overflow check and dynamic dispatch.
2486  void Visit(AstNode* node) { if (!CheckStackOverflow()) node->Accept(this); }
2487 
2488  // Iteration left-to-right.
2489  virtual void VisitDeclarations(ZoneList<Declaration*>* declarations);
2490  virtual void VisitStatements(ZoneList<Statement*>* statements);
2491  virtual void VisitExpressions(ZoneList<Expression*>* expressions);
2492 
2493  // Stack overflow tracking support.
2494  bool HasStackOverflow() const { return stack_overflow_; }
2495  bool CheckStackOverflow();
2496 
2497  // If a stack-overflow exception is encountered when visiting a
2498  // node, calling SetStackOverflow will make sure that the visitor
2499  // bails out without visiting more nodes.
2500  void SetStackOverflow() { stack_overflow_ = true; }
2501  void ClearStackOverflow() { stack_overflow_ = false; }
2502 
2503  // Individual AST nodes.
2504 #define DEF_VISIT(type) \
2505  virtual void Visit##type(type* node) = 0;
2507 #undef DEF_VISIT
2508 
2509  protected:
2510  Isolate* isolate() { return isolate_; }
2511 
2512  private:
2513  Isolate* isolate_;
2514  bool stack_overflow_;
2515 };
2516 
2517 
2518 // ----------------------------------------------------------------------------
2519 // Construction time visitor.
2520 
2521 class AstConstructionVisitor BASE_EMBEDDED {
2522  public:
2524 
2525  AstProperties* ast_properties() { return &properties_; }
2526 
2527  private:
2528  template<class> friend class AstNodeFactory;
2529 
2530  // Node visitors.
2531 #define DEF_VISIT(type) \
2532  void Visit##type(type* node);
2534 #undef DEF_VISIT
2535 
2536  void increase_node_count() { properties_.add_node_count(1); }
2537  void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
2538 
2539  AstProperties properties_;
2540 };
2541 
2542 
2543 class AstNullVisitor BASE_EMBEDDED {
2544  public:
2545  // Node visitors.
2546 #define DEF_VISIT(type) \
2547  void Visit##type(type* node) {}
2549 #undef DEF_VISIT
2550 };
2551 
2552 
2553 
2554 // ----------------------------------------------------------------------------
2555 // AstNode factory
2556 
2557 template<class Visitor>
2558 class AstNodeFactory BASE_EMBEDDED {
2559  public:
2560  AstNodeFactory(Isolate* isolate, Zone* zone)
2561  : isolate_(isolate),
2562  zone_(zone) { }
2563 
2564  Visitor* visitor() { return &visitor_; }
2565 
2566 #define VISIT_AND_RETURN(NodeType, node) \
2567  visitor_.Visit##NodeType((node)); \
2568  return node;
2569 
2571  VariableMode mode,
2572  Scope* scope) {
2573  VariableDeclaration* decl =
2574  new(zone_) VariableDeclaration(proxy, mode, scope);
2576  }
2577 
2579  VariableMode mode,
2580  FunctionLiteral* fun,
2581  Scope* scope) {
2582  FunctionDeclaration* decl =
2583  new(zone_) FunctionDeclaration(proxy, mode, fun, scope);
2585  }
2586 
2588  Module* module,
2589  Scope* scope) {
2590  ModuleDeclaration* decl =
2591  new(zone_) ModuleDeclaration(proxy, module, scope);
2593  }
2594 
2596  Module* module,
2597  Scope* scope) {
2598  ImportDeclaration* decl =
2599  new(zone_) ImportDeclaration(proxy, module, scope);
2601  }
2602 
2604  Scope* scope) {
2605  ExportDeclaration* decl =
2606  new(zone_) ExportDeclaration(proxy, scope);
2608  }
2609 
2611  ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface);
2613  }
2614 
2616  ModuleVariable* module = new(zone_) ModuleVariable(proxy);
2618  }
2619 
2621  ModulePath* module = new(zone_) ModulePath(origin, name, zone_);
2622  VISIT_AND_RETURN(ModulePath, module)
2623  }
2624 
2626  ModuleUrl* module = new(zone_) ModuleUrl(url, zone_);
2627  VISIT_AND_RETURN(ModuleUrl, module)
2628  }
2629 
2631  int capacity,
2632  bool is_initializer_block) {
2633  Block* block = new(zone_) Block(
2634  isolate_, labels, capacity, is_initializer_block, zone_);
2635  VISIT_AND_RETURN(Block, block)
2636  }
2637 
2638 #define STATEMENT_WITH_LABELS(NodeType) \
2639  NodeType* New##NodeType(ZoneStringList* labels) { \
2640  NodeType* stmt = new(zone_) NodeType(isolate_, labels); \
2641  VISIT_AND_RETURN(NodeType, stmt); \
2642  }
2643  STATEMENT_WITH_LABELS(DoWhileStatement)
2644  STATEMENT_WITH_LABELS(WhileStatement)
2645  STATEMENT_WITH_LABELS(ForStatement)
2646  STATEMENT_WITH_LABELS(ForInStatement)
2647  STATEMENT_WITH_LABELS(SwitchStatement)
2648 #undef STATEMENT_WITH_LABELS
2649 
2651  ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression);
2653  }
2654 
2656  ContinueStatement* stmt = new(zone_) ContinueStatement(target);
2658  }
2659 
2661  BreakStatement* stmt = new(zone_) BreakStatement(target);
2663  }
2664 
2666  ReturnStatement* stmt = new(zone_) ReturnStatement(expression);
2668  }
2669 
2671  Statement* statement) {
2672  WithStatement* stmt = new(zone_) WithStatement(expression, statement);
2674  }
2675 
2677  Statement* then_statement,
2678  Statement* else_statement) {
2679  IfStatement* stmt = new(zone_) IfStatement(
2680  isolate_, condition, then_statement, else_statement);
2682  }
2683 
2685  Block* try_block,
2686  Scope* scope,
2687  Variable* variable,
2688  Block* catch_block) {
2689  TryCatchStatement* stmt = new(zone_) TryCatchStatement(
2690  index, try_block, scope, variable, catch_block);
2692  }
2693 
2695  Block* try_block,
2696  Block* finally_block) {
2697  TryFinallyStatement* stmt =
2698  new(zone_) TryFinallyStatement(index, try_block, finally_block);
2700  }
2701 
2703  DebuggerStatement* stmt = new(zone_) DebuggerStatement();
2705  }
2706 
2708  return new(zone_) EmptyStatement();
2709  }
2710 
2712  Literal* lit = new(zone_) Literal(isolate_, handle);
2714  }
2715 
2716  Literal* NewNumberLiteral(double number) {
2717  return NewLiteral(isolate_->factory()->NewNumber(number, TENURED));
2718  }
2719 
2721  Handle<FixedArray> constant_properties,
2723  int literal_index,
2724  bool is_simple,
2725  bool fast_elements,
2726  int depth,
2727  bool has_function) {
2728  ObjectLiteral* lit = new(zone_) ObjectLiteral(
2729  isolate_, constant_properties, properties, literal_index,
2730  is_simple, fast_elements, depth, has_function);
2732  }
2733 
2735  FunctionLiteral* value) {
2736  ObjectLiteral::Property* prop =
2737  new(zone_) ObjectLiteral::Property(is_getter, value);
2738  prop->set_key(NewLiteral(value->name()));
2739  return prop; // Not an AST node, will not be visited.
2740  }
2741 
2744  int literal_index) {
2745  RegExpLiteral* lit =
2746  new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index);
2748  }
2749 
2751  ZoneList<Expression*>* values,
2752  int literal_index,
2753  bool is_simple,
2754  int depth) {
2755  ArrayLiteral* lit = new(zone_) ArrayLiteral(
2756  isolate_, constant_elements, values, literal_index, is_simple, depth);
2758  }
2759 
2761  VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var);
2763  }
2764 
2766  bool is_this,
2768  int position = RelocInfo::kNoPosition) {
2769  VariableProxy* proxy =
2770  new(zone_) VariableProxy(isolate_, name, is_this, interface, position);
2772  }
2773 
2774  Property* NewProperty(Expression* obj, Expression* key, int pos) {
2775  Property* prop = new(zone_) Property(isolate_, obj, key, pos);
2776  VISIT_AND_RETURN(Property, prop)
2777  }
2778 
2779  Call* NewCall(Expression* expression,
2780  ZoneList<Expression*>* arguments,
2781  int pos) {
2782  Call* call = new(zone_) Call(isolate_, expression, arguments, pos);
2783  VISIT_AND_RETURN(Call, call)
2784  }
2785 
2787  ZoneList<Expression*>* arguments,
2788  int pos) {
2789  CallNew* call = new(zone_) CallNew(isolate_, expression, arguments, pos);
2790  VISIT_AND_RETURN(CallNew, call)
2791  }
2792 
2794  const Runtime::Function* function,
2795  ZoneList<Expression*>* arguments) {
2796  CallRuntime* call =
2797  new(zone_) CallRuntime(isolate_, name, function, arguments);
2799  }
2800 
2802  Expression* expression,
2803  int pos) {
2804  UnaryOperation* node =
2805  new(zone_) UnaryOperation(isolate_, op, expression, pos);
2807  }
2808 
2810  Expression* left,
2811  Expression* right,
2812  int pos) {
2813  BinaryOperation* node =
2814  new(zone_) BinaryOperation(isolate_, op, left, right, pos);
2816  }
2817 
2819  bool is_prefix,
2820  Expression* expr,
2821  int pos) {
2822  CountOperation* node =
2823  new(zone_) CountOperation(isolate_, op, is_prefix, expr, pos);
2825  }
2826 
2828  Expression* left,
2829  Expression* right,
2830  int pos) {
2831  CompareOperation* node =
2832  new(zone_) CompareOperation(isolate_, op, left, right, pos);
2834  }
2835 
2837  Expression* then_expression,
2838  Expression* else_expression,
2839  int then_expression_position,
2840  int else_expression_position) {
2841  Conditional* cond = new(zone_) Conditional(
2842  isolate_, condition, then_expression, else_expression,
2843  then_expression_position, else_expression_position);
2845  }
2846 
2848  Expression* target,
2849  Expression* value,
2850  int pos) {
2851  Assignment* assign =
2852  new(zone_) Assignment(isolate_, op, target, value, pos);
2853  assign->Init(isolate_, this);
2854  VISIT_AND_RETURN(Assignment, assign)
2855  }
2856 
2857  Throw* NewThrow(Expression* exception, int pos) {
2858  Throw* t = new(zone_) Throw(isolate_, exception, pos);
2860  }
2861 
2863  Handle<String> name,
2864  Scope* scope,
2865  ZoneList<Statement*>* body,
2866  int materialized_literal_count,
2867  int expected_property_count,
2868  int handler_count,
2869  bool has_only_simple_this_property_assignments,
2870  Handle<FixedArray> this_property_assignments,
2871  int parameter_count,
2872  FunctionLiteral::ParameterFlag has_duplicate_parameters,
2873  FunctionLiteral::Type type,
2874  FunctionLiteral::IsFunctionFlag is_function,
2875  FunctionLiteral::IsParenthesizedFlag is_parenthesized) {
2876  FunctionLiteral* lit = new(zone_) FunctionLiteral(
2877  isolate_, name, scope, body,
2878  materialized_literal_count, expected_property_count, handler_count,
2879  has_only_simple_this_property_assignments, this_property_assignments,
2880  parameter_count, type, has_duplicate_parameters, is_function,
2881  is_parenthesized);
2882  // Top-level literal doesn't count for the AST's properties.
2883  if (is_function == FunctionLiteral::kIsFunction) {
2884  visitor_.VisitFunctionLiteral(lit);
2885  }
2886  return lit;
2887  }
2888 
2890  Handle<SharedFunctionInfo> shared_function_info) {
2892  new(zone_) SharedFunctionInfoLiteral(isolate_, shared_function_info);
2894  }
2895 
2897  ThisFunction* fun = new(zone_) ThisFunction(isolate_);
2899  }
2900 
2901 #undef VISIT_AND_RETURN
2902 
2903  private:
2904  Isolate* isolate_;
2905  Zone* zone_;
2906  Visitor visitor_;
2907 };
2908 
2909 
2910 } } // namespace v8::internal
2911 
2912 #endif // V8_AST_H_
ZoneList< TextElement > * elements()
Definition: ast.h:2316
Block(Isolate *isolate, ZoneStringList *labels, int capacity, bool is_initializer_block, Zone *zone)
Definition: ast.h:423
virtual int max_match()
Definition: ast.h:2181
FunctionDeclaration * NewFunctionDeclaration(VariableProxy *proxy, VariableMode mode, FunctionLiteral *fun, Scope *scope)
Definition: ast.h:2578
const SwVfpRegister s2
virtual BailoutId StackCheckId() const
Definition: ast.h:735
Visitor * visitor()
Definition: ast.h:2564
RegExpLiteral(Isolate *isolate, Handle< String > pattern, Handle< String > flags, int literal_index)
Definition: ast.h:1346
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage including on console Map counters to a file Enable debugger compile events enable GDBJIT interface(disables compacting GC)") DEFINE_bool(gdbjit_full
bool IsFalse() const
Definition: ast.h:1178
virtual bool IsMonomorphic()
Definition: ast.h:1462
void set_condition_position(int pos)
Definition: ast.h:694
virtual int position() const
Definition: ast.h:1867
TypeFeedbackId test_id() const
Definition: ast.h:353
void set_may_have_function_literal(bool value)
Definition: ast.h:730
Handle< JSGlobalPropertyCell > cell()
Definition: ast.h:1522
Handle< FixedArray > this_property_assignments()
Definition: ast.h:1971
ModuleVariable(VariableProxy *proxy)
Definition: ast.h:2470
virtual int min_match()
Definition: ast.h:2208
#define FOR_EACH_REG_EXP_TREE_TYPE(VISIT)
Definition: jsregexp.h:411
Handle< Map > at(int i) const
Definition: ast.h:278
RegExpText(Zone *zone)
Definition: ast.h:2302
Property(Isolate *isolate, Expression *obj, Expression *key, int pos)
Definition: ast.h:1469
virtual bool IsTextElement()
Definition: ast.h:2130
TryFinallyStatement(int index, Block *try_block, Block *finally_block)
Definition: ast.h:1122
Expression * right() const
Definition: ast.h:1775
virtual int position() const
Definition: ast.h:1776
TypeFeedbackId CallNewFeedbackId() const
Definition: ast.h:1572
Expression * obj() const
Definition: ast.h:1450
BailoutId PrepareId() const
Definition: ast.h:827
ModulePath(Module *module, Handle< String > name, Zone *zone)
Definition: ast.h:620
bool is_default() const
Definition: ast.h:934
TypeFeedbackId CallFeedbackId() const
Definition: ast.h:1510
Expression * condition() const
Definition: ast.h:1009
Expression * left() const
Definition: ast.h:1683
virtual BailoutId ContinueId() const
Definition: ast.h:779
Expression * cond() const
Definition: ast.h:769
Block * try_block() const
Definition: ast.h:1070
virtual int position() const
Definition: ast.h:1452
void set_escaping_targets(ZoneList< Label * > *targets)
Definition: ast.h:1065
Handle< Map > GetMonomorphicReceiverType()
Definition: ast.h:345
virtual int position() const
Definition: ast.h:307
Call(Isolate *isolate, Expression *expression, ZoneList< Expression * > *arguments, int pos)
Definition: ast.h:1535
static String * cast(Object *obj)
TypeFeedbackId UnaryOperationFeedbackId() const
Definition: ast.h:1648
virtual void MarkAsStatement()
Definition: ast.h:1732
ModuleLiteral * NewModuleLiteral(Block *body, Interface *interface)
Definition: ast.h:2610
Block * NewBlock(ZoneStringList *labels, int capacity, bool is_initializer_block)
Definition: ast.h:2630
Handle< JSFunction > target()
Definition: ast.h:1515
Definition: v8.h:869
RegExpLiteral * NewRegExpLiteral(Handle< String > pattern, Handle< String > flags, int literal_index)
Definition: ast.h:2742
Expression * expression() const
Definition: ast.h:1729
virtual bool IsMonomorphic()
Definition: ast.h:1513
Module(Interface *interface, Block *body=NULL)
Definition: ast.h:579
CharacterSet character_set()
Definition: ast.h:2256
ZoneList< CharacterRange > * ranges(Zone *zone)
Definition: ast.h:2272
ForInStatement(Isolate *isolate, ZoneStringList *labels)
Definition: ast.h:832
CallRuntime(Isolate *isolate, Handle< String > name, const Runtime::Function *function, ZoneList< Expression * > *arguments)
Definition: ast.h:1619
Handle< String > AsPropertyName()
Definition: ast.h:1161
ZoneList< Expression * > * arguments() const
Definition: ast.h:1506
virtual InitializationFlag initialization() const
Definition: ast.h:490
static bool IsCompareOp(Value op)
Definition: token.h:214
static Handle< T > cast(Handle< S > that)
Definition: handles.h:81
BreakStatement(BreakableStatement *target)
Definition: ast.h:886
ExportDeclaration(VariableProxy *proxy, Scope *scope)
Definition: ast.h:565
Expression * target() const
Definition: ast.h:1865
RegExpTree * body()
Definition: ast.h:2419
ExpressionStatement * NewExpressionStatement(Expression *expression)
Definition: ast.h:2650
static bool IsUnaryOp(Value op)
Definition: token.h:260
Handle< JSObject > holder()
Definition: ast.h:1520
ThisFunction(Isolate *isolate)
Definition: ast.h:2103
BailoutId ThenId() const
Definition: ast.h:1826
VariableDeclaration * NewVariableDeclaration(VariableProxy *proxy, VariableMode mode, Scope *scope)
Definition: ast.h:2570
BailoutId BackEdgeId() const
Definition: ast.h:698
void set_standard_set_type(uc16 special_set_type)
Definition: ast.h:2226
virtual BailoutId ContinueId() const
Definition: ast.h:824
BailoutId id() const
Definition: ast.h:352
Statement * init() const
Definition: ast.h:768
uint32_t Hash()
Definition: ast.h:1187
bool is_expression() const
Definition: ast.h:1960
TypeFeedbackId CountBinOpFeedbackId() const
Definition: ast.h:1740
bool is_classic_mode() const
Definition: ast.h:1962
bool IsVariable(Handle< String > n)
Definition: ast.h:1400
virtual bool IsMonomorphic()
Definition: ast.h:337
Statement * next() const
Definition: ast.h:770
virtual bool IsTextElement()
Definition: ast.h:2308
virtual ~RegExpTree()
Definition: ast.h:2126
virtual void Accept(AstVisitor *v)
Definition: ast.h:1052
ZoneList< Expression * > * arguments() const
Definition: ast.h:1613
ModuleUrl * NewModuleUrl(Handle< String > url)
Definition: ast.h:2625
const int kMaxInt
Definition: globals.h:210
virtual bool ResultOverwriteAllowed()
Definition: ast.h:325
TypeFeedbackId PropertyFeedbackId()
Definition: ast.h:1466
SmallMapList(int capacity, Zone *zone)
Definition: ast.h:265
virtual bool IsAnchoredAtEnd()
Definition: ast.h:2132
bool IsFunctionPrototype() const
Definition: ast.h:1458
unibrow::Mapping< unibrow::Ecma262Canonicalize > Canonicalize
VariableProxy * NewVariableProxy(Variable *var)
Definition: ast.h:2760
BailoutId AssignmentId() const
Definition: ast.h:1738
Block * body() const
Definition: ast.h:573
#define ASSERT(condition)
Definition: checks.h:270
ZoneList< Label * > * escaping_targets() const
Definition: ast.h:1071
ForStatement(Isolate *isolate, ZoneStringList *labels)
Definition: ast.h:788
ModuleDeclaration * NewModuleDeclaration(VariableProxy *proxy, Module *module, Scope *scope)
Definition: ast.h:2587
BailoutId RightId() const
Definition: ast.h:1687
virtual int position() const
Definition: ast.h:1685
void Init(Isolate *isolate, AstNodeFactory< Visitor > *factory)
Definition: ast.h:1889
Interface * interface() const
Definition: ast.h:572
TryStatement(int index, Block *try_block)
Definition: ast.h:1074
bool has_only_simple_this_property_assignments()
Definition: ast.h:1968
Expression(Isolate *isolate)
Definition: ast.h:356
ObjectLiteral(Isolate *isolate, Handle< FixedArray > constant_properties, ZoneList< Property * > *properties, int literal_index, bool is_simple, bool fast_elements, int depth, bool has_function)
Definition: ast.h:1315
TryCatchStatement(int index, Block *try_block, Scope *scope, Variable *variable, Block *catch_block)
Definition: ast.h:1097
virtual MaterializedLiteral * AsMaterializedLiteral()
Definition: ast.h:220
bool HasElseStatement() const
Definition: ast.h:1007
BailoutId BodyId() const
Definition: ast.h:826
virtual BailoutId ContinueId() const
Definition: ast.h:734
Expression * enumerable() const
Definition: ast.h:822
ZoneList< Statement * > * body() const
Definition: ast.h:1954
#define CHECK(condition)
Definition: checks.h:56
virtual Type node_type() const =0
virtual int min_match()
Definition: ast.h:2309
void Initialize(Statement *body)
Definition: ast.h:669
bool may_have_function_literal() const
Definition: ast.h:772
virtual bool IsValidLeftHandSide()
Definition: ast.h:312
void Reserve(int capacity, Zone *zone)
Definition: ast.h:267
Handle< String > debug_name() const
Definition: ast.h:1979
void set_loop_variable(Variable *var)
Definition: ast.h:785
Handle< String > name() const
Definition: ast.h:1410
ArrayLiteral * NewArrayLiteral(Handle< FixedArray > constant_elements, ZoneList< Expression * > *values, int literal_index, bool is_simple, int depth)
Definition: ast.h:2750
ZoneList< Expression * > * values() const
Definition: ast.h:1366
BreakableStatement(Isolate *isolate, ZoneStringList *labels, Type type)
Definition: ast.h:390
static Interval Empty()
Definition: jsregexp.h:712
bool is_this() const
Definition: ast.h:1412
bool AsArrayIndex(uint32_t *index)
Definition: objects-inl.h:5028
int position() const
Definition: ast.h:942
virtual bool ToBooleanIsTrue()
Definition: ast.h:1166
#define VISIT_AND_RETURN(NodeType, node)
Definition: ast.h:2566
BailoutId ThenId() const
Definition: ast.h:1014
Conditional(Isolate *isolate, Expression *condition, Expression *then_expression, Expression *else_expression, int then_expression_position, int else_expression_position)
Definition: ast.h:1830
CompareOperation * NewCompareOperation(Token::Value op, Expression *left, Expression *right, int pos)
Definition: ast.h:2827
#define DECLARE_TYPE_ENUM(type)
Definition: ast.h:192
virtual SmallMapList * GetReceiverTypes()
Definition: ast.h:1736
RegExpCharacterClass(ZoneList< CharacterRange > *ranges, bool is_negated)
Definition: ast.h:2241
WhileStatement(Isolate *isolate, ZoneStringList *labels)
Definition: ast.h:739
CharacterSet(uc16 standard_set_type)
Definition: ast.h:2218
Variable * loop_variable()
Definition: ast.h:784
virtual bool IsTextElement()
Definition: ast.h:2252
CallNew(Isolate *isolate, Expression *expression, ZoneList< Expression * > *arguments, int pos)
Definition: ast.h:1580
virtual SmallMapList * GetReceiverTypes()
Definition: ast.h:1463
bool is_jsruntime() const
Definition: ast.h:1614
TypeFeedbackId CompareId()
Definition: ast.h:948
Assignment * NewAssignment(Token::Value op, Expression *target, Expression *value, int pos)
Definition: ast.h:2847
ReturnStatement(Expression *expression)
Definition: ast.h:901
ZoneList< Statement * > * statements() const
Definition: ast.h:940
Token::Value op() const
Definition: ast.h:1724
friend class CaseClause
Definition: ast.h:244
virtual ~AstNode()
Definition: ast.h:205
bool IsStringLength() const
Definition: ast.h:1456
static RegExpEmpty * GetInstance()
Definition: ast.h:2460
BailoutId ElseId() const
Definition: ast.h:1827
bool IsStringAccess() const
Definition: ast.h:1457
BailoutId ReturnId() const
Definition: ast.h:1577
static Interface * NewValue()
Definition: interface.h:66
Scope * scope() const
Definition: ast.h:419
virtual Interval CaptureRegisters()
Definition: ast.h:2137
virtual BreakableStatement * AsBreakableStatement()
Definition: ast.h:218
T ** location() const
Definition: handles.h:75
Expression * cond() const
Definition: ast.h:689
MaterializedLiteral(Isolate *isolate, int literal_index, bool is_simple, int depth)
Definition: ast.h:1223
CheckType check_type() const
Definition: ast.h:1514
BailoutId BodyId() const
Definition: ast.h:736
CharacterSet(ZoneList< CharacterRange > *ranges)
Definition: ast.h:2221
Variable * var() const
Definition: ast.h:1411
#define UNREACHABLE()
Definition: checks.h:50
VariableProxy * proxy() const
Definition: ast.h:443
IterationStatement(Isolate *isolate, ZoneStringList *labels)
Definition: ast.h:663
ZoneList< Label * > * targets()
Definition: ast.h:1056
bool IsUninitialized()
Definition: ast.h:1465
virtual BailoutId ContinueId() const
Definition: ast.h:696
Throw * NewThrow(Expression *exception, int pos)
Definition: ast.h:2857
BailoutId ElseId() const
Definition: ast.h:1015
virtual MaterializedLiteral * AsMaterializedLiteral()
Definition: ast.h:1212
Interface * interface_
Definition: ast.h:1440
ObjectLiteral * NewObjectLiteral(Handle< FixedArray > constant_properties, ZoneList< ObjectLiteral::Property * > *properties, int literal_index, bool is_simple, bool fast_elements, int depth, bool has_function)
Definition: ast.h:2720
bool IsNull() const
Definition: ast.h:1170
virtual BailoutId StackCheckId() const
Definition: ast.h:697
virtual BreakableStatement * AsBreakableStatement()
Definition: ast.h:378
bool IsSymbolCompare()
Definition: ast.h:951
virtual ~RegExpVisitor()
Definition: ast.h:2115
virtual SmallMapList * GetReceiverTypes()
Definition: ast.h:1512
virtual bool IsTextElement()
Definition: ast.h:2289
TypeFeedbackId CountStoreFeedbackId() const
Definition: ast.h:1741
Module(Zone *zone)
Definition: ast.h:576
ModuleVariable * NewModuleVariable(VariableProxy *proxy)
Definition: ast.h:2615
bool IsStringCompare()
Definition: ast.h:952
FunctionDeclaration(VariableProxy *proxy, VariableMode mode, FunctionLiteral *fun, Scope *scope)
Definition: ast.h:496
virtual Type node_type() const
Definition: ast.h:1053
virtual int min_match()
Definition: ast.h:2417
int length() const
Definition: ast.h:272
RegExpTree * body()
Definition: ast.h:2388
int function_token_position() const
Definition: ast.h:1956
BinaryOperation * binary_operation() const
Definition: ast.h:1868
static int StartRegister(int index)
Definition: ast.h:2390
static bool IsAssignmentOp(Value tok)
Definition: token.h:206
void set_scope(Scope *scope)
Definition: ast.h:420
bool IsTrue() const
Definition: ast.h:1174
RegExpLookahead(RegExpTree *body, bool is_positive, int capture_count, int capture_from)
Definition: ast.h:2401
Handle< String > flags() const
Definition: ast.h:1343
ZoneList< RegExpTree * > * alternatives()
Definition: ast.h:2161
BailoutId OsrEntryId() const
Definition: ast.h:655
VariableProxy * NewVariableProxy(Handle< String > name, bool is_this, Interface *interface=Interface::NewValue(), int position=RelocInfo::kNoPosition)
Definition: ast.h:2765
virtual int max_match()
Definition: ast.h:2291
void set_position(int pos)
Definition: ast.h:943
UnaryOperation * NewUnaryOperation(Token::Value op, Expression *expression, int pos)
Definition: ast.h:2801
Handle< String > name_
Definition: ast.h:1432
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:307
Handle< String > inferred_name() const
Definition: ast.h:1984
virtual InitializationFlag initialization() const
Definition: ast.h:539
ZoneList< Property * > * properties() const
Definition: ast.h:1291
BailoutId EntryId() const
Definition: ast.h:945
BinaryOperation(Isolate *isolate, Token::Value op, Expression *left, Expression *right, int pos)
Definition: ast.h:1692
virtual TargetCollector * AsTargetCollector()
Definition: ast.h:217
#define MAKE_ASTYPE(Name)
Definition: ast.h:2140
Handle< String > name() const
Definition: ast.h:617
#define STATEMENT_WITH_LABELS(NodeType)
Definition: ast.h:2638
Statement * then_statement() const
Definition: ast.h:1010
Token::Value binary_op()
Definition: ast.h:1725
TypeFeedbackId LiteralFeedbackId() const
Definition: ast.h:1195
Expression * expression() const
Definition: ast.h:853
Call * NewCall(Expression *expression, ZoneList< Expression * > *arguments, int pos)
Definition: ast.h:2779
BailoutId MaterializeTrueId()
Definition: ast.h:1645
virtual int position() const
Definition: ast.h:1643
ZoneList< Statement * > * statements()
Definition: ast.h:416
FunctionLiteral * NewFunctionLiteral(Handle< String > name, Scope *scope, ZoneList< Statement * > *body, int materialized_literal_count, int expected_property_count, int handler_count, bool has_only_simple_this_property_assignments, Handle< FixedArray > this_property_assignments, int parameter_count, FunctionLiteral::ParameterFlag has_duplicate_parameters, FunctionLiteral::Type type, FunctionLiteral::IsFunctionFlag is_function, FunctionLiteral::IsParenthesizedFlag is_parenthesized)
Definition: ast.h:2862
virtual int min_match()
Definition: ast.h:2290
UnaryOperation(Isolate *isolate, Token::Value op, Expression *expression, int pos)
Definition: ast.h:1651
EmptyStatement * NewEmptyStatement()
Definition: ast.h:2707
Token::Value op() const
Definition: ast.h:1641
TypeFeedbackId CompareOperationFeedbackId() const
Definition: ast.h:1779
Expression * label() const
Definition: ast.h:935
int then_expression_position() const
Definition: ast.h:1823
CallNew * NewCallNew(Expression *expression, ZoneList< Expression * > *arguments, int pos)
Definition: ast.h:2786
Expression * key() const
Definition: ast.h:1451
virtual int min_match()
Definition: ast.h:2351
WithStatement * NewWithStatement(Expression *expression, Statement *statement)
Definition: ast.h:2670
RegExpCapture(RegExpTree *body, int index)
Definition: ast.h:2372
#define DECLARE_NODE_TYPE(type)
Definition: ast.h:159
static int GetNextId(Isolate *isolate)
Definition: ast.h:223
CompareOperation(Isolate *isolate, Token::Value op, Expression *left, Expression *right, int pos)
Definition: ast.h:1790
#define BASE_EMBEDDED
Definition: allocation.h:68
ReturnStatement * NewReturnStatement(Expression *expression)
Definition: ast.h:2665
Expression * cond() const
Definition: ast.h:726
virtual bool IsPropertyName()
Definition: ast.h:321
virtual int position() const
Definition: ast.h:1915
bool IsDeclaredVariableMode(VariableMode mode)
Definition: v8globals.h:516
BailoutId GetIdForElement(int i)
Definition: ast.h:1369
Handle< Object > handle() const
Definition: ast.h:1183
activate correct semantics for inheriting readonliness false
Definition: flags.cc:141
TypeFeedbackId CallRuntimeFeedbackId() const
Definition: ast.h:1616
#define MAKE_CASE(Name)
Definition: ast.h:2116
AstProperties * ast_properties()
Definition: ast.h:2525
BailoutId ExitId() const
Definition: ast.h:387
#define AST_NODE_LIST(V)
Definition: ast.h:115
int statement_pos() const
Definition: ast.h:255
virtual int position() const
Definition: ast.h:1507
bool is_anonymous() const
Definition: ast.h:1961
int SourceSize() const
Definition: ast.h:1959
ModuleUrl(Handle< String > url, Zone *zone)
Definition: ast.h:639
virtual BailoutId StackCheckId() const
Definition: ast.h:780
RegExpQuantifier(int min, int max, Type type, RegExpTree *body)
Definition: ast.h:2326
const SwVfpRegister s1
SharedFunctionInfoLiteral * NewSharedFunctionInfoLiteral(Handle< SharedFunctionInfo > shared_function_info)
Definition: ast.h:2889
Scope * scope() const
Definition: ast.h:1953
static int ReserveIdRange(Isolate *isolate, int n)
Definition: ast.h:227
BailoutId ReturnId() const
Definition: ast.h:1527
Statement * else_statement() const
Definition: ast.h:1011
Expression * left() const
Definition: ast.h:1774
virtual int max_match()
Definition: ast.h:2387
BailoutId IfId() const
Definition: ast.h:1013
ExpressionStatement(Expression *expression)
Definition: ast.h:856
bool IsObjectCompare()
Definition: ast.h:953
RegExpBackReference(RegExpCapture *capture)
Definition: ast.h:2434
virtual SmallMapList * GetReceiverTypes()
Definition: ast.h:341
SwitchStatement(Isolate *isolate, ZoneStringList *labels)
Definition: ast.h:986
BailoutId AssignmentId() const
Definition: ast.h:1873
Literal(Isolate *isolate, Handle< Object > handle)
Definition: ast.h:1198
static bool IsBinaryOp(Value op)
Definition: token.h:210
ModuleDeclaration(VariableProxy *proxy, Module *module, Scope *scope)
Definition: ast.h:522
Conditional * NewConditional(Expression *condition, Expression *then_expression, Expression *else_expression, int then_expression_position, int else_expression_position)
Definition: ast.h:2836
Label * body_target()
Definition: ast.h:939
bool is_target_for_anonymous() const
Definition: ast.h:384
Scope * scope() const
Definition: ast.h:445
Handle< Map > GetReceiverType()
Definition: ast.h:1265
#define DEF_FORWARD_DECLARATION(type)
Definition: ast.h:148
void set_statement_pos(int statement_pos)
Definition: ast.h:254
int position() const
Definition: ast.h:1413
Handle< Map > last() const
Definition: ast.h:283
ThisFunction * NewThisFunction()
Definition: ast.h:2896
ObjectLiteral::Property * NewObjectLiteralProperty(bool is_getter, FunctionLiteral *value)
Definition: ast.h:2734
DoWhileStatement(Isolate *isolate, ZoneStringList *labels)
Definition: ast.h:701
bool IsArrayLength()
Definition: ast.h:1464
RegExpCapture * capture()
Definition: ast.h:2444
Statement * statement() const
Definition: ast.h:914
Expression * value() const
Definition: ast.h:1866
uint16_t uc16
Definition: globals.h:259
virtual int max_match()
Definition: ast.h:2459
Expression * right() const
Definition: ast.h:1684
virtual bool IsAnchoredAtStart()
Definition: ast.h:2131
Expression * then_expression() const
Definition: ast.h:1820
BailoutId BodyId() const
Definition: ast.h:781
Token::Value op() const
Definition: ast.h:1864
ModulePath * NewModulePath(Module *origin, Handle< String > name)
Definition: ast.h:2620
BailoutId LoadId() const
Definition: ast.h:1454
virtual bool ToBooleanIsFalse()
Definition: ast.h:1167
BailoutId MaterializeFalseId()
Definition: ast.h:1646
virtual bool IsMonomorphic()
Definition: ast.h:1735
bool HasStackOverflow() const
Definition: ast.h:2494
Declaration(VariableProxy *proxy, VariableMode mode, Scope *scope)
Definition: ast.h:450
bool is_empty() const
Definition: ast.h:271
bool fast_elements() const
Definition: ast.h:1293
Vector< const uc16 > data()
Definition: ast.h:2293
Isolate * isolate()
Definition: ast.h:2510
bool is_compound() const
Definition: ast.h:1871
virtual int min_match()
Definition: ast.h:2159
ZoneList< Handle< Object > > ZoneObjectList
Definition: ast.h:156
ArrayLiteral(Isolate *isolate, Handle< FixedArray > constant_elements, ZoneList< Expression * > *values, int literal_index, bool is_simple, int depth)
Definition: ast.h:1374
virtual int min_match()
Definition: ast.h:2458
void set_ast_properties(AstProperties *ast_properties)
Definition: ast.h:2012
CountOperation * NewCountOperation(Token::Value op, bool is_prefix, Expression *expr, int pos)
Definition: ast.h:2818
Literal * NewLiteral(Handle< Object > handle)
Definition: ast.h:2711
Handle< String > name() const
Definition: ast.h:1952
TypeFeedbackId ForInFeedbackId() const
Definition: ast.h:829
virtual bool ToBooleanIsFalse()
Definition: ast.h:316
int else_expression_position() const
Definition: ast.h:1824
AstProperties::Flags * flags()
Definition: ast.h:2011
ZoneStringList * labels() const
Definition: ast.h:375
RegExpAtom(Vector< const uc16 > data)
Definition: ast.h:2283
virtual BailoutId StackCheckId() const
Definition: ast.h:825
#define DECLARE_NODE_FUNCTIONS(type)
Definition: ast.h:211
Expression * else_expression() const
Definition: ast.h:1821
Interface * interface() const
Definition: ast.h:1414
virtual TargetCollector * AsTargetCollector()
Definition: ast.h:1054
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
Definition: flags.cc:301
virtual int position() const
Definition: ast.h:1569
CountOperation(Isolate *isolate, Token::Value op, bool is_prefix, Expression *expr, int pos)
Definition: ast.h:1744
bool is_initializer_block() const
Definition: ast.h:417
ZoneList< Handle< String > > ZoneStringList
Definition: ast.h:155
void add_node_count(int count)
Definition: ast.h:182
Expression * expression() const
Definition: ast.h:1642
CallRuntime * NewCallRuntime(Handle< String > name, const Runtime::Function *function, ZoneList< Expression * > *arguments)
Definition: ast.h:2793
BailoutId EntryId() const
Definition: ast.h:386
ImportDeclaration(VariableProxy *proxy, Module *module, Scope *scope)
Definition: ast.h:544
virtual int position() const
Definition: ast.h:1730
virtual int max_match()
Definition: ast.h:2418
Token::Value op() const
Definition: ast.h:1682
FunctionLiteral(Isolate *isolate, Handle< String > name, Scope *scope, ZoneList< Statement * > *body, int materialized_literal_count, int expected_property_count, int handler_count, bool has_only_simple_this_property_assignments, Handle< FixedArray > this_property_assignments, int parameter_count, Type type, ParameterFlag has_duplicate_parameters, IsFunctionFlag is_function, IsParenthesizedFlag is_parenthesized)
Definition: ast.h:2017
static bool Match(void *literal1, void *literal2)
Definition: ast.h:1189
ZoneList< CaseClause * > * cases() const
Definition: ast.h:983
TryFinallyStatement * NewTryFinallyStatement(int index, Block *try_block, Block *finally_block)
Definition: ast.h:2694
Block * catch_block() const
Definition: ast.h:1094
TargetCollector(Zone *zone)
Definition: ast.h:1044
virtual bool ToBooleanIsTrue()
Definition: ast.h:315
DebuggerStatement * NewDebuggerStatement()
Definition: ast.h:2702
virtual int max_match()
Definition: ast.h:2160
BreakStatement * NewBreakStatement(BreakableStatement *target)
Definition: ast.h:2660
virtual int max_match()
Definition: ast.h:2209
#define DEF_VISIT(type)
Definition: ast.h:2546
Throw(Isolate *isolate, Expression *exception, int pos)
Definition: ast.h:1918
virtual int min_match()
Definition: ast.h:2386
virtual int max_match()
Definition: ast.h:2352
virtual IterationStatement * AsIterationStatement()
Definition: ast.h:219
ContinueStatement * NewContinueStatement(IterationStatement *target)
Definition: ast.h:2655
void set_key(Literal *key)
Definition: ast.h:1276
static int EndRegister(int index)
Definition: ast.h:2391
SharedFunctionInfoLiteral(Isolate *isolate, Handle< SharedFunctionInfo > shared_function_info)
Definition: ast.h:2087
static TypeFeedbackId reuse(BailoutId id)
Definition: ast.h:234
TryCatchStatement * NewTryCatchStatement(int index, Block *try_block, Scope *scope, Variable *variable, Block *catch_block)
Definition: ast.h:2684
VariableDeclaration(VariableProxy *proxy, VariableMode mode, Scope *scope)
Definition: ast.h:477
Expression * tag() const
Definition: ast.h:982
void set_function_token_position(int pos)
Definition: ast.h:1955
virtual void Accept(AstVisitor *v)=0
void Add(Handle< Map > handle, Zone *zone)
Definition: ast.h:274
Handle< Map > first() const
Definition: ast.h:282
virtual bool IsMonomorphic()
Definition: ast.h:1574
Handle< JSFunction > target()
Definition: ast.h:1575
VariableMode mode() const
Definition: ast.h:444
bool may_have_function_literal() const
Definition: ast.h:727
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage including flags
Definition: flags.cc:495
virtual int max_match()=0
bool is_postfix() const
Definition: ast.h:1722
RegExpAssertion(Type type)
Definition: ast.h:2200
ZoneList< RegExpTree * > * nodes()
Definition: ast.h:2182
Statement * body() const
Definition: ast.h:653
Literal * NewNumberLiteral(double number)
Definition: ast.h:2716
TypeFeedbackId BinaryOperationFeedbackId() const
Definition: ast.h:1689
ContinueStatement(IterationStatement *target)
Definition: ast.h:871
void check(i::Vector< const char > string)
AstNodeFactory(Isolate *isolate, Zone *zone)
Definition: ast.h:2560
Expression * each() const
Definition: ast.h:821
RegExpTree * body()
Definition: ast.h:2358
IfStatement * NewIfStatement(Expression *condition, Statement *then_statement, Statement *else_statement)
Definition: ast.h:2676
AstPropertiesFlag
Definition: ast.h:165
int index() const
Definition: ast.h:1069
virtual bool IsMonomorphic()
Definition: ast.h:1878
ZoneList< Expression * > * arguments() const
Definition: ast.h:1568
ImportDeclaration * NewImportDeclaration(VariableProxy *proxy, Module *module, Scope *scope)
Definition: ast.h:2595
IfStatement(Isolate *isolate, Expression *condition, Statement *then_statement, Statement *else_statement)
Definition: ast.h:1018
void Visit(AstNode *node)
Definition: ast.h:2486
virtual SmallMapList * GetReceiverTypes()
Definition: ast.h:1879
TypeFeedbackId AssignmentFeedbackId()
Definition: ast.h:1876
void AddElement(TextElement elm, Zone *zone)
Definition: ast.h:2312
virtual int min_match()
Definition: ast.h:2180
BinaryOperation * NewBinaryOperation(Token::Value op, Expression *left, Expression *right, int pos)
Definition: ast.h:2809
WithStatement(Expression *expression, Statement *statement)
Definition: ast.h:917
virtual IterationStatement * AsIterationStatement()
Definition: ast.h:651
virtual int max_match()
Definition: ast.h:2310
ExportDeclaration * NewExportDeclaration(VariableProxy *proxy, Scope *scope)
Definition: ast.h:2603
void set_inferred_name(Handle< String > inferred_name)
Definition: ast.h:1985
Property * NewProperty(Expression *obj, Expression *key, int pos)
Definition: ast.h:2774
ModuleLiteral(Block *body, Interface *interface)
Definition: ast.h:594
virtual InitializationFlag initialization() const
Definition: ast.h:517
void set_may_have_function_literal(bool value)
Definition: ast.h:775
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kInstanceClassNameOffset flag
Definition: objects-inl.h:3923