js-generator.tq 1.34 KB
Newer Older
Tobias Tebbi's avatar
Tobias Tebbi committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

extern class JSGeneratorObject extends JSObject {
  function: JSFunction;
  context: Context;
  receiver: JSAny;

  // For executing generators: the most recent input value.
  // For suspended generators: debug information (bytecode offset).
  // There is currently no need to remember the most recent input value for a
  // suspended generator.
  input_or_debug_pos: Object;

16
  // The most recent resume mode.
Tobias Tebbi's avatar
Tobias Tebbi committed
17
  resume_mode: Smi;
18 19 20 21

  // A positive value indicates a suspended generator.  The special
  // kGeneratorExecuting and kGeneratorClosed values indicate that a generator
  // cannot be resumed.
Tobias Tebbi's avatar
Tobias Tebbi committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35
  continuation: Smi;

  // Saved interpreter register file.
  parameters_and_registers: FixedArray;
}

extern class JSAsyncFunctionObject extends JSGeneratorObject {
  promise: JSPromise;
}

extern class JSAsyncGeneratorObject extends JSGeneratorObject {
  // Pointer to the head of a singly linked list of AsyncGeneratorRequest, or
  // undefined.
  queue: HeapObject;
36
  // Whether or not the generator is currently awaiting.
Tobias Tebbi's avatar
Tobias Tebbi committed
37 38 39 40 41 42 43 44 45
  is_awaiting: Smi;
}

extern class AsyncGeneratorRequest extends Struct {
  next: AsyncGeneratorRequest|Undefined;
  resume_mode: Smi;
  value: Object;
  promise: JSPromise;
}