Index: src/lithium-codegen.cc |
diff --git a/src/lithium-codegen.cc b/src/lithium-codegen.cc |
index be0ff8371afa51ec664d61a3056d2da13ae7ff79..93ae3101a7779e50b21fe4e542334974bc75758e 100644 |
--- a/src/lithium-codegen.cc |
+++ b/src/lithium-codegen.cc |
@@ -122,6 +122,26 @@ bool LCodeGenBase::GenerateBody() { |
} |
+void LCodeGenBase::CheckEnvironmentUsage() { |
+#ifdef DEBUG |
+ bool live_block = true; |
+ for (int i = 0; i < instructions_->length(); i++) { |
+ LInstruction* instr = instructions_->at(i); |
+ if (instr->IsLabel()) live_block = !LLabel::cast(instr)->HasReplacement(); |
+ if (live_block && |
+ instr->hydrogen_value()->block()->IsReachable() && |
+ instr->HasEnvironment() && |
+ !instr->environment()->has_been_used()) { |
+ FunctionLiteral* lit = info_->function(); |
+ V8_Fatal(__FILE__, __LINE__, "unused environment in %s <@%d,#%d> %s\n", |
+ lit == NULL ? "<UNKNOWN>" : lit->name()->ToCString().get(), |
+ i, instr->hydrogen_value()->id(), instr->Mnemonic()); |
+ } |
+ } |
+#endif |
+} |
+ |
+ |
void LCodeGenBase::Comment(const char* format, ...) { |
if (!FLAG_code_comments) return; |
char buffer[4 * KB]; |