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

Unified Diff: src/ast.h

Issue 594008: Initial implementation of fast path operation for bitwise OR. (Closed)
Patch Set: Fixed bug, added test. Created 10 years, 10 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/arm/fast-codegen-arm.cc ('k') | src/data-flow.cc » ('j') | no next file with comments »
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 48d0bfac066857f92b2f386903a157575f09fd82..2b38b18a97de4cb052591b354f1b98095fdb3527 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -193,6 +193,11 @@ class Expression: public AstNode {
// names because [] for string objects is handled only by keyed ICs.
virtual bool IsPropertyName() { return false; }
+ // True if the expression does not have (evaluated) subexpressions.
+ // Function literals are leaves because their subexpressions are not
+ // evaluated.
+ virtual bool IsLeaf() { return false; }
+
// Mark the expression as being compiled as an expression
// statement. This is used to transform postfix increments to
// (faster) prefix increments.
@@ -720,6 +725,8 @@ class Literal: public Expression {
return false;
}
+ virtual bool IsLeaf() { return true; }
+
// Identity testers.
bool IsNull() const { return handle_.is_identical_to(Factory::null_value()); }
bool IsTrue() const { return handle_.is_identical_to(Factory::true_value()); }
@@ -802,6 +809,8 @@ class ObjectLiteral: public MaterializedLiteral {
virtual ObjectLiteral* AsObjectLiteral() { return this; }
virtual void Accept(AstVisitor* v);
+ virtual bool IsLeaf() { return properties()->is_empty(); }
+
Handle<FixedArray> constant_properties() const {
return constant_properties_;
}
@@ -825,6 +834,8 @@ class RegExpLiteral: public MaterializedLiteral {
virtual void Accept(AstVisitor* v);
+ virtual bool IsLeaf() { return true; }
+
Handle<String> pattern() const { return pattern_; }
Handle<String> flags() const { return flags_; }
@@ -849,6 +860,8 @@ class ArrayLiteral: public MaterializedLiteral {
virtual void Accept(AstVisitor* v);
virtual ArrayLiteral* AsArrayLiteral() { return this; }
+ virtual bool IsLeaf() { return values()->is_empty(); }
+
Handle<FixedArray> constant_elements() const { return constant_elements_; }
ZoneList<Expression*>* values() const { return values_; }
@@ -896,6 +909,11 @@ class VariableProxy: public Expression {
return var_ == NULL ? true : var_->IsValidLeftHandSide();
}
+ virtual bool IsLeaf() {
+ ASSERT(var_ != NULL); // Variable must be resolved.
+ return var()->is_global() || var()->rewrite()->IsLeaf();
+ }
+
bool IsVariable(Handle<String> n) {
return !is_this() && name().is_identical_to(n);
}
@@ -981,6 +999,8 @@ class Slot: public Expression {
// Type testing & conversion
virtual Slot* AsSlot() { return this; }
+ virtual bool IsLeaf() { return true; }
+
// Accessors
Variable* var() const { return var_; }
Type type() const { return type_; }
@@ -1337,6 +1357,8 @@ class FunctionLiteral: public Expression {
// Type testing & conversion
virtual FunctionLiteral* AsFunctionLiteral() { return this; }
+ virtual bool IsLeaf() { return true; }
+
Handle<String> name() const { return name_; }
Scope* scope() const { return scope_; }
ZoneList<Statement*>* body() const { return body_; }
@@ -1403,6 +1425,8 @@ class FunctionBoilerplateLiteral: public Expression {
Handle<JSFunction> boilerplate() const { return boilerplate_; }
+ virtual bool IsLeaf() { return true; }
+
virtual void Accept(AstVisitor* v);
private:
@@ -1413,6 +1437,7 @@ class FunctionBoilerplateLiteral: public Expression {
class ThisFunction: public Expression {
public:
virtual void Accept(AstVisitor* v);
+ virtual bool IsLeaf() { return true; }
};
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/data-flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698