Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 #include "src/builtins/builtins-promise.h" | |
| 6 | |
| 7 namespace v8 { | |
| 8 namespace internal { | |
| 9 | |
| 10 class AsyncBuiltinsAssembler : public PromiseBuiltinsAssembler { | |
|
Dan Ehrenberg
2017/01/13 19:41:09
I'm a little surprised by this inheritance, and do
caitp
2017/01/13 20:11:52
Would that make CSA methods private, or just Promi
caitp
2017/01/17 19:23:11
This causes problems for the TF_BUILTIN pattern, i
| |
| 11 public: | |
| 12 explicit AsyncBuiltinsAssembler(CodeAssemblerState* state) | |
| 13 : PromiseBuiltinsAssembler(state) {} | |
| 14 | |
| 15 // Async Generator: | |
| 16 void AsyncGeneratorResumeNext(Node* context, Node* generator, | |
| 17 Node* continuation); | |
| 18 void AsyncGeneratorResumeNext(Node* context, Node* generator) { | |
| 19 Node* continuation = | |
| 20 LoadObjectField(generator, JSAsyncGeneratorObject::kContinuationOffset); | |
| 21 AsyncGeneratorResumeNext(context, generator, continuation); | |
| 22 } | |
| 23 | |
| 24 Node* TakeFirstAsyncGeneratorRequestFromQueue(Node* generator); | |
| 25 void AddAsyncGeneratorRequestToQueue(Node* generator, Node* request); | |
| 26 | |
| 27 Node* AllocateAsyncGeneratorRequest( | |
| 28 JSAsyncGeneratorObject::ResumeMode resume_mode, Node* resume_value, | |
| 29 Node* promise); | |
| 30 | |
| 31 // Async Iterator | |
| 32 Node* AllocateAsyncIteratorValueUnwrapContext(Node* native_context, | |
| 33 Node* promise, Node* done); | |
| 34 | |
| 35 protected: | |
| 36 // Async Generator shared | |
| 37 void AsyncGeneratorEnqueue(Node* context, Node* generator, Node* value, | |
| 38 JSAsyncGeneratorObject::ResumeMode resume_mode, | |
| 39 const char* method_name); | |
| 40 | |
| 41 void AsyncGeneratorAwaitResumeClosure( | |
| 42 Node* context, Node* value, | |
| 43 JSAsyncGeneratorObject::ResumeMode resume_mode); | |
| 44 | |
| 45 typedef std::function<Node*(Node*)> NodeGenerator1; | |
| 46 | |
| 47 // Perform steps to resume generator after `value` is resolved. | |
| 48 // `on_reject_context_index` is an index into the Native Context, which should | |
| 49 // point to a SharedFunctioninfo instance used to create the closure. The | |
| 50 // value following the reject index should be a similar value for the resolve | |
| 51 // closure. Returns the Promise-wrapped `value`. | |
| 52 Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise, | |
| 53 const NodeGenerator1& create_closure_context, | |
| 54 int on_reject_context_index, bool is_catchable); | |
| 55 | |
| 56 // Shared implementation of the catchable and uncatchable variations of Await | |
| 57 // for AsyncGenerators. | |
| 58 void AsyncGeneratorAwait(bool is_catchable); | |
| 59 | |
| 60 private: | |
| 61 // Async Generator private | |
| 62 void AsyncGeneratorResumeNextStep(Node* context, Node* generator, Node* req, | |
| 63 Node* continuation, Label* exit_loop); | |
| 64 }; | |
| 65 | |
| 66 } // namespace internal | |
| 67 } // namespace v8 | |
| OLD | NEW |