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

Unified Diff: src/ast.h

Issue 39184: Optimizing nested, constant object literals (like JSON objects) by building o... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | « no previous file | src/ast.cc » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
===================================================================
--- src/ast.h (revision 1431)
+++ src/ast.h (working copy)
@@ -129,6 +129,7 @@
virtual BinaryOperation* AsBinaryOperation() { return NULL; }
virtual Assignment* AsAssignment() { return NULL; }
virtual FunctionLiteral* AsFunctionLiteral() { return NULL; }
+ virtual ObjectLiteral* AsObjectLiteral() { return NULL; }
void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
int statement_pos() const { return statement_pos_; }
@@ -651,10 +652,11 @@
public:
enum Kind {
- CONSTANT, // Property with constant value (at compile time).
- COMPUTED, // Property with computed value (at execution time).
+ CONSTANT, // Property with constant value (at compile time).
+ COMPUTED, // Property with computed value (at execution time).
+ OBJECT_LITERAL, // Property value is an object literal.
GETTER, SETTER, // Property is an accessor function.
- PROTOTYPE // Property is __proto__.
+ PROTOTYPE // Property is __proto__.
};
Property(Literal* key, Expression* value);
@@ -672,12 +674,15 @@
ObjectLiteral(Handle<FixedArray> constant_properties,
ZoneList<Property*>* properties,
- int literal_index)
+ int literal_index,
+ bool is_simple)
: MaterializedLiteral(literal_index),
constant_properties_(constant_properties),
- properties_(properties) {
+ properties_(properties),
+ is_simple_(is_simple) {
}
+ virtual ObjectLiteral* AsObjectLiteral() { return this; }
virtual void Accept(AstVisitor* v);
Handle<FixedArray> constant_properties() const {
@@ -685,9 +690,14 @@
}
ZoneList<Property*>* properties() const { return properties_; }
+ // An object literal is simple if the values consist of only
+ // constants and simple object literals.
+ bool is_simple() const { return is_simple_; }
+
private:
Handle<FixedArray> constant_properties_;
ZoneList<Property*>* properties_;
+ bool is_simple_;
};
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698