Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Unified Diff: src/ast/ast.h

Issue 2637403008: [async-iteration] add support for for-await-of loops in Async Functions (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/interpreter/bytecode-generator.h » ('j') | src/interpreter/bytecode-generator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 9a87328a7b98ad1cb1fc62a9da26d03d1fdfc5cd..9da5d0dd1ef4e0915c635aeddb2ae83314521200 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -2967,6 +2967,10 @@ class EmptyParentheses final : public Expression {
// validate return value of the Symbol.iterator() call.
class GetIterator final : public Expression {
public:
+ enum Hint { kNormal, kAsync };
neis 2017/01/20 14:38:15 Can you instead use the IteratorType enum that you
+
+ Hint hint() const { return hint_; }
+
Expression* iterable() const { return iterable_; }
void set_iterable(Expression* iterable) { iterable_ = iterable; }
@@ -2978,6 +2982,14 @@ class GetIterator final : public Expression {
spec->AddSlot(FeedbackVectorSlotKind::LOAD_IC);
iterator_call_feedback_slot_ =
spec->AddSlot(FeedbackVectorSlotKind::CALL_IC);
+
+ if (hint() == kAsync) {
+ // Can we just re-use the other slots?
+ async_iterator_property_feedback_slot_ =
+ spec->AddSlot(FeedbackVectorSlotKind::LOAD_IC);
+ async_iterator_call_feedback_slot_ =
+ spec->AddSlot(FeedbackVectorSlotKind::CALL_IC);
+ }
}
FeedbackVectorSlot IteratorPropertyFeedbackSlot() const {
@@ -2988,15 +3000,26 @@ class GetIterator final : public Expression {
return iterator_call_feedback_slot_;
}
+ FeedbackVectorSlot AsyncIteratorPropertyFeedbackSlot() const {
+ return async_iterator_property_feedback_slot_;
+ }
+
+ FeedbackVectorSlot AsyncIteratorCallFeedbackSlot() const {
+ return async_iterator_call_feedback_slot_;
+ }
+
private:
friend class AstNodeFactory;
- explicit GetIterator(Expression* iterable, int pos)
- : Expression(pos, kGetIterator), iterable_(iterable) {}
+ explicit GetIterator(Expression* iterable, Hint hint, int pos)
+ : Expression(pos, kGetIterator), hint_(hint), iterable_(iterable) {}
+ Hint hint_;
Expression* iterable_;
FeedbackVectorSlot iterator_property_feedback_slot_;
FeedbackVectorSlot iterator_call_feedback_slot_;
+ FeedbackVectorSlot async_iterator_property_feedback_slot_;
+ FeedbackVectorSlot async_iterator_call_feedback_slot_;
};
// ----------------------------------------------------------------------------
@@ -3576,8 +3599,9 @@ class AstNodeFactory final BASE_EMBEDDED {
return new (zone_) EmptyParentheses(pos);
}
- GetIterator* NewGetIterator(Expression* iterable, int pos) {
- return new (zone_) GetIterator(iterable, pos);
+ GetIterator* NewGetIterator(Expression* iterable, GetIterator::Hint hint,
+ int pos) {
+ return new (zone_) GetIterator(iterable, hint, pos);
}
Zone* zone() const { return zone_; }
« no previous file with comments | « no previous file | src/interpreter/bytecode-generator.h » ('j') | src/interpreter/bytecode-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698