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

Unified Diff: src/ast/ast.h

Issue 2557593004: [ignition] desugar GetIterator() via bytecode rather than via AST (Closed)
Patch Set: rebase Created 4 years 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
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 1a3087adf034aa03c60f221df643d4c7f9fd8020..2e635d6f858b262a4d7c3d283efe01a26477b735 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -102,6 +102,7 @@ namespace internal {
V(SuperCallReference) \
V(CaseClause) \
V(EmptyParentheses) \
+ V(GetIterator) \
V(DoExpression) \
V(RewritableExpression)
@@ -2921,7 +2922,40 @@ class EmptyParentheses final : public Expression {
explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {}
};
+// "Property" with additional semantics.
adamk 2016/12/06 18:49:05 This could use a little more detail for readers no
caitp 2016/12/06 19:00:44 Acknowledged.
+class GetIterator final : public Expression {
+ public:
+ Expression* iterable() const { return iterable_; }
+ void set_iterable(Expression* iterable) { iterable_ = iterable; }
+
+ static int num_ids() { return parent_num_ids(); }
+
+ void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
+ FeedbackVectorSlotCache* cache) {
+ iterator_property_feedback_slot_ =
+ spec->AddSlot(FeedbackVectorSlotKind::LOAD_IC);
+ iterator_call_feedback_slot_ =
+ spec->AddSlot(FeedbackVectorSlotKind::CALL_IC);
+ }
+
+ FeedbackVectorSlot IteratorPropertyFeedbackSlot() const {
+ return iterator_property_feedback_slot_;
+ }
+ FeedbackVectorSlot IteratorCallFeedbackSlot() const {
+ return iterator_call_feedback_slot_;
+ }
+
+ private:
+ friend class AstNodeFactory;
+
+ explicit GetIterator(Expression* iterable, int pos)
+ : Expression(pos, kGetIterator), iterable_(iterable) {}
+
+ Expression* iterable_;
+ FeedbackVectorSlot iterator_property_feedback_slot_;
+ FeedbackVectorSlot iterator_call_feedback_slot_;
+};
// ----------------------------------------------------------------------------
// Basic visitor
@@ -3501,6 +3535,10 @@ class AstNodeFactory final BASE_EMBEDDED {
return new (zone_) EmptyParentheses(pos);
}
+ GetIterator* NewGetIterator(Expression* iterable, int pos) {
+ return new (zone_) GetIterator(iterable, pos);
+ }
+
Zone* zone() const { return zone_; }
void set_zone(Zone* zone) { zone_ = zone; }

Powered by Google App Engine
This is Rietveld 408576698