Revision: 9207
Author: [email protected]
Date: Fri Sep 9 02:17:57 2011
Log: Add a function to compute loop nesting level to HBasicBlock.
Review URL: http://codereview.chromium.org/7857031
http://code.google.com/p/v8/source/detail?r=9207
Modified:
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Thu Sep 8 01:59:14 2011
+++ /branches/bleeding_edge/src/hydrogen.cc Fri Sep 9 02:17:57 2011
@@ -218,6 +218,17 @@
}
return false;
}
+
+
+int HBasicBlock::LoopNestingDepth() const {
+ const HBasicBlock* current = this;
+ int result = (current->IsLoopHeader()) ? 1 : 0;
+ while (current->parent_loop_header() != NULL) {
+ current = current->parent_loop_header();
+ result++;
+ }
+ return result;
+}
void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
@@ -6566,6 +6577,8 @@
if (current->dominator() != NULL) {
PrintBlockProperty("dominator", current->dominator()->block_id());
}
+
+ PrintIntProperty("loop_depth", current->LoopNestingDepth());
if (chunk != NULL) {
int first_index = current->first_instruction_index();
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Wed Sep 7 04:02:31 2011
+++ /branches/bleeding_edge/src/hydrogen.h Fri Sep 9 02:17:57 2011
@@ -102,6 +102,7 @@
void RemovePhi(HPhi* phi);
void AddInstruction(HInstruction* instr);
bool Dominates(HBasicBlock* other) const;
+ int LoopNestingDepth() const;
void SetInitialEnvironment(HEnvironment* env);
void ClearEnvironment() { last_environment_ = NULL; }
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev