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

Unified Diff: src/ast/ast.h

Issue 2557593004: [ignition] desugar GetIterator() via bytecode rather than via AST (Closed)
Patch Set: georg's comments 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
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast-expression-rewriter.cc » ('j') | no next file with comments »
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 c68fb6c88960a0dbcd8b1eb15a8d1f6540a66acd..ece9957a3c3935808103e1d40e752e21c65611f6 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)
@@ -2936,7 +2937,43 @@ class EmptyParentheses final : public Expression {
explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {}
};
+// Represents the spec operation `GetIterator()`
+// (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.
+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
@@ -3519,6 +3556,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; }
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast-expression-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698