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

Unified Diff: src/ast.h

Issue 7054034: Push the general AST id field down from ASTNode to Expression. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 7 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/full-codegen.h » ('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 8115)
+++ src/ast.h (working copy)
@@ -135,7 +135,7 @@
static const int kNoNumber = -1;
static const int kFunctionEntryId = 2; // Using 0 could disguise errors.
- AstNode() : id_(GetNextId()) {
+ AstNode() {
Isolate* isolate = Isolate::Current();
isolate->set_ast_node_count(isolate->ast_node_count() + 1);
}
@@ -164,15 +164,9 @@
static int Count() { return Isolate::Current()->ast_node_count(); }
static void ResetIds() { Isolate::Current()->set_ast_node_id(0); }
- unsigned id() const { return id_; }
protected:
- static unsigned GetNextId() {
- Isolate* isolate = Isolate::Current();
- unsigned tmp = isolate->ast_node_id();
- isolate->set_ast_node_id(tmp + 1);
- return tmp;
- }
+ static unsigned GetNextId() { return ReserveIdRange(1); }
static unsigned ReserveIdRange(int n) {
Isolate* isolate = Isolate::Current();
unsigned tmp = isolate->ast_node_id();
@@ -180,9 +174,6 @@
return tmp;
}
- private:
- unsigned id_;
-
friend class CaseClause; // Generates AST IDs.
};
@@ -220,7 +211,7 @@
kTest
};
- Expression() {}
+ Expression() : id_(GetNextId()) {}
virtual int position() const {
UNREACHABLE();
@@ -278,8 +269,11 @@
external_array_type_ = array_type;
}
+ unsigned id() const { return id_; }
+
private:
ExternalArrayType external_array_type_;
+ unsigned id_;
};
@@ -715,6 +709,7 @@
: condition_(condition),
then_statement_(then_statement),
else_statement_(else_statement),
+ if_id_(GetNextId()),
then_id_(GetNextId()),
else_id_(GetNextId()) {
}
@@ -730,6 +725,7 @@
Statement* then_statement() const { return then_statement_; }
Statement* else_statement() const { return else_statement_; }
+ int IfId() const { return if_id_; }
int ThenId() const { return then_id_; }
int ElseId() const { return else_id_; }
@@ -737,6 +733,7 @@
Expression* condition_;
Statement* then_statement_;
Statement* else_statement_;
+ int if_id_;
int then_id_;
int else_id_;
};
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698