| Index: src/ast.h
|
| diff --git a/src/ast.h b/src/ast.h
|
| index e1945b01cbec25a7f3c8cc1d8344e13c9cdf403f..f0b140efceaa38e5debe40df0a0ce5e9452a97e2 100644
|
| --- a/src/ast.h
|
| +++ b/src/ast.h
|
| @@ -891,25 +891,16 @@ class ForEachStatement: public IterationStatement {
|
| Expression* each() const { return each_; }
|
| Expression* subject() const { return subject_; }
|
|
|
| - virtual BailoutId ContinueId() const { return EntryId(); }
|
| - virtual BailoutId StackCheckId() const { return body_id_; }
|
| - BailoutId BodyId() const { return body_id_; }
|
| - BailoutId PrepareId() const { return prepare_id_; }
|
| -
|
| protected:
|
| ForEachStatement(Isolate* isolate, ZoneStringList* labels)
|
| : IterationStatement(isolate, labels),
|
| each_(NULL),
|
| - subject_(NULL),
|
| - body_id_(GetNextId(isolate)),
|
| - prepare_id_(GetNextId(isolate)) {
|
| + subject_(NULL) {
|
| }
|
|
|
| private:
|
| Expression* each_;
|
| Expression* subject_;
|
| - const BailoutId body_id_;
|
| - const BailoutId prepare_id_;
|
| };
|
|
|
|
|
| @@ -926,13 +917,22 @@ class ForInStatement: public ForEachStatement {
|
| enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
|
| ForInType for_in_type() const { return for_in_type_; }
|
|
|
| + BailoutId BodyId() const { return body_id_; }
|
| + BailoutId PrepareId() const { return prepare_id_; }
|
| + virtual BailoutId ContinueId() const { return EntryId(); }
|
| + virtual BailoutId StackCheckId() const { return body_id_; }
|
| +
|
| protected:
|
| ForInStatement(Isolate* isolate, ZoneStringList* labels)
|
| : ForEachStatement(isolate, labels),
|
| - for_in_type_(SLOW_FOR_IN) {
|
| + for_in_type_(SLOW_FOR_IN),
|
| + body_id_(GetNextId(isolate)),
|
| + prepare_id_(GetNextId(isolate)) {
|
| }
|
|
|
| ForInType for_in_type_;
|
| + const BailoutId body_id_;
|
| + const BailoutId prepare_id_;
|
| };
|
|
|
|
|
| @@ -940,14 +940,64 @@ class ForOfStatement: public ForEachStatement {
|
| public:
|
| DECLARE_NODE_TYPE(ForOfStatement)
|
|
|
| + void Initialize(Expression* each,
|
| + Expression* subject,
|
| + Statement* body,
|
| + Expression* assign_iterator,
|
| + Expression* next_result,
|
| + Expression* result_done,
|
| + Expression* assign_each) {
|
| + ForEachStatement::Initialize(each, subject, body);
|
| + assign_iterator_ = assign_iterator;
|
| + next_result_ = next_result;
|
| + result_done_ = result_done;
|
| + assign_each_ = assign_each;
|
| + }
|
| +
|
| Expression* iterable() const {
|
| return subject();
|
| }
|
|
|
| + // var iterator = iterable;
|
| + Expression* assign_iterator() const {
|
| + return assign_iterator_;
|
| + }
|
| +
|
| + // var result = iterator.next();
|
| + Expression* next_result() const {
|
| + return next_result_;
|
| + }
|
| +
|
| + // result.done
|
| + Expression* result_done() const {
|
| + return result_done_;
|
| + }
|
| +
|
| + // each = result.value
|
| + Expression* assign_each() const {
|
| + return assign_each_;
|
| + }
|
| +
|
| + virtual BailoutId ContinueId() const { return EntryId(); }
|
| + virtual BailoutId StackCheckId() const { return BackEdgeId(); }
|
| +
|
| + BailoutId BackEdgeId() const { return back_edge_id_; }
|
| +
|
| protected:
|
| ForOfStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : ForEachStatement(isolate, labels) {
|
| + : ForEachStatement(isolate, labels),
|
| + assign_iterator_(NULL),
|
| + next_result_(NULL),
|
| + result_done_(NULL),
|
| + assign_each_(NULL),
|
| + back_edge_id_(GetNextId(isolate)) {
|
| }
|
| +
|
| + Expression* assign_iterator_;
|
| + Expression* next_result_;
|
| + Expression* result_done_;
|
| + Expression* assign_each_;
|
| + const BailoutId back_edge_id_;
|
| };
|
|
|
|
|
|
|