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

Unified Diff: src/ast.h

Issue 1074009: Mark all loop conditions. (Closed)
Patch Set: Negate test to match previous (and correct) behavior. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/data-flow.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 96e398d90c10481c3cb4f776b313a9f3eade6a74..c9221b1d0d4803618f06a721b1ce0267154bb712 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -239,6 +239,15 @@ class Expression: public AstNode {
// Static type information for this expression.
StaticType* type() { return &type_; }
+ // True if the expression is a loop condition.
+ bool is_loop_condition() const {
+ return LoopConditionField::decode(bitfields_);
+ }
+ void set_is_loop_condition(bool flag) {
+ bitfields_ = (bitfields_ & ~LoopConditionField::mask()) |
+ LoopConditionField::encode(flag);
+ }
+
// AST analysis results
// True if the expression rooted at this node can be compiled by the
@@ -285,6 +294,7 @@ class Expression: public AstNode {
class NoNegativeZeroField : public BitField<bool, 1, 1> {};
class ToInt32Field : public BitField<bool, 2, 1> {};
class NumBitOpsField : public BitField<int, 3, 5> {};
+ class LoopConditionField: public BitField<bool, 8, 1> {};
};
@@ -1425,7 +1435,7 @@ class CountOperation: public Expression {
class CompareOperation: public Expression {
public:
CompareOperation(Token::Value op, Expression* left, Expression* right)
- : op_(op), left_(left), right_(right), is_for_loop_condition_(false) {
+ : op_(op), left_(left), right_(right) {
ASSERT(Token::IsCompareOp(op));
}
@@ -1441,10 +1451,6 @@ class CompareOperation: public Expression {
Expression* left() const { return left_; }
Expression* right() const { return right_; }
- // Accessors for flag whether this compare operation is hanging of a for loop.
- bool is_for_loop_condition() const { return is_for_loop_condition_; }
- void set_is_for_loop_condition() { is_for_loop_condition_ = true; }
-
// Type testing & conversion
virtual CompareOperation* AsCompareOperation() { return this; }
@@ -1452,7 +1458,6 @@ class CompareOperation: public Expression {
Token::Value op_;
Expression* left_;
Expression* right_;
- bool is_for_loop_condition_;
};
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/data-flow.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698