Chromium Code Reviews| Index: src/ast/ast.h |
| diff --git a/src/ast/ast.h b/src/ast/ast.h |
| index ba67f8f674cdb719fba14d21c5b80edfaa4ae1e2..b0b1facb17f38c9ad360476afb6bdf9df600e234 100644 |
| --- a/src/ast/ast.h |
| +++ b/src/ast/ast.h |
| @@ -2961,8 +2961,11 @@ class EmptyParentheses final : public Expression { |
| // (defined at https://tc39.github.io/ecma262/#sec-getiterator). Ignition |
| // desugars this into a LoadIC / JSLoadNamed, CallIC, and a type-check to |
| // validate return value of the Symbol.iterator() call. |
| +enum class IteratorType { kNormal, kAsync }; |
| class GetIterator final : public Expression { |
| public: |
| + IteratorType hint() const { return hint_; } |
|
adamk
2017/02/14 18:47:53
Naming nit: why not "type" instead of "hint"?
Dan Ehrenberg
2017/02/14 20:56:18
This is the spec's name, see https://tc39.github.i
|
| + |
| Expression* iterable() const { return iterable_; } |
| void set_iterable(Expression* iterable) { iterable_ = iterable; } |
| @@ -2972,6 +2975,11 @@ class GetIterator final : public Expression { |
| FeedbackSlotCache* cache) { |
| iterator_property_feedback_slot_ = spec->AddLoadICSlot(); |
| iterator_call_feedback_slot_ = spec->AddCallICSlot(); |
| + if (hint() == IteratorType::kAsync) { |
| + // Can we just re-use the other slots? |
|
adamk
2017/02/14 18:47:53
Looks like the answer to this is no? My read of th
caitp
2017/02/15 19:00:18
Done
|
| + async_iterator_property_feedback_slot_ = spec->AddLoadICSlot(); |
| + async_iterator_call_feedback_slot_ = spec->AddCallICSlot(); |
| + } |
| } |
| FeedbackSlot IteratorPropertyFeedbackSlot() const { |
| @@ -2982,15 +2990,26 @@ class GetIterator final : public Expression { |
| return iterator_call_feedback_slot_; |
| } |
| + FeedbackSlot AsyncIteratorPropertyFeedbackSlot() const { |
| + return async_iterator_property_feedback_slot_; |
| + } |
| + |
| + FeedbackSlot 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, IteratorType hint, int pos) |
| + : Expression(pos, kGetIterator), hint_(hint), iterable_(iterable) {} |
| + IteratorType hint_; |
| Expression* iterable_; |
| FeedbackSlot iterator_property_feedback_slot_; |
| FeedbackSlot iterator_call_feedback_slot_; |
| + FeedbackSlot async_iterator_property_feedback_slot_; |
| + FeedbackSlot async_iterator_call_feedback_slot_; |
| }; |
| // ---------------------------------------------------------------------------- |
| @@ -3572,8 +3591,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, IteratorType hint, |
| + int pos) { |
| + return new (zone_) GetIterator(iterable, hint, pos); |
| } |
| Zone* zone() const { return zone_; } |