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

Unified Diff: src/ast.h

Issue 13704010: Generator objects can suspend (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Use sentinel values for continuations Created 7 years, 8 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 | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index b7331388fd9744954519b8ea8c91fdfa7667682b..594b78008cceb472d831dad32270b4f5e94fc99e 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1964,27 +1964,34 @@ class Yield: public Expression {
public:
DECLARE_NODE_TYPE(Yield)
+ enum Kind {
+ INITIAL, // The initial yield that returns the unboxed generator object.
+ SUSPEND, // A normal yield: { value: EXPRESSION, done: false }
+ DELEGATING, // A yield*.
+ FINAL // A return: { value: EXPRESSION, done: true }
+ };
+
Expression* generator_object() const { return generator_object_; }
Expression* expression() const { return expression_; }
- bool is_delegating_yield() const { return is_delegating_yield_; }
+ Kind yield_kind() const { return yield_kind_; }
virtual int position() const { return pos_; }
protected:
Yield(Isolate* isolate,
Expression* generator_object,
Expression* expression,
- bool is_delegating_yield,
+ Kind yield_kind,
int pos)
: Expression(isolate),
generator_object_(generator_object),
expression_(expression),
- is_delegating_yield_(is_delegating_yield),
+ yield_kind_(yield_kind),
pos_(pos) { }
private:
Expression* generator_object_;
Expression* expression_;
- bool is_delegating_yield_;
+ Kind yield_kind_;
int pos_;
};
@@ -2966,10 +2973,10 @@ class AstNodeFactory BASE_EMBEDDED {
Yield* NewYield(Expression *generator_object,
Expression* expression,
- bool is_delegating_yield,
+ Yield::Kind yield_kind,
int pos) {
Yield* yield = new(zone_) Yield(
- isolate_, generator_object, expression, is_delegating_yield, pos);
+ isolate_, generator_object, expression, yield_kind, pos);
VISIT_AND_RETURN(Yield, yield)
}
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698