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

Side by Side Diff: src/data-flow.h

Issue 851002: Fix assigned variables analysis.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler.cc ('k') | src/data-flow.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 AST_NODE_LIST(DECLARE_VISIT) 479 AST_NODE_LIST(DECLARE_VISIT)
480 #undef DECLARE_VISIT 480 #undef DECLARE_VISIT
481 481
482 // Map for tracking the live variables. 482 // Map for tracking the live variables.
483 VarUseMap live_vars_; 483 VarUseMap live_vars_;
484 484
485 DISALLOW_COPY_AND_ASSIGN(LivenessAnalyzer); 485 DISALLOW_COPY_AND_ASSIGN(LivenessAnalyzer);
486 }; 486 };
487 487
488 488
489 // Computes the set of assigned variables and annotates variables proxies
490 // that are trivial sub-expressions and for-loops where the loop variable
491 // is guaranteed to be a smi.
492 class AssignedVariablesAnalyzer : public AstVisitor {
493 public:
494 explicit AssignedVariablesAnalyzer(FunctionLiteral* fun);
495
496 void Analyze();
497
498 private:
499 Variable* FindSmiLoopVariable(ForStatement* stmt);
500
501 int BitIndex(Variable* var);
502
503 void RecordAssignedVar(Variable* var);
504
505 void MarkIfTrivial(Expression* expr);
506
507 // Visits an expression saving the accumulator before, clearing
508 // it before visting and restoring it after visiting.
509 void ProcessExpression(Expression* expr);
510
511 // AST node visit functions.
512 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
513 AST_NODE_LIST(DECLARE_VISIT)
514 #undef DECLARE_VISIT
515
516 FunctionLiteral* fun_;
517
518 // Accumulator for assigned variables set.
519 BitVector av_;
520
521 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer);
522 };
523
489 } } // namespace v8::internal 524 } } // namespace v8::internal
490 525
491 526
492 #endif // V8_DATAFLOW_H_ 527 #endif // V8_DATAFLOW_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/data-flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698