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

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 a pointless edit 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-value-factory.h » ('j') | src/parsing/parser-base.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..4d23c4ac091fa4ed14f749a8320db624be3446ee 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -2599,12 +2599,12 @@ 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 function_type() == kDeclaration; }
bool is_named_expression() const {
- return IsNamedExpression::decode(bitfield_);
+ return function_type() == kNamedExpression;
}
bool is_anonymous_expression() const {
- return IsAnonymousExpression::decode(bitfield_);
+ return function_type() == kAnonymousExpression;
}
LanguageMode language_mode() const;
@@ -2681,6 +2681,9 @@ class FunctionLiteral final : public Expression {
bitfield_ = ShouldBeUsedOnceHint::update(bitfield_, true);
}
+ FunctionType function_type() const {
+ return FunctionTypeBits::decode(bitfield_);
+ }
FunctionKind kind() const { return FunctionKindBits::decode(bitfield_); }
int ast_node_count() { return ast_properties_.node_count(); }
@@ -2726,10 +2729,7 @@ 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) |
+ FunctionTypeBits::encode(function_type) | Pretenure::encode(false) |
HasDuplicateParameters::encode(has_duplicate_parameters ==
kHasDuplicateParameters) |
IsFunction::encode(is_function) |
@@ -2739,15 +2739,13 @@ 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> {};
+ class FunctionTypeBits : public BitField16<FunctionType, 0, 2> {};
Dan Ehrenberg 2016/05/12 19:24:32 I like this new way that you found the extra bit!
+ 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.
« 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