• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_BUILTINS_BUILTINS_ASYNC_H_
6 #define V8_BUILTINS_BUILTINS_ASYNC_H_
7 
8 #include "src/builtins/builtins-promise.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 class AsyncBuiltinsAssembler : public PromiseBuiltinsAssembler {
14  public:
AsyncBuiltinsAssembler(CodeAssemblerState * state)15   explicit AsyncBuiltinsAssembler(CodeAssemblerState* state)
16       : PromiseBuiltinsAssembler(state) {}
17 
18  protected:
19   typedef std::function<Node*(Node*)> NodeGenerator1;
20 
21   // Perform steps to resume generator after `value` is resolved.
22   // `on_reject_context_index` is an index into the Native Context, which should
23   // point to a SharedFunctioninfo instance used to create the closure. The
24   // value following the reject index should be a similar value for the resolve
25   // closure. Returns the Promise-wrapped `value`.
26   Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise,
27               const NodeGenerator1& create_closure_context,
28               int on_resolve_context_index, int on_reject_context_index,
29               bool is_predicted_as_caught);
30 };
31 
32 }  // namespace internal
33 }  // namespace v8
34 
35 #endif  // V8_BUILTINS_BUILTINS_ASYNC_H_
36