• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_OBJECTS_JS_GENERATOR_INL_H_
6 #define V8_OBJECTS_JS_GENERATOR_INL_H_
7 
8 #include "src/objects/js-generator.h"
9 #include "src/objects/js-promise-inl.h"
10 
11 #include "src/objects/objects-inl.h"  // Needed for write barriers
12 
13 // Has to be the last include (doesn't have include guards):
14 #include "src/objects/object-macros.h"
15 
16 namespace v8 {
17 namespace internal {
18 
19 #include "torque-generated/src/objects/js-generator-tq-inl.inc"
20 
21 TQ_OBJECT_CONSTRUCTORS_IMPL(JSGeneratorObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSAsyncFunctionObject)22 TQ_OBJECT_CONSTRUCTORS_IMPL(JSAsyncFunctionObject)
23 TQ_OBJECT_CONSTRUCTORS_IMPL(JSAsyncGeneratorObject)
24 TQ_OBJECT_CONSTRUCTORS_IMPL(AsyncGeneratorRequest)
25 
26 bool JSGeneratorObject::is_suspended() const {
27   DCHECK_LT(kGeneratorExecuting, 0);
28   DCHECK_LT(kGeneratorClosed, 0);
29   return continuation() >= 0;
30 }
31 
is_closed()32 bool JSGeneratorObject::is_closed() const {
33   return continuation() == kGeneratorClosed;
34 }
35 
is_executing()36 bool JSGeneratorObject::is_executing() const {
37   return continuation() == kGeneratorExecuting;
38 }
39 
40 }  // namespace internal
41 }  // namespace v8
42 
43 #include "src/objects/object-macros-undef.h"
44 
45 #endif  // V8_OBJECTS_JS_GENERATOR_INL_H_
46