summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/builtins-async-gen.h
blob: 70f68a498b7922743e94e1d4826a3c04468614ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2016 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.

#ifndef V8_BUILTINS_BUILTINS_ASYNC_GEN_H_
#define V8_BUILTINS_BUILTINS_ASYNC_GEN_H_

#include "src/builtins/builtins-promise-gen.h"

namespace v8 {
namespace internal {

class AsyncBuiltinsAssembler : public PromiseBuiltinsAssembler {
 public:
  explicit AsyncBuiltinsAssembler(compiler::CodeAssemblerState* state)
      : PromiseBuiltinsAssembler(state) {}

 protected:
  void Await(Node* context, Node* generator, Node* value, Node* outer_promise,
             Builtins::Name fulfill_builtin, Builtins::Name reject_builtin,
             Node* is_predicted_as_caught);
  void Await(Node* context, Node* generator, Node* value, Node* outer_promise,
             Builtins::Name fulfill_builtin, Builtins::Name reject_builtin,
             bool is_predicted_as_caught);

  // Return a new built-in function object as defined in
  // Async Iterator Value Unwrap Functions
  Node* CreateUnwrapClosure(Node* const native_context, Node* const done);

 private:
  Node* AllocateAsyncIteratorValueUnwrapContext(Node* native_context,
                                                Node* done);
  Node* AllocateAwaitPromiseJobTask(Node* generator, Node* fulfill_handler,
                                    Node* reject_handler, Node* promise,
                                    Node* context);
};

}  // namespace internal
}  // namespace v8

#endif  // V8_BUILTINS_BUILTINS_ASYNC_GEN_H_