5 #ifndef V8_OBJECTS_JS_GENERATOR_H_ 6 #define V8_OBJECTS_JS_GENERATOR_H_ 8 #include "src/objects/js-objects.h" 11 #include "src/objects/object-macros.h" 25 DECL_ACCESSORS2(context,
Context)
28 DECL_ACCESSORS(receiver,
Object)
35 DECL_ACCESSORS(input_or_debug_pos,
Object)
38 enum ResumeMode { kNext, kReturn, kThrow };
39 DECL_INT_ACCESSORS(resume_mode)
46 inline int continuation()
const;
47 inline void set_continuation(
int continuation);
48 inline bool is_closed()
const;
49 inline bool is_executing()
const;
50 inline bool is_suspended()
const;
54 int source_position()
const;
57 DECL_ACCESSORS2(parameters_and_registers,
FixedArray)
66 static const int kGeneratorExecuting = -2;
67 static const int kGeneratorClosed = -1;
70 #define JS_GENERATOR_FIELDS(V) \ 71 V(kFunctionOffset, kTaggedSize) \ 72 V(kContextOffset, kTaggedSize) \ 73 V(kReceiverOffset, kTaggedSize) \ 74 V(kInputOrDebugPosOffset, kTaggedSize) \ 75 V(kResumeModeOffset, kTaggedSize) \ 76 V(kContinuationOffset, kTaggedSize) \ 77 V(kParametersAndRegistersOffset, kTaggedSize) \ 81 DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_GENERATOR_FIELDS)
82 #undef JS_GENERATOR_FIELDS 99 #define JS_ASYNC_FUNCTION_FIELDS(V) \ 100 V(kPromiseOffset, kTaggedSize) \ 104 DEFINE_FIELD_OFFSET_CONSTANTS(JSGeneratorObject::kSize,
105 JS_ASYNC_FUNCTION_FIELDS)
106 #undef JS_ASYNC_FUNCTION_FIELDS 126 DECL_INT_ACCESSORS(is_awaiting)
129 #define JS_ASYNC_GENERATOR_FIELDS(V) \ 130 V(kQueueOffset, kTaggedSize) \ 131 V(kIsAwaitingOffset, kTaggedSize) \ 135 DEFINE_FIELD_OFFSET_CONSTANTS(JSGeneratorObject::kSize,
136 JS_ASYNC_GENERATOR_FIELDS)
137 #undef JS_ASYNC_GENERATOR_FIELDS 146 DECL_ACCESSORS(next,
Object)
147 DECL_INT_ACCESSORS(resume_mode)
148 DECL_ACCESSORS(value,
Object)
149 DECL_ACCESSORS(promise,
Object)
151 static const int kNextOffset = Struct::kHeaderSize;
152 static const int kResumeModeOffset = kNextOffset + kPointerSize;
153 static const int kValueOffset = kResumeModeOffset + kPointerSize;
154 static const int kPromiseOffset = kValueOffset + kPointerSize;
155 static const int kSize = kPromiseOffset + kPointerSize;
168 #include "src/objects/object-macros-undef.h" 170 #endif // V8_OBJECTS_JS_GENERATOR_H_