| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 class Processor: public AstVisitor { | 39 class Processor: public AstVisitor { |
| 40 public: | 40 public: |
| 41 Processor(Variable* result, Zone* zone) | 41 Processor(Variable* result, Zone* zone) |
| 42 : result_(result), | 42 : result_(result), |
| 43 result_assigned_(false), | 43 result_assigned_(false), |
| 44 is_set_(false), | 44 is_set_(false), |
| 45 in_try_(false), | 45 in_try_(false), |
| 46 factory_(Isolate::Current(), zone) { | 46 factory_(isolate(), zone) { } |
| 47 InitializeAstVisitor(); | |
| 48 } | |
| 49 | 47 |
| 50 virtual ~Processor() { } | 48 virtual ~Processor() { } |
| 51 | 49 |
| 52 void Process(ZoneList<Statement*>* statements); | 50 void Process(ZoneList<Statement*>* statements); |
| 53 bool result_assigned() const { return result_assigned_; } | 51 bool result_assigned() const { return result_assigned_; } |
| 54 | 52 |
| 55 AstNodeFactory<AstNullVisitor>* factory() { | 53 AstNodeFactory<AstNullVisitor>* factory() { |
| 56 return &factory_; | 54 return &factory_; |
| 57 } | 55 } |
| 58 | 56 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 81 Token::ASSIGN, result_proxy, value, RelocInfo::kNoPosition); | 79 Token::ASSIGN, result_proxy, value, RelocInfo::kNoPosition); |
| 82 } | 80 } |
| 83 | 81 |
| 84 // Node visitors. | 82 // Node visitors. |
| 85 #define DEF_VISIT(type) \ | 83 #define DEF_VISIT(type) \ |
| 86 virtual void Visit##type(type* node); | 84 virtual void Visit##type(type* node); |
| 87 AST_NODE_LIST(DEF_VISIT) | 85 AST_NODE_LIST(DEF_VISIT) |
| 88 #undef DEF_VISIT | 86 #undef DEF_VISIT |
| 89 | 87 |
| 90 void VisitIterationStatement(IterationStatement* stmt); | 88 void VisitIterationStatement(IterationStatement* stmt); |
| 91 | |
| 92 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | |
| 93 }; | 89 }; |
| 94 | 90 |
| 95 | 91 |
| 96 void Processor::Process(ZoneList<Statement*>* statements) { | 92 void Processor::Process(ZoneList<Statement*>* statements) { |
| 97 for (int i = statements->length() - 1; i >= 0; --i) { | 93 for (int i = statements->length() - 1; i >= 0; --i) { |
| 98 Visit(statements->at(i)); | 94 Visit(statements->at(i)); |
| 99 } | 95 } |
| 100 } | 96 } |
| 101 | 97 |
| 102 | 98 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 result_statement->set_statement_pos(position); | 271 result_statement->set_statement_pos(position); |
| 276 body->Add(result_statement, info->zone()); | 272 body->Add(result_statement, info->zone()); |
| 277 } | 273 } |
| 278 } | 274 } |
| 279 | 275 |
| 280 return true; | 276 return true; |
| 281 } | 277 } |
| 282 | 278 |
| 283 | 279 |
| 284 } } // namespace v8::internal | 280 } } // namespace v8::internal |
| OLD | NEW |