Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: src/ast/ast.h

Issue 2452403003: Changed statement ZoneList to a ZoneChunkList
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_AST_H_ 5 #ifndef V8_AST_AST_H_
6 #define V8_AST_AST_H_ 6 #define V8_AST_AST_H_
7 7
8 #include "src/ast/ast-types.h" 8 #include "src/ast/ast-types.h"
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/modules.h" 10 #include "src/ast/modules.h"
11 #include "src/ast/variables.h" 11 #include "src/ast/variables.h"
12 #include "src/bailout-reason.h" 12 #include "src/bailout-reason.h"
13 #include "src/base/flags.h" 13 #include "src/base/flags.h"
14 #include "src/factory.h" 14 #include "src/factory.h"
15 #include "src/globals.h" 15 #include "src/globals.h"
16 #include "src/isolate.h" 16 #include "src/isolate.h"
17 #include "src/list.h" 17 #include "src/list.h"
18 #include "src/parsing/token.h" 18 #include "src/parsing/token.h"
19 #include "src/runtime/runtime.h" 19 #include "src/runtime/runtime.h"
20 #include "src/small-pointer-list.h" 20 #include "src/small-pointer-list.h"
21 #include "src/utils.h" 21 #include "src/utils.h"
22 #include "src/zone/zone-chunk-list.h"
22 23
23 namespace v8 { 24 namespace v8 {
24 namespace internal { 25 namespace internal {
25 26
26 // The abstract syntax tree is an intermediate, light-weight 27 // The abstract syntax tree is an intermediate, light-weight
27 // representation of the parsed JavaScript code suitable for 28 // representation of the parsed JavaScript code suitable for
28 // compilation to native code. 29 // compilation to native code.
29 30
30 // Nodes are allocated in a separate zone, which allows faster 31 // Nodes are allocated in a separate zone, which allows faster
31 // allocation and constant-time deallocation of the entire syntax 32 // allocation and constant-time deallocation of the entire syntax
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 FeedbackVectorSpec* get_spec() { return &spec_; } 171 FeedbackVectorSpec* get_spec() { return &spec_; }
171 172
172 private: 173 private:
173 Flags flags_; 174 Flags flags_;
174 int node_count_; 175 int node_count_;
175 FeedbackVectorSpec spec_; 176 FeedbackVectorSpec spec_;
176 }; 177 };
177 178
178 DEFINE_OPERATORS_FOR_FLAGS(AstProperties::Flags) 179 DEFINE_OPERATORS_FOR_FLAGS(AstProperties::Flags)
179 180
180 181 class AstNode : public ZoneObject {
181 class AstNode: public ZoneObject {
182 public: 182 public:
183 #define DECLARE_TYPE_ENUM(type) k##type, 183 #define DECLARE_TYPE_ENUM(type) k##type,
184 enum NodeType : uint8_t { AST_NODE_LIST(DECLARE_TYPE_ENUM) }; 184 enum NodeType : uint8_t { AST_NODE_LIST(DECLARE_TYPE_ENUM) };
185 #undef DECLARE_TYPE_ENUM 185 #undef DECLARE_TYPE_ENUM
186 186
187 void* operator new(size_t size, Zone* zone) { return zone->New(size); } 187 void* operator new(size_t size, Zone* zone) { return zone->New(size); }
188 188
189 NodeType node_type() const { return NodeTypeField::decode(bit_field_); } 189 NodeType node_type() const { return NodeTypeField::decode(bit_field_); }
190 int position() const { return position_; } 190 int position() const { return position_; }
191 191
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 DCHECK(!BailoutId(base_id_).IsNone()); 425 DCHECK(!BailoutId(base_id_).IsNone());
426 return base_id_; 426 return base_id_;
427 } 427 }
428 428
429 static const uint8_t kNextBitFieldIndex = BreakableTypeField::kNext; 429 static const uint8_t kNextBitFieldIndex = BreakableTypeField::kNext;
430 }; 430 };
431 431
432 432
433 class Block final : public BreakableStatement { 433 class Block final : public BreakableStatement {
434 public: 434 public:
435 ZoneList<Statement*>* statements() { return &statements_; } 435 ZoneChunkList<Statement*>* statements() { return &statements_; }
436 bool ignore_completion_value() const { 436 bool ignore_completion_value() const {
437 return IgnoreCompletionField::decode(bit_field_); 437 return IgnoreCompletionField::decode(bit_field_);
438 } 438 }
439 439
440 static int num_ids() { return parent_num_ids() + 1; } 440 static int num_ids() { return parent_num_ids() + 1; }
441 BailoutId DeclsId() const { return BailoutId(local_id(0)); } 441 BailoutId DeclsId() const { return BailoutId(local_id(0)); }
442 442
443 bool IsJump() const { 443 bool IsJump() const {
444 return !statements_.is_empty() && statements_.last()->IsJump() 444 return statements_.size() > 0 && statements_.back()->IsJump() &&
445 && labels() == NULL; // Good enough as an approximation... 445 labels() == NULL; // Good enough as an approximation...
446 } 446 }
447 447
448 Scope* scope() const { return scope_; } 448 Scope* scope() const { return scope_; }
449 void set_scope(Scope* scope) { scope_ = scope; } 449 void set_scope(Scope* scope) { scope_ = scope; }
450 450
451 private: 451 private:
452 friend class AstNodeFactory; 452 friend class AstNodeFactory;
453 453
454 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, 454 Block(Zone* zone, ZoneList<const AstRawString*>* labels,
455 bool ignore_completion_value, int pos) 455 bool ignore_completion_value, int pos)
456 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY, pos, kBlock), 456 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY, pos, kBlock),
457 statements_(capacity, zone), 457 statements_(zone),
458 scope_(NULL) { 458 scope_(NULL) {
459 bit_field_ |= IgnoreCompletionField::encode(ignore_completion_value); 459 bit_field_ |= IgnoreCompletionField::encode(ignore_completion_value);
460 } 460 }
461 static int parent_num_ids() { return BreakableStatement::num_ids(); } 461 static int parent_num_ids() { return BreakableStatement::num_ids(); }
462 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 462 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
463 463
464 ZoneList<Statement*> statements_; 464 ZoneChunkList<Statement*> statements_;
465 Scope* scope_; 465 Scope* scope_;
466 466
467 class IgnoreCompletionField 467 class IgnoreCompletionField
468 : public BitField<bool, BreakableStatement::kNextBitFieldIndex, 1> {}; 468 : public BitField<bool, BreakableStatement::kNextBitFieldIndex, 1> {};
469 469
470 protected: 470 protected:
471 static const uint8_t kNextBitFieldIndex = IgnoreCompletionField::kNext; 471 static const uint8_t kNextBitFieldIndex = IgnoreCompletionField::kNext;
472 }; 472 };
473 473
474 474
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 958
959 class CaseClause final : public Expression { 959 class CaseClause final : public Expression {
960 public: 960 public:
961 bool is_default() const { return label_ == NULL; } 961 bool is_default() const { return label_ == NULL; }
962 Expression* label() const { 962 Expression* label() const {
963 CHECK(!is_default()); 963 CHECK(!is_default());
964 return label_; 964 return label_;
965 } 965 }
966 void set_label(Expression* e) { label_ = e; } 966 void set_label(Expression* e) { label_ = e; }
967 Label* body_target() { return &body_target_; } 967 Label* body_target() { return &body_target_; }
968 ZoneList<Statement*>* statements() const { return statements_; } 968 ZoneChunkList<Statement*>* statements() const { return statements_; }
969 969
970 static int num_ids() { return parent_num_ids() + 2; } 970 static int num_ids() { return parent_num_ids() + 2; }
971 BailoutId EntryId() const { return BailoutId(local_id(0)); } 971 BailoutId EntryId() const { return BailoutId(local_id(0)); }
972 TypeFeedbackId CompareId() { return TypeFeedbackId(local_id(1)); } 972 TypeFeedbackId CompareId() { return TypeFeedbackId(local_id(1)); }
973 973
974 AstType* compare_type() { return compare_type_; } 974 AstType* compare_type() { return compare_type_; }
975 void set_compare_type(AstType* type) { compare_type_ = type; } 975 void set_compare_type(AstType* type) { compare_type_ = type; }
976 976
977 // CaseClause will have both a slot in the feedback vector and the 977 // CaseClause will have both a slot in the feedback vector and the
978 // TypeFeedbackId to record the type information. TypeFeedbackId is used by 978 // TypeFeedbackId to record the type information. TypeFeedbackId is used by
979 // full codegen and the feedback vector slot is used by interpreter. 979 // full codegen and the feedback vector slot is used by interpreter.
980 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, 980 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
981 FeedbackVectorSlotCache* cache); 981 FeedbackVectorSlotCache* cache);
982 982
983 FeedbackVectorSlot CompareOperationFeedbackSlot() { 983 FeedbackVectorSlot CompareOperationFeedbackSlot() {
984 return type_feedback_slot_; 984 return type_feedback_slot_;
985 } 985 }
986 986
987 private: 987 private:
988 friend class AstNodeFactory; 988 friend class AstNodeFactory;
989 989
990 static int parent_num_ids() { return Expression::num_ids(); } 990 static int parent_num_ids() { return Expression::num_ids(); }
991 CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos); 991 CaseClause(Expression* label, ZoneChunkList<Statement*>* statements, int pos);
992 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 992 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
993 993
994 Expression* label_; 994 Expression* label_;
995 Label body_target_; 995 Label body_target_;
996 ZoneList<Statement*>* statements_; 996 ZoneChunkList<Statement*>* statements_;
997 AstType* compare_type_; 997 AstType* compare_type_;
998 FeedbackVectorSlot type_feedback_slot_; 998 FeedbackVectorSlot type_feedback_slot_;
999 }; 999 };
1000 1000
1001 1001
1002 class SwitchStatement final : public BreakableStatement { 1002 class SwitchStatement final : public BreakableStatement {
1003 public: 1003 public:
1004 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1004 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1005 tag_ = tag; 1005 tag_ = tag;
1006 cases_ = cases; 1006 cases_ = cases;
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 return flags; 1444 return flags;
1445 } 1445 }
1446 1446
1447 enum Flags { 1447 enum Flags {
1448 kNoFlags = 0, 1448 kNoFlags = 0,
1449 kFastElements = 1, 1449 kFastElements = 1,
1450 kShallowProperties = 1 << 1, 1450 kShallowProperties = 1 << 1,
1451 kDisableMementos = 1 << 2 1451 kDisableMementos = 1 << 2
1452 }; 1452 };
1453 1453
1454 struct Accessors: public ZoneObject { 1454 struct Accessors : public ZoneObject {
1455 Accessors() : getter(NULL), setter(NULL), bailout_id(BailoutId::None()) {} 1455 Accessors() : getter(NULL), setter(NULL), bailout_id(BailoutId::None()) {}
1456 ObjectLiteralProperty* getter; 1456 ObjectLiteralProperty* getter;
1457 ObjectLiteralProperty* setter; 1457 ObjectLiteralProperty* setter;
1458 BailoutId bailout_id; 1458 BailoutId bailout_id;
1459 }; 1459 };
1460 1460
1461 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } 1461 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); }
1462 1462
1463 // Return an AST id for a property that is used in simulate instructions. 1463 // Return an AST id for a property that is used in simulate instructions.
1464 BailoutId GetIdForPropertyName(int i) { 1464 BailoutId GetIdForPropertyName(int i) {
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 }; 2569 };
2570 2570
2571 enum ParameterFlag { kNoDuplicateParameters, kHasDuplicateParameters }; 2571 enum ParameterFlag { kNoDuplicateParameters, kHasDuplicateParameters };
2572 2572
2573 enum EagerCompileHint { kShouldEagerCompile, kShouldLazyCompile }; 2573 enum EagerCompileHint { kShouldEagerCompile, kShouldLazyCompile };
2574 2574
2575 Handle<String> name() const { return raw_name_->string(); } 2575 Handle<String> name() const { return raw_name_->string(); }
2576 const AstString* raw_name() const { return raw_name_; } 2576 const AstString* raw_name() const { return raw_name_; }
2577 void set_raw_name(const AstString* name) { raw_name_ = name; } 2577 void set_raw_name(const AstString* name) { raw_name_ = name; }
2578 DeclarationScope* scope() const { return scope_; } 2578 DeclarationScope* scope() const { return scope_; }
2579 ZoneList<Statement*>* body() const { return body_; } 2579 ZoneChunkList<Statement*>* body() const { return body_; }
2580 void set_function_token_position(int pos) { function_token_position_ = pos; } 2580 void set_function_token_position(int pos) { function_token_position_ = pos; }
2581 int function_token_position() const { return function_token_position_; } 2581 int function_token_position() const { return function_token_position_; }
2582 int start_position() const; 2582 int start_position() const;
2583 int end_position() const; 2583 int end_position() const;
2584 int SourceSize() const { return end_position() - start_position(); } 2584 int SourceSize() const { return end_position() - start_position(); }
2585 bool is_declaration() const { return function_type() == kDeclaration; } 2585 bool is_declaration() const { return function_type() == kDeclaration; }
2586 bool is_named_expression() const { 2586 bool is_named_expression() const {
2587 return function_type() == kNamedExpression; 2587 return function_type() == kNamedExpression;
2588 } 2588 }
2589 bool is_anonymous_expression() const { 2589 bool is_anonymous_expression() const {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 void set_is_class_field_initializer(bool is_class_field_initializer) { 2701 void set_is_class_field_initializer(bool is_class_field_initializer) {
2702 bit_field_ = 2702 bit_field_ =
2703 IsClassFieldInitializer::update(bit_field_, is_class_field_initializer); 2703 IsClassFieldInitializer::update(bit_field_, is_class_field_initializer);
2704 } 2704 }
2705 2705
2706 private: 2706 private:
2707 friend class AstNodeFactory; 2707 friend class AstNodeFactory;
2708 2708
2709 FunctionLiteral(Zone* zone, const AstString* name, 2709 FunctionLiteral(Zone* zone, const AstString* name,
2710 AstValueFactory* ast_value_factory, DeclarationScope* scope, 2710 AstValueFactory* ast_value_factory, DeclarationScope* scope,
2711 ZoneList<Statement*>* body, int materialized_literal_count, 2711 ZoneChunkList<Statement*>* body,
2712 int expected_property_count, int parameter_count, 2712 int materialized_literal_count, int expected_property_count,
2713 int function_length, FunctionType function_type, 2713 int parameter_count, int function_length,
2714 FunctionType function_type,
2714 ParameterFlag has_duplicate_parameters, 2715 ParameterFlag has_duplicate_parameters,
2715 EagerCompileHint eager_compile_hint, int position, 2716 EagerCompileHint eager_compile_hint, int position,
2716 bool is_function) 2717 bool is_function)
2717 : Expression(position, kFunctionLiteral), 2718 : Expression(position, kFunctionLiteral),
2718 materialized_literal_count_(materialized_literal_count), 2719 materialized_literal_count_(materialized_literal_count),
2719 expected_property_count_(expected_property_count), 2720 expected_property_count_(expected_property_count),
2720 parameter_count_(parameter_count), 2721 parameter_count_(parameter_count),
2721 function_length_(function_length), 2722 function_length_(function_length),
2722 function_token_position_(kNoSourcePosition), 2723 function_token_position_(kNoSourcePosition),
2723 yield_count_(0), 2724 yield_count_(0),
(...skipping 30 matching lines...) Expand all
2754 2755
2755 int materialized_literal_count_; 2756 int materialized_literal_count_;
2756 int expected_property_count_; 2757 int expected_property_count_;
2757 int parameter_count_; 2758 int parameter_count_;
2758 int function_length_; 2759 int function_length_;
2759 int function_token_position_; 2760 int function_token_position_;
2760 int yield_count_; 2761 int yield_count_;
2761 2762
2762 const AstString* raw_name_; 2763 const AstString* raw_name_;
2763 DeclarationScope* scope_; 2764 DeclarationScope* scope_;
2764 ZoneList<Statement*>* body_; 2765 ZoneChunkList<Statement*>* body_;
2765 const AstString* raw_inferred_name_; 2766 const AstString* raw_inferred_name_;
2766 Handle<String> inferred_name_; 2767 Handle<String> inferred_name_;
2767 AstProperties ast_properties_; 2768 AstProperties ast_properties_;
2768 }; 2769 };
2769 2770
2770 // Property is used for passing information 2771 // Property is used for passing information
2771 // about a class literal's properties from the parser to the code generator. 2772 // about a class literal's properties from the parser to the code generator.
2772 class ClassLiteralProperty final : public LiteralProperty { 2773 class ClassLiteralProperty final : public LiteralProperty {
2773 public: 2774 public:
2774 enum Kind : uint8_t { METHOD, GETTER, SETTER, FIELD }; 2775 enum Kind : uint8_t { METHOD, GETTER, SETTER, FIELD };
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2957 class AstVisitor BASE_EMBEDDED { 2958 class AstVisitor BASE_EMBEDDED {
2958 public: 2959 public:
2959 void Visit(AstNode* node) { impl()->Visit(node); } 2960 void Visit(AstNode* node) { impl()->Visit(node); }
2960 2961
2961 void VisitDeclarations(ZoneList<Declaration*>* declarations) { 2962 void VisitDeclarations(ZoneList<Declaration*>* declarations) {
2962 for (int i = 0; i < declarations->length(); i++) { 2963 for (int i = 0; i < declarations->length(); i++) {
2963 Visit(declarations->at(i)); 2964 Visit(declarations->at(i));
2964 } 2965 }
2965 } 2966 }
2966 2967
2967 void VisitStatements(ZoneList<Statement*>* statements) { 2968 void VisitStatements(ZoneChunkList<Statement*>* statements) {
2968 for (int i = 0; i < statements->length(); i++) { 2969 for (Statement* statement : *statements) {
2969 Statement* stmt = statements->at(i); 2970 Visit(statement);
2970 Visit(stmt); 2971 if (statement->IsJump()) break;
2971 if (stmt->IsJump()) break;
2972 } 2972 }
2973 } 2973 }
2974 2974
2975 void VisitExpressions(ZoneList<Expression*>* expressions) { 2975 void VisitExpressions(ZoneList<Expression*>* expressions) {
2976 for (int i = 0; i < expressions->length(); i++) { 2976 for (int i = 0; i < expressions->length(); i++) {
2977 // The variable statement visiting code may pass NULL expressions 2977 // The variable statement visiting code may pass NULL expressions
2978 // to this code. Maybe this should be handled by introducing an 2978 // to this code. Maybe this should be handled by introducing an
2979 // undefined expression or literal? Revisit this code if this 2979 // undefined expression or literal? Revisit this code if this
2980 // changes 2980 // changes
2981 Expression* expression = expressions->at(i); 2981 Expression* expression = expressions->at(i);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 Scope* scope, int pos) { 3125 Scope* scope, int pos) {
3126 return new (zone_) VariableDeclaration(proxy, scope, pos); 3126 return new (zone_) VariableDeclaration(proxy, scope, pos);
3127 } 3127 }
3128 3128
3129 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, 3129 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy,
3130 FunctionLiteral* fun, 3130 FunctionLiteral* fun,
3131 Scope* scope, int pos) { 3131 Scope* scope, int pos) {
3132 return new (zone_) FunctionDeclaration(proxy, fun, scope, pos); 3132 return new (zone_) FunctionDeclaration(proxy, fun, scope, pos);
3133 } 3133 }
3134 3134
3135 Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, 3135 Block* NewBlock(ZoneList<const AstRawString*>* labels,
3136 bool ignore_completion_value, int pos) { 3136 bool ignore_completion_value, int pos) {
3137 return new (zone_) 3137 return new (zone_) Block(zone_, labels, ignore_completion_value, pos);
3138 Block(zone_, labels, capacity, ignore_completion_value, pos);
3139 } 3138 }
3140 3139
3141 #define STATEMENT_WITH_LABELS(NodeType) \ 3140 #define STATEMENT_WITH_LABELS(NodeType) \
3142 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ 3141 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \
3143 return new (zone_) NodeType(labels, pos); \ 3142 return new (zone_) NodeType(labels, pos); \
3144 } 3143 }
3145 STATEMENT_WITH_LABELS(DoWhileStatement) 3144 STATEMENT_WITH_LABELS(DoWhileStatement)
3146 STATEMENT_WITH_LABELS(WhileStatement) 3145 STATEMENT_WITH_LABELS(WhileStatement)
3147 STATEMENT_WITH_LABELS(ForStatement) 3146 STATEMENT_WITH_LABELS(ForStatement)
3148 STATEMENT_WITH_LABELS(SwitchStatement) 3147 STATEMENT_WITH_LABELS(SwitchStatement)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3249 3248
3250 EmptyStatement* NewEmptyStatement(int pos) { 3249 EmptyStatement* NewEmptyStatement(int pos) {
3251 return new (zone_) EmptyStatement(pos); 3250 return new (zone_) EmptyStatement(pos);
3252 } 3251 }
3253 3252
3254 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement(Scope* scope) { 3253 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement(Scope* scope) {
3255 return new (zone_) SloppyBlockFunctionStatement( 3254 return new (zone_) SloppyBlockFunctionStatement(
3256 NewEmptyStatement(kNoSourcePosition), scope); 3255 NewEmptyStatement(kNoSourcePosition), scope);
3257 } 3256 }
3258 3257
3259 CaseClause* NewCaseClause( 3258 CaseClause* NewCaseClause(Expression* label,
3260 Expression* label, ZoneList<Statement*>* statements, int pos) { 3259 ZoneChunkList<Statement*>* statements, int pos) {
3261 return new (zone_) CaseClause(label, statements, pos); 3260 return new (zone_) CaseClause(label, statements, pos);
3262 } 3261 }
3263 3262
3264 Literal* NewStringLiteral(const AstRawString* string, int pos) { 3263 Literal* NewStringLiteral(const AstRawString* string, int pos) {
3265 return new (zone_) Literal(ast_value_factory_->NewString(string), pos); 3264 return new (zone_) Literal(ast_value_factory_->NewString(string), pos);
3266 } 3265 }
3267 3266
3268 // A JavaScript symbol (ECMA-262 edition 6). 3267 // A JavaScript symbol (ECMA-262 edition 6).
3269 Literal* NewSymbolLiteral(const char* name, int pos) { 3268 Literal* NewSymbolLiteral(const char* name, int pos) {
3270 return new (zone_) Literal(ast_value_factory_->NewSymbol(name), pos); 3269 return new (zone_) Literal(ast_value_factory_->NewSymbol(name), pos);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 if (!expression) expression = NewUndefinedLiteral(pos); 3443 if (!expression) expression = NewUndefinedLiteral(pos);
3445 return new (zone_) Yield(generator_object, expression, pos, on_exception); 3444 return new (zone_) Yield(generator_object, expression, pos, on_exception);
3446 } 3445 }
3447 3446
3448 Throw* NewThrow(Expression* exception, int pos) { 3447 Throw* NewThrow(Expression* exception, int pos) {
3449 return new (zone_) Throw(exception, pos); 3448 return new (zone_) Throw(exception, pos);
3450 } 3449 }
3451 3450
3452 FunctionLiteral* NewFunctionLiteral( 3451 FunctionLiteral* NewFunctionLiteral(
3453 const AstRawString* name, DeclarationScope* scope, 3452 const AstRawString* name, DeclarationScope* scope,
3454 ZoneList<Statement*>* body, int materialized_literal_count, 3453 ZoneChunkList<Statement*>* body, int materialized_literal_count,
3455 int expected_property_count, int parameter_count, int function_length, 3454 int expected_property_count, int parameter_count, int function_length,
3456 FunctionLiteral::ParameterFlag has_duplicate_parameters, 3455 FunctionLiteral::ParameterFlag has_duplicate_parameters,
3457 FunctionLiteral::FunctionType function_type, 3456 FunctionLiteral::FunctionType function_type,
3458 FunctionLiteral::EagerCompileHint eager_compile_hint, int position) { 3457 FunctionLiteral::EagerCompileHint eager_compile_hint, int position) {
3459 return new (zone_) FunctionLiteral( 3458 return new (zone_) FunctionLiteral(
3460 zone_, name, ast_value_factory_, scope, body, 3459 zone_, name, ast_value_factory_, scope, body,
3461 materialized_literal_count, expected_property_count, parameter_count, 3460 materialized_literal_count, expected_property_count, parameter_count,
3462 function_length, function_type, has_duplicate_parameters, 3461 function_length, function_type, has_duplicate_parameters,
3463 eager_compile_hint, position, true); 3462 eager_compile_hint, position, true);
3464 } 3463 }
3465 3464
3466 // Creates a FunctionLiteral representing a top-level script, the 3465 // Creates a FunctionLiteral representing a top-level script, the
3467 // result of an eval (top-level or otherwise), or the result of calling 3466 // result of an eval (top-level or otherwise), or the result of calling
3468 // the Function constructor. 3467 // the Function constructor.
3469 FunctionLiteral* NewScriptOrEvalFunctionLiteral( 3468 FunctionLiteral* NewScriptOrEvalFunctionLiteral(
3470 DeclarationScope* scope, ZoneList<Statement*>* body, 3469 DeclarationScope* scope, ZoneChunkList<Statement*>* body,
3471 int materialized_literal_count, int expected_property_count, 3470 int materialized_literal_count, int expected_property_count,
3472 int parameter_count) { 3471 int parameter_count) {
3473 return new (zone_) FunctionLiteral( 3472 return new (zone_) FunctionLiteral(
3474 zone_, ast_value_factory_->empty_string(), ast_value_factory_, scope, 3473 zone_, ast_value_factory_->empty_string(), ast_value_factory_, scope,
3475 body, materialized_literal_count, expected_property_count, 3474 body, materialized_literal_count, expected_property_count,
3476 parameter_count, parameter_count, FunctionLiteral::kAnonymousExpression, 3475 parameter_count, parameter_count, FunctionLiteral::kAnonymousExpression,
3477 FunctionLiteral::kNoDuplicateParameters, 3476 FunctionLiteral::kNoDuplicateParameters,
3478 FunctionLiteral::kShouldLazyCompile, 0, false); 3477 FunctionLiteral::kShouldLazyCompile, 0, false);
3479 } 3478 }
3480 3479
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3594 : NULL; \ 3593 : NULL; \
3595 } 3594 }
3596 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3595 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3597 #undef DECLARE_NODE_FUNCTIONS 3596 #undef DECLARE_NODE_FUNCTIONS
3598 3597
3599 3598
3600 } // namespace internal 3599 } // namespace internal
3601 } // namespace v8 3600 } // namespace v8
3602 3601
3603 #endif // V8_AST_AST_H_ 3602 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698