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

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

Issue 1841543003: [esnext] implement frontend changes for async/await proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase for dependent CLs Created 4 years, 7 months 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 | « no previous file | src/ast/ast-value-factory.h » ('j') | src/parsing/parser-base.h » ('J')
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/assembler.h" 8 #include "src/assembler.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"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 DCHECK(!BailoutId(base_id_).IsNone()); 385 DCHECK(!BailoutId(base_id_).IsNone());
386 return base_id_; 386 return base_id_;
387 } 387 }
388 388
389 private: 389 private:
390 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 390 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
391 391
392 int base_id_; 392 int base_id_;
393 Bounds bounds_; 393 Bounds bounds_;
394 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {}; 394 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {};
395
396 protected:
397 static const int kExpressionBitFieldNext = ToBooleanTypesField::kNext;
395 uint16_t bit_field_; 398 uint16_t bit_field_;
396 // Ends with 16-bit field; deriving classes in turn begin with 399 // Ends with 16-bit field; deriving classes in turn begin with
397 // 16-bit fields for optimum packing efficiency. 400 // 16-bit fields for optimum packing efficiency.
398 }; 401 };
399 402
400 403
401 class BreakableStatement : public Statement { 404 class BreakableStatement : public Statement {
402 public: 405 public:
403 enum BreakableType { 406 enum BreakableType {
404 TARGET_FOR_ANONYMOUS, 407 TARGET_FOR_ANONYMOUS,
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 Handle<String> name() const { return raw_name_->string(); } 2595 Handle<String> name() const { return raw_name_->string(); }
2593 const AstString* raw_name() const { return raw_name_; } 2596 const AstString* raw_name() const { return raw_name_; }
2594 void set_raw_name(const AstString* name) { raw_name_ = name; } 2597 void set_raw_name(const AstString* name) { raw_name_ = name; }
2595 Scope* scope() const { return scope_; } 2598 Scope* scope() const { return scope_; }
2596 ZoneList<Statement*>* body() const { return body_; } 2599 ZoneList<Statement*>* body() const { return body_; }
2597 void set_function_token_position(int pos) { function_token_position_ = pos; } 2600 void set_function_token_position(int pos) { function_token_position_ = pos; }
2598 int function_token_position() const { return function_token_position_; } 2601 int function_token_position() const { return function_token_position_; }
2599 int start_position() const; 2602 int start_position() const;
2600 int end_position() const; 2603 int end_position() const;
2601 int SourceSize() const { return end_position() - start_position(); } 2604 int SourceSize() const { return end_position() - start_position(); }
2602 bool is_declaration() const { return IsDeclaration::decode(bitfield_); } 2605 bool is_declaration() const {
2606 return IsDeclaration::decode(Expression::bit_field_);
2607 }
2603 bool is_named_expression() const { 2608 bool is_named_expression() const {
2604 return IsNamedExpression::decode(bitfield_); 2609 return IsNamedExpression::decode(bitfield_);
2605 } 2610 }
2606 bool is_anonymous_expression() const { 2611 bool is_anonymous_expression() const {
2607 return IsAnonymousExpression::decode(bitfield_); 2612 return IsAnonymousExpression::decode(bitfield_);
2608 } 2613 }
2609 LanguageMode language_mode() const; 2614 LanguageMode language_mode() const;
2610 2615
2611 static bool NeedsHomeObject(Expression* expr); 2616 static bool NeedsHomeObject(Expression* expr);
2612 2617
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 body_(body), 2724 body_(body),
2720 raw_inferred_name_(ast_value_factory->empty_string()), 2725 raw_inferred_name_(ast_value_factory->empty_string()),
2721 ast_properties_(zone), 2726 ast_properties_(zone),
2722 dont_optimize_reason_(kNoReason), 2727 dont_optimize_reason_(kNoReason),
2723 materialized_literal_count_(materialized_literal_count), 2728 materialized_literal_count_(materialized_literal_count),
2724 expected_property_count_(expected_property_count), 2729 expected_property_count_(expected_property_count),
2725 parameter_count_(parameter_count), 2730 parameter_count_(parameter_count),
2726 function_token_position_(RelocInfo::kNoPosition), 2731 function_token_position_(RelocInfo::kNoPosition),
2727 yield_count_(0) { 2732 yield_count_(0) {
2728 bitfield_ = 2733 bitfield_ =
2729 IsDeclaration::encode(function_type == kDeclaration) |
2730 IsNamedExpression::encode(function_type == kNamedExpression) | 2734 IsNamedExpression::encode(function_type == kNamedExpression) |
2731 IsAnonymousExpression::encode(function_type == kAnonymousExpression) | 2735 IsAnonymousExpression::encode(function_type == kAnonymousExpression) |
2732 Pretenure::encode(false) | 2736 Pretenure::encode(false) |
2733 HasDuplicateParameters::encode(has_duplicate_parameters == 2737 HasDuplicateParameters::encode(has_duplicate_parameters ==
2734 kHasDuplicateParameters) | 2738 kHasDuplicateParameters) |
2735 IsFunction::encode(is_function) | 2739 IsFunction::encode(is_function) |
2736 ShouldEagerCompile::encode(eager_compile_hint == kShouldEagerCompile) | 2740 ShouldEagerCompile::encode(eager_compile_hint == kShouldEagerCompile) |
2737 FunctionKindBits::encode(kind) | ShouldBeUsedOnceHint::encode(false); 2741 FunctionKindBits::encode(kind) | ShouldBeUsedOnceHint::encode(false);
2738 DCHECK(IsValidFunctionKind(kind)); 2742 DCHECK(IsValidFunctionKind(kind));
2739 } 2743 }
2740 2744
2741 private: 2745 private:
2742 class IsDeclaration : public BitField16<bool, 0, 1> {}; 2746 STATIC_ASSERT((Expression::kExpressionBitFieldNext + 1) < 16);
2743 class IsNamedExpression : public BitField16<bool, 1, 1> {}; 2747 class IsDeclaration
2744 class IsAnonymousExpression : public BitField16<bool, 2, 1> {}; 2748 : public BitField16<bool, Expression::kExpressionBitFieldNext, 1> {};
2745 class Pretenure : public BitField16<bool, 3, 1> {}; 2749 class IsNamedExpression : public BitField16<bool, 0, 1> {};
2746 class HasDuplicateParameters : public BitField16<bool, 4, 1> {}; 2750 class IsAnonymousExpression : public BitField16<bool, 1, 1> {};
2747 class IsFunction : public BitField16<bool, 5, 1> {}; 2751 class Pretenure : public BitField16<bool, 2, 1> {};
2748 class ShouldEagerCompile : public BitField16<bool, 6, 1> {}; 2752 class HasDuplicateParameters : public BitField16<bool, 3, 1> {};
2749 class ShouldBeUsedOnceHint : public BitField16<bool, 7, 1> {}; 2753 class IsFunction : public BitField16<bool, 4, 1> {};
2750 class FunctionKindBits : public BitField16<FunctionKind, 8, 8> {}; 2754 class ShouldEagerCompile : public BitField16<bool, 5, 1> {};
2755 class ShouldBeUsedOnceHint : public BitField16<bool, 6, 1> {};
2756 class FunctionKindBits : public BitField16<FunctionKind, 7, 9> {};
2751 2757
2752 // Start with 16-bit field, which should get packed together 2758 // Start with 16-bit field, which should get packed together
2753 // with Expression's trailing 16-bit field. 2759 // with Expression's trailing 16-bit field.
2754 uint16_t bitfield_; 2760 uint16_t bitfield_;
2755 2761
2756 const AstString* raw_name_; 2762 const AstString* raw_name_;
2757 Scope* scope_; 2763 Scope* scope_;
2758 ZoneList<Statement*>* body_; 2764 ZoneList<Statement*>* body_;
2759 const AstString* raw_inferred_name_; 2765 const AstString* raw_inferred_name_;
2760 Handle<String> inferred_name_; 2766 Handle<String> inferred_name_;
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3558 : NULL; \ 3564 : NULL; \
3559 } 3565 }
3560 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3566 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3561 #undef DECLARE_NODE_FUNCTIONS 3567 #undef DECLARE_NODE_FUNCTIONS
3562 3568
3563 3569
3564 } // namespace internal 3570 } // namespace internal
3565 } // namespace v8 3571 } // namespace v8
3566 3572
3567 #endif // V8_AST_AST_H_ 3573 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast/ast-value-factory.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698