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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 return item; | 328 return item; |
329 } | 329 } |
330 | 330 |
331 private: | 331 private: |
332 int capacity_; // Including one empty slot. | 332 int capacity_; // Including one empty slot. |
333 int head_; // Where the first item is. | 333 int head_; // Where the first item is. |
334 int tail_; // Where the next inserted item will go. | 334 int tail_; // Where the next inserted item will go. |
335 List<T*> queue_; | 335 List<T*> queue_; |
336 }; | 336 }; |
337 | 337 |
338 | |
339 // Computes the set of assigned variables and annotates variables proxies | |
340 // that are trivial sub-expressions and for-loops where the loop variable | |
341 // is guaranteed to be a smi. | |
342 class AssignedVariablesAnalyzer : public AstVisitor { | |
343 public: | |
344 static bool Analyze(CompilationInfo* info); | |
345 | |
346 private: | |
347 AssignedVariablesAnalyzer(CompilationInfo* info, int bits); | |
348 bool Analyze(); | |
349 | |
350 Variable* FindSmiLoopVariable(ForStatement* stmt); | |
351 | |
352 int BitIndex(Variable* var); | |
353 | |
354 void RecordAssignedVar(Variable* var); | |
355 | |
356 void MarkIfTrivial(Expression* expr); | |
357 | |
358 // Visits an expression saving the accumulator before, clearing | |
359 // it before visting and restoring it after visiting. | |
360 void ProcessExpression(Expression* expr); | |
361 | |
362 // AST node visit functions. | |
363 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | |
364 AST_NODE_LIST(DECLARE_VISIT) | |
365 #undef DECLARE_VISIT | |
366 | |
367 CompilationInfo* info_; | |
368 | |
369 // Accumulator for assigned variables set. | |
370 BitVector av_; | |
371 | |
372 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer); | |
373 }; | |
374 | |
375 | |
376 } } // namespace v8::internal | 338 } } // namespace v8::internal |
377 | 339 |
378 | 340 |
379 #endif // V8_DATAFLOW_H_ | 341 #endif // V8_DATAFLOW_H_ |
OLD | NEW |