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

Unified Diff: runtime/vm/object.h

Issue 888463004: Add support for sync* and yield (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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 | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 43515)
+++ runtime/vm/object.h (working copy)
@@ -2152,6 +2152,28 @@
return modifier() == RawFunction::kAsync;
}
+ bool IsAsyncClosure() const {
+ 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 {
+ 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> {};
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698