Line data Source code
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_GEN_H_
6 : #define V8_BUILTINS_BUILTINS_ASYNC_GEN_H_
7 :
8 : #include "src/builtins/builtins-promise-gen.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 :
13 1568 : class AsyncBuiltinsAssembler : public PromiseBuiltinsAssembler {
14 : public:
15 : explicit AsyncBuiltinsAssembler(compiler::CodeAssemblerState* state)
16 : : PromiseBuiltinsAssembler(state) {}
17 :
18 : protected:
19 : // Perform steps to resume generator after `value` is resolved.
20 : // `on_reject_context_index` is an index into the Native Context, which should
21 : // point to a SharedFunctioninfo instance used to create the closure. The
22 : // value following the reject index should be a similar value for the resolve
23 : // closure. Returns the Promise-wrapped `value`.
24 : Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise,
25 : Node* on_resolve_context_index, Node* on_reject_context_index,
26 : Node* is_predicted_as_caught);
27 280 : Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise,
28 : int on_resolve_context_index, int on_reject_context_index,
29 : Node* is_predicted_as_caught) {
30 : return Await(context, generator, value, outer_promise,
31 560 : IntPtrConstant(on_resolve_context_index),
32 560 : IntPtrConstant(on_reject_context_index),
33 560 : is_predicted_as_caught);
34 : }
35 224 : Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise,
36 : int on_resolve_context_index, int on_reject_context_index,
37 : bool is_predicted_as_caught) {
38 : return Await(context, generator, value, outer_promise,
39 : on_resolve_context_index, on_reject_context_index,
40 448 : BooleanConstant(is_predicted_as_caught));
41 : }
42 :
43 : // Return a new built-in function object as defined in
44 : // Async Iterator Value Unwrap Functions
45 : Node* CreateUnwrapClosure(Node* const native_context, Node* const done);
46 :
47 : private:
48 : void InitializeNativeClosure(Node* context, Node* native_context,
49 : Node* function, Node* context_index);
50 : Node* AllocateAsyncIteratorValueUnwrapContext(Node* native_context,
51 : Node* done);
52 :
53 : Node* AwaitOld(Node* context, Node* generator, Node* value,
54 : Node* outer_promise, Node* on_resolve_context_index,
55 : Node* on_reject_context_index, Node* is_predicted_as_caught);
56 : Node* AwaitOptimized(Node* context, Node* generator, Node* value,
57 : Node* outer_promise, Node* on_resolve_context_index,
58 : Node* on_reject_context_index,
59 : Node* is_predicted_as_caught);
60 : };
61 :
62 : } // namespace internal
63 : } // namespace v8
64 :
65 : #endif // V8_BUILTINS_BUILTINS_ASYNC_GEN_H_
|