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

Unified 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: Fix more problems 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast/ast.cc » ('j') | src/globals.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 203dbd34197893872887622dfd098b112b4da77e..e739e84ca509b812d7476897090575c0ce405d57 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -392,6 +392,9 @@ class Expression : public AstNode {
int base_id_;
Bounds bounds_;
class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {};
+
+ protected:
+ static const int kExpressionBitFieldNext = ToBooleanTypesField::kNext;
uint16_t bit_field_;
// Ends with 16-bit field; deriving classes in turn begin with
// 16-bit fields for optimum packing efficiency.
@@ -1425,7 +1428,7 @@ class ObjectLiteralProperty final : public ZoneObject {
void set_emit_store(bool emit_store);
bool emit_store();
- bool is_static() const { return is_static_; }
+ bool is_static() const { return IsStaticMethod(method_kind_); }
bool is_computed_name() const { return is_computed_name_; }
FeedbackVectorSlot GetSlot(int offset = 0) const {
@@ -1445,9 +1448,9 @@ class ObjectLiteralProperty final : public ZoneObject {
friend class AstNodeFactory;
ObjectLiteralProperty(Expression* key, Expression* value, Kind kind,
- bool is_static, bool is_computed_name);
+ MethodKind method_kind, bool is_computed_name);
ObjectLiteralProperty(AstValueFactory* ast_value_factory, Expression* key,
- Expression* value, bool is_static,
+ Expression* value, MethodKind method_kind,
bool is_computed_name);
private:
@@ -1455,8 +1458,8 @@ class ObjectLiteralProperty final : public ZoneObject {
Expression* value_;
FeedbackVectorSlot slots_[2];
Kind kind_;
+ MethodKind method_kind_;
bool emit_store_;
- bool is_static_;
bool is_computed_name_;
Handle<Map> receiver_type_;
};
@@ -2599,7 +2602,9 @@ class FunctionLiteral final : public Expression {
int start_position() const;
int end_position() const;
int SourceSize() const { return end_position() - start_position(); }
- bool is_declaration() const { return IsDeclaration::decode(bitfield_); }
+ bool is_declaration() const {
+ return IsDeclaration::decode(Expression::bit_field_);
+ }
bool is_named_expression() const {
return IsNamedExpression::decode(bitfield_);
}
@@ -2726,7 +2731,6 @@ class FunctionLiteral final : public Expression {
function_token_position_(RelocInfo::kNoPosition),
yield_count_(0) {
bitfield_ =
- IsDeclaration::encode(function_type == kDeclaration) |
IsNamedExpression::encode(function_type == kNamedExpression) |
IsAnonymousExpression::encode(function_type == kAnonymousExpression) |
Pretenure::encode(false) |
@@ -2739,15 +2743,17 @@ class FunctionLiteral final : public Expression {
}
private:
- class IsDeclaration : public BitField16<bool, 0, 1> {};
- class IsNamedExpression : public BitField16<bool, 1, 1> {};
- class IsAnonymousExpression : public BitField16<bool, 2, 1> {};
- class Pretenure : public BitField16<bool, 3, 1> {};
- class HasDuplicateParameters : public BitField16<bool, 4, 1> {};
- class IsFunction : public BitField16<bool, 5, 1> {};
- class ShouldEagerCompile : public BitField16<bool, 6, 1> {};
- class ShouldBeUsedOnceHint : public BitField16<bool, 7, 1> {};
- class FunctionKindBits : public BitField16<FunctionKind, 8, 8> {};
+ STATIC_ASSERT((Expression::kExpressionBitFieldNext + 1) < 16);
+ class IsDeclaration
+ : public BitField16<bool, Expression::kExpressionBitFieldNext, 1> {};
+ class IsNamedExpression : public BitField16<bool, 0, 1> {};
+ class IsAnonymousExpression : public BitField16<bool, 1, 1> {};
+ class Pretenure : public BitField16<bool, 2, 1> {};
+ class HasDuplicateParameters : public BitField16<bool, 3, 1> {};
+ class IsFunction : public BitField16<bool, 4, 1> {};
+ class ShouldEagerCompile : public BitField16<bool, 5, 1> {};
+ class ShouldBeUsedOnceHint : public BitField16<bool, 6, 1> {};
+ class FunctionKindBits : public BitField16<FunctionKind, 7, 9> {};
// Start with 16-bit field, which should get packed together
// with Expression's trailing 16-bit field.
@@ -3259,17 +3265,17 @@ class AstNodeFactory final BASE_EMBEDDED {
ObjectLiteral::Property* NewObjectLiteralProperty(
Expression* key, Expression* value, ObjectLiteralProperty::Kind kind,
- bool is_static, bool is_computed_name) {
- return new (local_zone_)
- ObjectLiteral::Property(key, value, kind, is_static, is_computed_name);
+ MethodKind method_kind, bool is_computed_name) {
+ return new (local_zone_) ObjectLiteral::Property(
+ key, value, kind, method_kind, is_computed_name);
}
ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key,
Expression* value,
- bool is_static,
+ MethodKind method_kind,
bool is_computed_name) {
return new (local_zone_) ObjectLiteral::Property(
- ast_value_factory_, key, value, is_static, is_computed_name);
+ ast_value_factory_, key, value, method_kind, is_computed_name);
}
RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, int flags,
« no previous file with comments | « no previous file | src/ast/ast.cc » ('j') | src/globals.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698