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

Unified Diff: src/ast.h

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/assembler.h ('k') | src/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
===================================================================
--- src/ast.h (revision 3964)
+++ src/ast.h (working copy)
@@ -117,6 +117,9 @@
class AstNode: public ZoneObject {
public:
+ static const int kNoNumber = -1;
+
+ AstNode() : num_(kNoNumber) {}
virtual ~AstNode() { }
virtual void Accept(AstVisitor* v) = 0;
@@ -141,6 +144,13 @@
virtual ObjectLiteral* AsObjectLiteral() { return NULL; }
virtual ArrayLiteral* AsArrayLiteral() { return NULL; }
virtual CompareOperation* AsCompareOperation() { return NULL; }
+
+ int num() { return num_; }
+ void set_num(int n) { num_ = n; }
+
+ private:
+ // Support for ast node numbering.
+ int num_;
};
@@ -181,10 +191,11 @@
kTestValue
};
- static const int kNoLabel = -1;
+ Expression()
+ : bitfields_(0),
+ def_(NULL),
+ defined_vars_(NULL) {}
- Expression() : num_(kNoLabel), def_(NULL), defined_vars_(NULL) {}
-
virtual Expression* AsExpression() { return this; }
virtual bool IsValidLeftHandSide() { return false; }
@@ -211,11 +222,6 @@
// Static type information for this expression.
StaticType* type() { return &type_; }
- int num() { return num_; }
-
- // AST node numbering ordered by evaluation order.
- void set_num(int n) { num_ = n; }
-
// Data flow information.
DefinitionInfo* var_def() { return def_; }
void set_var_def(DefinitionInfo* def) { def_ = def; }
@@ -225,11 +231,36 @@
defined_vars_ = defined_vars;
}
+ // AST analysis results
+
+ // True if the expression rooted at this node can be compiled by the
+ // side-effect free compiler.
+ bool side_effect_free() { return SideEffectFreeField::decode(bitfields_); }
+ void set_side_effect_free(bool is_side_effect_free) {
+ bitfields_ &= ~SideEffectFreeField::mask();
+ bitfields_ |= SideEffectFreeField::encode(is_side_effect_free);
+ }
+
+ // Will ToInt32 (ECMA 262-3 9.5) or ToUint32 (ECMA 262-3 9.6)
+ // be applied to the value of this expression?
+ // If so, we may be able to optimize the calculation of the value.
+ bool to_int32() { return ToInt32Field::decode(bitfields_); }
+ void set_to_int32(bool to_int32) {
+ bitfields_ &= ~ToInt32Field::mask();
+ bitfields_ |= ToInt32Field::encode(to_int32);
+ }
+
+
private:
+ uint32_t bitfields_;
StaticType type_;
- int num_;
+
DefinitionInfo* def_;
ZoneList<DefinitionInfo*>* defined_vars_;
+
+ // Using template BitField<type, start, size>.
+ class SideEffectFreeField : public BitField<bool, 0, 1> {};
+ class ToInt32Field : public BitField<bool, 1, 1> {};
};
@@ -946,8 +977,6 @@
Handle<String> name() const { return name_; }
Variable* var() const { return var_; }
- UseCount* var_uses() { return &var_uses_; }
- UseCount* obj_uses() { return &obj_uses_; }
bool is_this() const { return is_this_; }
bool inside_with() const { return inside_with_; }
@@ -960,10 +989,6 @@
bool is_this_;
bool inside_with_;
- // VariableProxy usage info.
- UseCount var_uses_; // uses of the variable value
- UseCount obj_uses_; // uses of the object the variable points to
-
VariableProxy(Handle<String> name, bool is_this, bool inside_with);
explicit VariableProxy(bool is_this);
@@ -1022,6 +1047,8 @@
virtual bool IsLeaf() { return true; }
+ bool IsStackAllocated() { return type_ == PARAMETER || type_ == LOCAL; }
+
// Accessors
Variable* var() const { return var_; }
Type type() const { return type_; }
« no previous file with comments | « src/assembler.h ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698