From 38b91a4ffeaa9871ed4b947b1ddf460f8eb0772c Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Wed, 26 Jan 2011 15:28:17 +0000 Subject: [PATCH] Fix issue 1076 by resetting labels of switch-clauses before use. If we compile a function literal twice with the full code generator, we must make sure that the labels embedded in the AST are reset. BUG=1076 Review URL: http://codereview.chromium.org/6339014 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6496 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/full-codegen-arm.cc | 2 ++ src/ia32/full-codegen-ia32.cc | 2 ++ src/x64/full-codegen-x64.cc | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index f04b823141..47b0b28c3b 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -734,6 +734,8 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Compile all the tests with branches to their bodies. for (int i = 0; i < clauses->length(); i++) { CaseClause* clause = clauses->at(i); + clause->body_target()->entry_label()->Unuse(); + // The default is not a test, but remember it as final fall through. if (clause->is_default()) { default_clause = clause; diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index aa0dafb838..8bcb49f2e1 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -764,6 +764,8 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Compile all the tests with branches to their bodies. for (int i = 0; i < clauses->length(); i++) { CaseClause* clause = clauses->at(i); + clause->body_target()->entry_label()->Unuse(); + // The default is not a test, but remember it as final fall through. if (clause->is_default()) { default_clause = clause; diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index 60efe03db7..8b7f3c2b2c 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -710,6 +710,8 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Compile all the tests with branches to their bodies. for (int i = 0; i < clauses->length(); i++) { CaseClause* clause = clauses->at(i); + clause->body_target()->entry_label()->Unuse(); + // The default is not a test, but remember it as final fall through. if (clause->is_default()) { default_clause = clause;