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

Unified Diff: runtime/vm/flow_graph_compiler.h

Issue 12412013: Add pass to remove empty blocks and recompute fall-through targets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.h
diff --git a/runtime/vm/flow_graph_compiler.h b/runtime/vm/flow_graph_compiler.h
index 4fd423952f445d633d1c763771d089ae5061f7e0..82035b9b47ecfa3364a51e88ed7ee001ab733340 100644
--- a/runtime/vm/flow_graph_compiler.h
+++ b/runtime/vm/flow_graph_compiler.h
@@ -161,10 +161,36 @@ struct CidTarget {
class FlowGraphCompiler : public ValueObject {
private:
- struct BlockInfo : public ZoneAllocated {
+ class BlockInfo : public ZoneAllocated {
public:
- BlockInfo() : label() { }
- Label label;
+ BlockInfo()
+ : jump_label_(&block_label_),
+ block_label_(),
+ fallthrough_label_(NULL),
+ is_marked_(false) {}
+
+ Label* jump_label() const { return jump_label_; }
+ void set_jump_label(Label* label) { jump_label_ = label; }
+
+ Label* fallthrough_label() const { return fallthrough_label_; }
srdjan 2013/03/08 19:02:31 ASSERT that is not NULL?
Vyacheslav Egorov (Google) 2013/03/08 19:04:23 It can be NULL for the last block which has no fal
srdjan 2013/03/08 19:08:08 Right. Maybe add a comment that it is NULL for blo
Vyacheslav Egorov (Google) 2013/03/08 19:10:11 Done.
+ void set_fallthrough_label(Label* fallthrough_label) {
+ fallthrough_label_ = fallthrough_label;
+ }
+
+ bool WasCompacted() const {
+ return jump_label_ != &block_label_;
+ }
+
+ bool is_marked() const { return is_marked_; }
+ void mark() { is_marked_ = true; }
+
+ private:
+ Label* jump_label_;
+ Label block_label_;
+
+ Label* fallthrough_label_;
+
+ bool is_marked_;
};
public:
@@ -321,11 +347,12 @@ class FlowGraphCompiler : public ValueObject {
intptr_t StackSize() const;
// Returns assembler label associated with the given block entry.
- Label* GetBlockLabel(BlockEntryInstr* block_entry) const;
+ Label* GetJumpLabel(BlockEntryInstr* block_entry) const;
+ bool WasCompacted(BlockEntryInstr* block_entry) const;
// Returns true if there is a next block after the current one in
// the block order and if it is the given block.
- bool IsNextBlock(BlockEntryInstr* block_entry) const;
+ bool CanFallThroughTo(BlockEntryInstr* block_entry) const;
void AddExceptionHandler(intptr_t try_index,
intptr_t outer_try_index,
@@ -488,6 +515,10 @@ class FlowGraphCompiler : public ValueObject {
static void SortICDataByCount(const ICData& ic_data,
GrowableArray<CidTarget>* sorted);
+ void CompactBlock(BlockEntryInstr* block);
+ void CompactBlocks();
+
srdjan 2013/03/08 19:02:31 Remove one line
Vyacheslav Egorov (Google) 2013/03/08 19:04:23 Done.
+
class Assembler* assembler_;
const ParsedFunction& parsed_function_;
const GrowableArray<BlockEntryInstr*>& block_order_;
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698