Chromium Code Reviews| Index: runtime/vm/object.h |
| =================================================================== |
| --- runtime/vm/object.h (revision 43415) |
| +++ runtime/vm/object.h (working copy) |
| @@ -2152,6 +2152,28 @@ |
| return modifier() == RawFunction::kAsync; |
| } |
| + bool IsAsyncClosure() const { |
|
srdjan
2015/02/04 19:29:12
ASSERT(IsLocalFUnction) or that parent_function()
hausner
2015/02/04 22:09:24
is_generated_function() implies that it's a local
|
| + return is_generated_body() && |
| + Function::Handle(parent_function()).IsAsyncFunction(); |
| + } |
| + |
| + bool IsGenerator() const { |
| + return (modifier() & RawFunction::kGeneratorBit) != 0; |
| + } |
| + |
| + bool IsSyncGenerator() const { |
| + return modifier() == RawFunction::kSyncGen; |
| + } |
| + |
| + bool IsSyncGenClosure() const { |
|
srdjan
2015/02/04 19:29:12
ditto
hausner
2015/02/04 22:09:24
ditto.
|
| + return is_generated_body() && |
| + Function::Handle(parent_function()).IsSyncGenerator(); |
| + } |
| + |
| + bool IsAsyncOrGenerator() const { |
| + return modifier() != RawFunction::kNoModifier; |
| + } |
| + |
| static intptr_t InstanceSize() { |
| return RoundedAllocationSize(sizeof(RawFunction)); |
| } |
| @@ -2239,7 +2261,7 @@ |
| V(External, is_external) \ |
| V(AllowsHoistingCheckClass, allows_hoisting_check_class) \ |
| V(AllowsBoundsCheckGeneralization, allows_bounds_check_generalization) \ |
| - V(AsyncClosure, is_async_closure) \ |
| + V(GeneratedBody, is_generated_body) \ |
| V(AlwaysInline, always_inline) \ |
| V(PolymorphicTarget, is_polymorphic_target) \ |
| @@ -2262,6 +2284,8 @@ |
| kRecognizedTagPos = kKindTagPos + kKindTagSize, |
| kRecognizedTagSize = 8, |
| kModifierPos = kRecognizedTagPos + kRecognizedTagSize, |
| + kModifierSize = 2, |
| + kLastModifierBitPos = kModifierPos + (kModifierSize - 1), |
| // Single bit sized fields start here. |
| #define DECLARE_BIT(name, _) k##name##Bit, |
| FOR_EACH_FUNCTION_KIND_BIT(DECLARE_BIT) |
| @@ -2277,11 +2301,14 @@ |
| class KindBits : |
| public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT |
| + |
| class RecognizedBits : public BitField<MethodRecognizer::Kind, |
| kRecognizedTagPos, |
| kRecognizedTagSize> {}; |
| class ModifierBits : |
| - public BitField<RawFunction::AsyncModifier, kModifierPos, 1> {}; // NOLINT |
| + public BitField<RawFunction::AsyncModifier, |
| + kModifierPos, |
| + kModifierSize> {}; // NOLINT |
| #define DEFINE_BIT(name, _) \ |
| class name##Bit : public BitField<bool, k##name##Bit, 1> {}; |