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

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

Issue 15529003: A few simple cleanups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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/flow_graph_compiler.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 // graph entry with no predecessor. Joins are the only nodes with multiple 1063 // graph entry with no predecessor. Joins are the only nodes with multiple
1064 // predecessors. Targets are all other basic block entries. The types 1064 // predecessors. Targets are all other basic block entries. The types
1065 // enforce edge-split form---joins are forbidden as the successors of 1065 // enforce edge-split form---joins are forbidden as the successors of
1066 // branches. 1066 // branches.
1067 class BlockEntryInstr : public Instruction { 1067 class BlockEntryInstr : public Instruction {
1068 public: 1068 public:
1069 virtual BlockEntryInstr* AsBlockEntry() { return this; } 1069 virtual BlockEntryInstr* AsBlockEntry() { return this; }
1070 1070
1071 virtual intptr_t PredecessorCount() const = 0; 1071 virtual intptr_t PredecessorCount() const = 0;
1072 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0; 1072 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0;
1073 virtual void PrepareEntry(FlowGraphCompiler* compiler) = 0;
1074 1073
1075 intptr_t preorder_number() const { return preorder_number_; } 1074 intptr_t preorder_number() const { return preorder_number_; }
1076 void set_preorder_number(intptr_t number) { preorder_number_ = number; } 1075 void set_preorder_number(intptr_t number) { preorder_number_ = number; }
1077 1076
1078 intptr_t postorder_number() const { return postorder_number_; } 1077 intptr_t postorder_number() const { return postorder_number_; }
1079 void set_postorder_number(intptr_t number) { postorder_number_ = number; } 1078 void set_postorder_number(intptr_t number) { postorder_number_ = number; }
1080 1079
1081 intptr_t block_id() const { return block_id_; } 1080 intptr_t block_id() const { return block_id_; }
1082 1081
1083 void set_start_pos(intptr_t pos) { start_pos_ = pos; } 1082 void set_start_pos(intptr_t pos) { start_pos_ = pos; }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 UNREACHABLE(); 1284 UNREACHABLE();
1286 return NULL; 1285 return NULL;
1287 } 1286 }
1288 virtual intptr_t SuccessorCount() const; 1287 virtual intptr_t SuccessorCount() const;
1289 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; 1288 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
1290 1289
1291 void AddCatchEntry(CatchBlockEntryInstr* entry) { catch_entries_.Add(entry); } 1290 void AddCatchEntry(CatchBlockEntryInstr* entry) { catch_entries_.Add(entry); }
1292 1291
1293 CatchBlockEntryInstr* GetCatchEntry(intptr_t index); 1292 CatchBlockEntryInstr* GetCatchEntry(intptr_t index);
1294 1293
1295 virtual void PrepareEntry(FlowGraphCompiler* compiler);
1296
1297 GrowableArray<Definition*>* initial_definitions() { 1294 GrowableArray<Definition*>* initial_definitions() {
1298 return &initial_definitions_; 1295 return &initial_definitions_;
1299 } 1296 }
1300 ConstantInstr* constant_null(); 1297 ConstantInstr* constant_null();
1301 1298
1302 intptr_t spill_slot_count() const { return spill_slot_count_; } 1299 intptr_t spill_slot_count() const { return spill_slot_count_; }
1303 void set_spill_slot_count(intptr_t count) { 1300 void set_spill_slot_count(intptr_t count) {
1304 ASSERT(count >= 0); 1301 ASSERT(count >= 0);
1305 spill_slot_count_ = count; 1302 spill_slot_count_ = count;
1306 } 1303 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } 1349 virtual intptr_t PredecessorCount() const { return predecessors_.length(); }
1353 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1350 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1354 return predecessors_[index]; 1351 return predecessors_[index];
1355 } 1352 }
1356 1353
1357 // Returns -1 if pred is not in the list. 1354 // Returns -1 if pred is not in the list.
1358 intptr_t IndexOfPredecessor(BlockEntryInstr* pred) const; 1355 intptr_t IndexOfPredecessor(BlockEntryInstr* pred) const;
1359 1356
1360 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } 1357 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; }
1361 1358
1362 virtual void PrepareEntry(FlowGraphCompiler* compiler);
1363
1364 void InsertPhi(intptr_t var_index, intptr_t var_count); 1359 void InsertPhi(intptr_t var_index, intptr_t var_count);
1365 void RemoveDeadPhis(Definition* replacement); 1360 void RemoveDeadPhis(Definition* replacement);
1366 1361
1367 void InsertPhi(PhiInstr* phi); 1362 void InsertPhi(PhiInstr* phi);
1368 1363
1369 virtual void PrintTo(BufferFormatter* f) const; 1364 virtual void PrintTo(BufferFormatter* f) const;
1370 1365
1371 virtual EffectSet Effects() const { return EffectSet::None(); } 1366 virtual EffectSet Effects() const { return EffectSet::None(); }
1372 virtual EffectSet Dependencies() const { return EffectSet::None(); } 1367 virtual EffectSet Dependencies() const { return EffectSet::None(); }
1373 1368
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 DECLARE_INSTRUCTION(TargetEntry) 1417 DECLARE_INSTRUCTION(TargetEntry)
1423 1418
1424 virtual intptr_t PredecessorCount() const { 1419 virtual intptr_t PredecessorCount() const {
1425 return (predecessor_ == NULL) ? 0 : 1; 1420 return (predecessor_ == NULL) ? 0 : 1;
1426 } 1421 }
1427 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1422 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1428 ASSERT((index == 0) && (predecessor_ != NULL)); 1423 ASSERT((index == 0) && (predecessor_ != NULL));
1429 return predecessor_; 1424 return predecessor_;
1430 } 1425 }
1431 1426
1432 virtual void PrepareEntry(FlowGraphCompiler* compiler);
1433
1434 virtual void PrintTo(BufferFormatter* f) const; 1427 virtual void PrintTo(BufferFormatter* f) const;
1435 1428
1436 private: 1429 private:
1437 friend class BlockEntryInstr; // Access to predecessor_ when inlining. 1430 friend class BlockEntryInstr; // Access to predecessor_ when inlining.
1438 1431
1439 virtual void ClearPredecessors() { predecessor_ = NULL; } 1432 virtual void ClearPredecessors() { predecessor_ = NULL; }
1440 virtual void AddPredecessor(BlockEntryInstr* predecessor) { 1433 virtual void AddPredecessor(BlockEntryInstr* predecessor) {
1441 ASSERT(predecessor_ == NULL); 1434 ASSERT(predecessor_ == NULL);
1442 predecessor_ = predecessor; 1435 predecessor_ = predecessor;
1443 } 1436 }
(...skipping 27 matching lines...) Expand all
1471 1464
1472 // Returns try index for the try block to which this catch handler 1465 // Returns try index for the try block to which this catch handler
1473 // corresponds. 1466 // corresponds.
1474 intptr_t catch_try_index() const { 1467 intptr_t catch_try_index() const {
1475 return catch_try_index_; 1468 return catch_try_index_;
1476 } 1469 }
1477 GrowableArray<Definition*>* initial_definitions() { 1470 GrowableArray<Definition*>* initial_definitions() {
1478 return &initial_definitions_; 1471 return &initial_definitions_;
1479 } 1472 }
1480 1473
1481 virtual void PrepareEntry(FlowGraphCompiler* compiler);
1482
1483 virtual void PrintTo(BufferFormatter* f) const; 1474 virtual void PrintTo(BufferFormatter* f) const;
1484 1475
1485 private: 1476 private:
1486 friend class BlockEntryInstr; // Access to predecessor_ when inlining. 1477 friend class BlockEntryInstr; // Access to predecessor_ when inlining.
1487 1478
1488 virtual void ClearPredecessors() { predecessor_ = NULL; } 1479 virtual void ClearPredecessors() { predecessor_ = NULL; }
1489 virtual void AddPredecessor(BlockEntryInstr* predecessor) { 1480 virtual void AddPredecessor(BlockEntryInstr* predecessor) {
1490 ASSERT(predecessor_ == NULL); 1481 ASSERT(predecessor_ == NULL);
1491 predecessor_ = predecessor; 1482 predecessor_ = predecessor;
1492 } 1483 }
(...skipping 4921 matching lines...) Expand 10 before | Expand all | Expand 10 after
6414 ForwardInstructionIterator* current_iterator_; 6405 ForwardInstructionIterator* current_iterator_;
6415 6406
6416 private: 6407 private:
6417 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6408 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6418 }; 6409 };
6419 6410
6420 6411
6421 } // namespace dart 6412 } // namespace dart
6422 6413
6423 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6414 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698