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

Unified Diff: src/lithium-codegen.cc

Issue 218403006: Check that environments assigned via AssignEnvironment are actually used. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simplified. Rebased. Created 6 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 | « src/lithium-codegen.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
« no previous file with comments | « src/lithium-codegen.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698