Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 0cb506b47f944cb83307c1bb10595bf8f5f88b98..2f31ce052ab9f1add16e9bbfa0840e584c898f48 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -2430,6 +2430,8 @@ class FunctionLiteral final : public Expression { |
enum EagerCompileHint { kShouldEagerCompile, kShouldLazyCompile }; |
+ enum ShouldBeUsedOnceHint { kShouldBeUsedOnce, kDontKnowIfShouldBeUsedOnce }; |
+ |
enum ArityRestriction { |
NORMAL_ARITY, |
GETTER_ARITY, |
@@ -2525,6 +2527,15 @@ class FunctionLiteral final : public Expression { |
bitfield_ = EagerCompileHintBit::update(bitfield_, kShouldEagerCompile); |
} |
+ // A hint that we expect this function to be called (exactly) once, |
+ // i.e. we suspect it's an initialization function. |
+ bool should_be_used_once_hint() const { |
+ return ShouldBeUsedOnceHintBit::decode(bitfield_) == kShouldBeUsedOnce; |
+ } |
+ void set_should_be_used_once_hint() { |
+ bitfield_ = ShouldBeUsedOnceHintBit::update(bitfield_, kShouldBeUsedOnce); |
+ } |
+ |
FunctionKind kind() { return FunctionKindBits::decode(bitfield_); } |
int ast_node_count() { return ast_properties_.node_count(); } |
@@ -2569,7 +2580,8 @@ class FunctionLiteral final : public Expression { |
HasDuplicateParameters::encode(has_duplicate_parameters) | |
IsFunction::encode(is_function) | |
EagerCompileHintBit::encode(eager_compile_hint) | |
- FunctionKindBits::encode(kind); |
+ FunctionKindBits::encode(kind) | |
+ ShouldBeUsedOnceHintBit::encode(kDontKnowIfShouldBeUsedOnce); |
DCHECK(IsValidFunctionKind(kind)); |
} |
@@ -2598,6 +2610,8 @@ class FunctionLiteral final : public Expression { |
class IsFunction : public BitField<IsFunctionFlag, 4, 1> {}; |
class EagerCompileHintBit : public BitField<EagerCompileHint, 5, 1> {}; |
class FunctionKindBits : public BitField<FunctionKind, 6, 8> {}; |
+ class ShouldBeUsedOnceHintBit : public BitField<ShouldBeUsedOnceHint, 15, 1> { |
+ }; |
}; |