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

Side by Side Diff: src/ast.h

Issue 23684058: Unify handling of position info in AST, part 3 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 V(Property) \ 110 V(Property) \
111 V(Call) \ 111 V(Call) \
112 V(CallNew) \ 112 V(CallNew) \
113 V(CallRuntime) \ 113 V(CallRuntime) \
114 V(UnaryOperation) \ 114 V(UnaryOperation) \
115 V(CountOperation) \ 115 V(CountOperation) \
116 V(BinaryOperation) \ 116 V(BinaryOperation) \
117 V(CompareOperation) \ 117 V(CompareOperation) \
118 V(ThisFunction) 118 V(ThisFunction)
119 119
120 #define AUXILIARY_NODE_LIST(V) \
121 V(CaseClause)
122
120 #define AST_NODE_LIST(V) \ 123 #define AST_NODE_LIST(V) \
121 DECLARATION_NODE_LIST(V) \ 124 DECLARATION_NODE_LIST(V) \
122 MODULE_NODE_LIST(V) \ 125 MODULE_NODE_LIST(V) \
123 STATEMENT_NODE_LIST(V) \ 126 STATEMENT_NODE_LIST(V) \
124 EXPRESSION_NODE_LIST(V) 127 EXPRESSION_NODE_LIST(V) \
128 AUXILIARY_NODE_LIST(V)
125 129
126 // Forward declarations 130 // Forward declarations
127 class AstConstructionVisitor; 131 class AstConstructionVisitor;
128 template<class> class AstNodeFactory; 132 template<class> class AstNodeFactory;
129 class AstVisitor; 133 class AstVisitor;
130 class Declaration; 134 class Declaration;
131 class Module; 135 class Module;
132 class BreakableStatement; 136 class BreakableStatement;
133 class Expression; 137 class Expression;
134 class IterationStatement; 138 class IterationStatement;
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 expression_(expression), 1100 expression_(expression),
1097 statement_(statement) { } 1101 statement_(statement) { }
1098 1102
1099 private: 1103 private:
1100 Scope* scope_; 1104 Scope* scope_;
1101 Expression* expression_; 1105 Expression* expression_;
1102 Statement* statement_; 1106 Statement* statement_;
1103 }; 1107 };
1104 1108
1105 1109
1106 class CaseClause V8_FINAL : public ZoneObject { 1110 class CaseClause V8_FINAL : public AstNode {
1107 public: 1111 public:
1108 CaseClause(Isolate* isolate, 1112 DECLARE_NODE_TYPE(CaseClause)
1109 Expression* label,
1110 ZoneList<Statement*>* statements,
1111 int pos);
1112 1113
1113 bool is_default() const { return label_ == NULL; } 1114 bool is_default() const { return label_ == NULL; }
1114 Expression* label() const { 1115 Expression* label() const {
1115 CHECK(!is_default()); 1116 CHECK(!is_default());
1116 return label_; 1117 return label_;
1117 } 1118 }
1118 Label* body_target() { return &body_target_; } 1119 Label* body_target() { return &body_target_; }
1119 ZoneList<Statement*>* statements() const { return statements_; } 1120 ZoneList<Statement*>* statements() const { return statements_; }
1120 1121
1121 int position() const { return position_; }
1122 void set_position(int pos) { position_ = pos; }
1123
1124 BailoutId EntryId() const { return entry_id_; } 1122 BailoutId EntryId() const { return entry_id_; }
1125 1123
1126 // Type feedback information. 1124 // Type feedback information.
1127 TypeFeedbackId CompareId() { return compare_id_; } 1125 TypeFeedbackId CompareId() { return compare_id_; }
1128 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1126 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1129 Handle<Type> compare_type() { return compare_type_; } 1127 Handle<Type> compare_type() { return compare_type_; }
1130 1128
1131 private: 1129 private:
1130 CaseClause(Isolate* isolate,
1131 Expression* label,
1132 ZoneList<Statement*>* statements,
1133 int pos);
1134
1132 Expression* label_; 1135 Expression* label_;
1133 Label body_target_; 1136 Label body_target_;
1134 ZoneList<Statement*>* statements_; 1137 ZoneList<Statement*>* statements_;
1135 int position_;
1136 Handle<Type> compare_type_; 1138 Handle<Type> compare_type_;
1137 1139
1138 const TypeFeedbackId compare_id_; 1140 const TypeFeedbackId compare_id_;
1139 const BailoutId entry_id_; 1141 const BailoutId entry_id_;
1140 }; 1142 };
1141 1143
1142 1144
1143 class SwitchStatement V8_FINAL : public BreakableStatement { 1145 class SwitchStatement V8_FINAL : public BreakableStatement {
1144 public: 1146 public:
1145 DECLARE_NODE_TYPE(SwitchStatement) 1147 DECLARE_NODE_TYPE(SwitchStatement)
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 3038
3037 DebuggerStatement* NewDebuggerStatement(int pos) { 3039 DebuggerStatement* NewDebuggerStatement(int pos) {
3038 DebuggerStatement* stmt = new(zone_) DebuggerStatement(pos); 3040 DebuggerStatement* stmt = new(zone_) DebuggerStatement(pos);
3039 VISIT_AND_RETURN(DebuggerStatement, stmt) 3041 VISIT_AND_RETURN(DebuggerStatement, stmt)
3040 } 3042 }
3041 3043
3042 EmptyStatement* NewEmptyStatement(int pos) { 3044 EmptyStatement* NewEmptyStatement(int pos) {
3043 return new(zone_) EmptyStatement(pos); 3045 return new(zone_) EmptyStatement(pos);
3044 } 3046 }
3045 3047
3048 CaseClause* NewCaseClause(
3049 Expression* label, ZoneList<Statement*>* statements, int pos) {
3050 CaseClause* clause =
3051 new(zone_) CaseClause(isolate_, label, statements, pos);
3052 VISIT_AND_RETURN(CaseClause, clause)
3053 }
3054
3046 Literal* NewLiteral(Handle<Object> handle, int pos) { 3055 Literal* NewLiteral(Handle<Object> handle, int pos) {
3047 Literal* lit = new(zone_) Literal(isolate_, handle, pos); 3056 Literal* lit = new(zone_) Literal(isolate_, handle, pos);
3048 VISIT_AND_RETURN(Literal, lit) 3057 VISIT_AND_RETURN(Literal, lit)
3049 } 3058 }
3050 3059
3051 Literal* NewNumberLiteral(double number, int pos) { 3060 Literal* NewNumberLiteral(double number, int pos) {
3052 return NewLiteral(isolate_->factory()->NewNumber(number, TENURED), pos); 3061 return NewLiteral(isolate_->factory()->NewNumber(number, TENURED), pos);
3053 } 3062 }
3054 3063
3055 ObjectLiteral* NewObjectLiteral( 3064 ObjectLiteral* NewObjectLiteral(
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
3253 private: 3262 private:
3254 Isolate* isolate_; 3263 Isolate* isolate_;
3255 Zone* zone_; 3264 Zone* zone_;
3256 Visitor visitor_; 3265 Visitor visitor_;
3257 }; 3266 };
3258 3267
3259 3268
3260 } } // namespace v8::internal 3269 } } // namespace v8::internal
3261 3270
3262 #endif // V8_AST_H_ 3271 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698