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

Unified Diff: src/ast/ast.h

Issue 1564083002: Add spread rewriting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/ast/ast-expression-visitor.cc » ('j') | src/parsing/parser.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 eaacf4b3cfade077490acfa553c92e708ad392b8..5c200c4da6c8e9317c404d8fa2ad183e18bd5aba 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -924,6 +924,11 @@ class ForOfStatement final : public ForEachStatement {
return assign_each_;
}
+ void set_assign_iterator(Expression* e) { assign_iterator_ = e; }
+ void set_next_result(Expression* e) { next_result_ = e; }
+ void set_result_done(Expression* e) { result_done_ = e; }
+ void set_assign_each(Expression* e) { assign_each_ = e; }
+
BailoutId ContinueId() const override { return EntryId(); }
BailoutId StackCheckId() const override { return BackEdgeId(); }
@@ -1682,6 +1687,19 @@ class ArrayLiteral final : public MaterializedLiteral {
return flags;
}
+ // Provide a mechanism for iterating through values to rewrite spreads.
+ ZoneList<Expression*>::iterator FirstSpread() const {
+ return (first_spread_index_ >= 0) ? values_->begin() + first_spread_index_
+ : values_->end();
+ }
+ ZoneList<Expression*>::iterator EndValue() const { return values_->end(); }
+
+ // Rewind an array literal omitting everything from the first spread on.
+ void RewindSpreads() {
+ values_->Rewind(first_spread_index_);
+ first_spread_index_ = -1;
+ }
+
enum Flags {
kNoFlags = 0,
kShallowElements = 1,
@@ -3385,8 +3403,9 @@ class AstVisitor BASE_EMBEDDED {
public: \
AstNode* Rewrite(AstNode* node) { \
DCHECK_NULL(replacement_); \
+ DCHECK_NOT_NULL(node); \
Visit(node); \
- if (HasStackOverflow()) return nullptr; \
+ if (HasStackOverflow()) return node; \
if (replacement_ == nullptr) return node; \
AstNode* result = replacement_; \
replacement_ = nullptr; \
« no previous file with comments | « no previous file | src/ast/ast-expression-visitor.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698