| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 int tail_; // Where the next inserted item will go. | 191 int tail_; // Where the next inserted item will go. |
| 192 List<T*> queue_; | 192 List<T*> queue_; |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 | 195 |
| 196 // Computes the set of assigned variables and annotates variables proxies | 196 // Computes the set of assigned variables and annotates variables proxies |
| 197 // that are trivial sub-expressions and for-loops where the loop variable | 197 // that are trivial sub-expressions and for-loops where the loop variable |
| 198 // is guaranteed to be a smi. | 198 // is guaranteed to be a smi. |
| 199 class AssignedVariablesAnalyzer : public AstVisitor { | 199 class AssignedVariablesAnalyzer : public AstVisitor { |
| 200 public: | 200 public: |
| 201 explicit AssignedVariablesAnalyzer(FunctionLiteral* fun) : fun_(fun) { } | 201 explicit AssignedVariablesAnalyzer() : info_(NULL) { } |
| 202 bool Analyze(); | 202 bool Analyze(CompilationInfo* info); |
| 203 | 203 |
| 204 private: | 204 private: |
| 205 Variable* FindSmiLoopVariable(ForStatement* stmt); | 205 Variable* FindSmiLoopVariable(ForStatement* stmt); |
| 206 | 206 |
| 207 int BitIndex(Variable* var); | 207 int BitIndex(Variable* var); |
| 208 | 208 |
| 209 void RecordAssignedVar(Variable* var); | 209 void RecordAssignedVar(Variable* var); |
| 210 | 210 |
| 211 void MarkIfTrivial(Expression* expr); | 211 void MarkIfTrivial(Expression* expr); |
| 212 | 212 |
| 213 // Visits an expression saving the accumulator before, clearing | 213 // Visits an expression saving the accumulator before, clearing |
| 214 // it before visting and restoring it after visiting. | 214 // it before visting and restoring it after visiting. |
| 215 void ProcessExpression(Expression* expr); | 215 void ProcessExpression(Expression* expr); |
| 216 | 216 |
| 217 // AST node visit functions. | 217 // AST node visit functions. |
| 218 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 218 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 219 AST_NODE_LIST(DECLARE_VISIT) | 219 AST_NODE_LIST(DECLARE_VISIT) |
| 220 #undef DECLARE_VISIT | 220 #undef DECLARE_VISIT |
| 221 | 221 |
| 222 FunctionLiteral* fun_; | 222 CompilationInfo* info_; |
| 223 | 223 |
| 224 // Accumulator for assigned variables set. | 224 // Accumulator for assigned variables set. |
| 225 BitVector av_; | 225 BitVector av_; |
| 226 | 226 |
| 227 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer); | 227 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer); |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 | 230 |
| 231 } } // namespace v8::internal | 231 } } // namespace v8::internal |
| 232 | 232 |
| 233 | 233 |
| 234 #endif // V8_DATAFLOW_H_ | 234 #endif // V8_DATAFLOW_H_ |
| OLD | NEW |