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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10399026: Add a global graph entry. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 // | TargetEntry <Instruction> 1118 // | TargetEntry <Instruction>
1119 // | Do <Computation> <Instruction> 1119 // | Do <Computation> <Instruction>
1120 // | Return <Value> 1120 // | Return <Value>
1121 // | Branch <Value> <Instruction> <Instruction> 1121 // | Branch <Value> <Instruction> <Instruction>
1122 // <Definition> ::= Bind <int> <Computation> <Instruction> 1122 // <Definition> ::= Bind <int> <Computation> <Instruction>
1123 1123
1124 // M is a single argument macro. It is applied to each concrete instruction 1124 // M is a single argument macro. It is applied to each concrete instruction
1125 // type name. The concrete instruction classes are the name with Instr 1125 // type name. The concrete instruction classes are the name with Instr
1126 // concatenated. 1126 // concatenated.
1127 #define FOR_EACH_INSTRUCTION(M) \ 1127 #define FOR_EACH_INSTRUCTION(M) \
1128 M(GraphEntry) \
1128 M(JoinEntry) \ 1129 M(JoinEntry) \
1129 M(TargetEntry) \ 1130 M(TargetEntry) \
1130 M(Do) \ 1131 M(Do) \
1131 M(Bind) \ 1132 M(Bind) \
1132 M(Return) \ 1133 M(Return) \
1133 M(Throw) \ 1134 M(Throw) \
1134 M(ReThrow) \ 1135 M(ReThrow) \
1135 M(Branch) \ 1136 M(Branch) \
1136 1137
1137 1138
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) 1208 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
1208 #undef INSTRUCTION_TYPE_CHECK 1209 #undef INSTRUCTION_TYPE_CHECK
1209 1210
1210 private: 1211 private:
1211 intptr_t cid_; 1212 intptr_t cid_;
1212 ICData* ic_data_; 1213 ICData* ic_data_;
1213 DISALLOW_COPY_AND_ASSIGN(Instruction); 1214 DISALLOW_COPY_AND_ASSIGN(Instruction);
1214 }; 1215 };
1215 1216
1216 1217
1217 // Basic block entries are administrative nodes. Joins are the only nodes 1218 // Basic block entries are administrative nodes. There is a distinguished
1218 // with multiple predecessors. Targets are the other basic block entries. 1219 // graph entry with no predecessor. Joins are the only nodes with multiple
1219 // The types enforce edge-split form---joins are forbidden as the successors 1220 // predecessors. Targets are all other basic block entries. The types
1220 // of branches. 1221 // enforce edge-split form---joins are forbidden as the successors of
1222 // branches.
1221 class BlockEntryInstr : public Instruction { 1223 class BlockEntryInstr : public Instruction {
1222 public: 1224 public:
1223 virtual bool IsBlockEntry() const { return true; } 1225 virtual bool IsBlockEntry() const { return true; }
1224 1226
1225 virtual intptr_t PredecessorCount() const = 0; 1227 virtual intptr_t PredecessorCount() const = 0;
1226 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0; 1228 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0;
1227 1229
1228 intptr_t preorder_number() const { return preorder_number_; } 1230 intptr_t preorder_number() const { return preorder_number_; }
1229 void set_preorder_number(intptr_t number) { preorder_number_ = number; } 1231 void set_preorder_number(intptr_t number) { preorder_number_ = number; }
1230 1232
(...skipping 16 matching lines...) Expand all
1247 private: 1249 private:
1248 intptr_t preorder_number_; 1250 intptr_t preorder_number_;
1249 intptr_t postorder_number_; 1251 intptr_t postorder_number_;
1250 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. 1252 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry.
1251 Instruction* last_instruction_; 1253 Instruction* last_instruction_;
1252 1254
1253 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); 1255 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr);
1254 }; 1256 };
1255 1257
1256 1258
1259 class GraphEntryInstr : public BlockEntryInstr {
1260 public:
1261 explicit GraphEntryInstr(TargetEntryInstr* normal_entry)
1262 : BlockEntryInstr(), normal_entry_(normal_entry), catch_entries_() { }
1263
1264 DECLARE_INSTRUCTION(GraphEntry)
1265
1266 virtual intptr_t PredecessorCount() const { return 0; }
1267 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1268 UNREACHABLE();
1269 return NULL;
1270 }
1271
1272 virtual Instruction* StraightLineSuccessor() const { return NULL; }
1273 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
1274
1275 virtual void DiscoverBlocks(
1276 BlockEntryInstr* current_block,
1277 GrowableArray<BlockEntryInstr*>* preorder,
1278 GrowableArray<BlockEntryInstr*>* postorder,
1279 GrowableArray<intptr_t>* parent);
1280
1281 void AddCatchEntry(TargetEntryInstr* entry) { catch_entries_.Add(entry); }
1282
1283 private:
1284 TargetEntryInstr* normal_entry_;
1285 ZoneGrowableArray<TargetEntryInstr*> catch_entries_;
srdjan 2012/05/16 15:20:27 GrowableArray, since it is a value object.
1286
1287 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);
1288 };
1289
1290
1257 class JoinEntryInstr : public BlockEntryInstr { 1291 class JoinEntryInstr : public BlockEntryInstr {
1258 public: 1292 public:
1259 JoinEntryInstr() 1293 JoinEntryInstr()
1260 : BlockEntryInstr(), 1294 : BlockEntryInstr(),
1261 predecessors_(2), // Two is the assumed to be the common case. 1295 predecessors_(2), // Two is the assumed to be the common case.
1262 successor_(NULL) { } 1296 successor_(NULL) { }
1263 1297
1264 DECLARE_INSTRUCTION(JoinEntry) 1298 DECLARE_INSTRUCTION(JoinEntry)
1265 1299
1266 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } 1300 virtual intptr_t PredecessorCount() const { return predecessors_.length(); }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 const GrowableArray<BlockEntryInstr*>& block_order_; 1620 const GrowableArray<BlockEntryInstr*>& block_order_;
1587 1621
1588 private: 1622 private:
1589 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1623 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1590 }; 1624 };
1591 1625
1592 1626
1593 } // namespace dart 1627 } // namespace dart
1594 1628
1595 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1629 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698