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

Unified Diff: src/hydrogen-canonicalize.cc

Issue 148153010: Synchronize with r15701. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/hydrogen-canonicalize.h ('k') | src/hydrogen-dehoist.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-canonicalize.cc
diff --git a/src/hydrogen-escape-analysis.cc b/src/hydrogen-canonicalize.cc
similarity index 62%
copy from src/hydrogen-escape-analysis.cc
copy to src/hydrogen-canonicalize.cc
index e852fb8d6d75d7756df6e4e03399bfb8789d4c76..40cbe4c0655d4cd315d761fbf0d63b3aa0530a95 100644
--- a/src/hydrogen-escape-analysis.cc
+++ b/src/hydrogen-canonicalize.cc
@@ -25,42 +25,35 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "hydrogen-escape-analysis.h"
+#include "hydrogen-canonicalize.h"
namespace v8 {
namespace internal {
-
-void HEscapeAnalysisPhase::CollectIfNoEscapingUses(HInstruction* instr) {
- for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
- HValue* use = it.value();
- if (use->HasEscapingOperandAt(it.index())) {
- if (FLAG_trace_escape_analysis) {
- PrintF("#%d (%s) escapes through #%d (%s) @%d\n", instr->id(),
- instr->Mnemonic(), use->id(), use->Mnemonic(), it.index());
+void HCanonicalizePhase::Run() {
+ const ZoneList<HBasicBlock*>* blocks(graph()->blocks());
+ // Before removing no-op instructions, save their semantic value.
+ // We must be careful not to set the flag unnecessarily, because GVN
+ // cannot identify two instructions when their flag value differs.
+ for (int i = 0; i < blocks->length(); ++i) {
+ for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) {
+ HInstruction* instr = it.Current();
+ if (instr->IsArithmeticBinaryOperation() &&
+ instr->representation().IsInteger32() &&
+ instr->HasAtLeastOneUseWithFlagAndNoneWithout(
+ HInstruction::kTruncatingToInt32)) {
+ instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32);
}
- return;
}
}
- if (FLAG_trace_escape_analysis) {
- PrintF("#%d (%s) is being captured\n", instr->id(), instr->Mnemonic());
- }
- captured_.Add(instr, zone());
-}
-
-
-void HEscapeAnalysisPhase::CollectCapturedValues() {
- int block_count = graph()->blocks()->length();
- for (int i = 0; i < block_count; ++i) {
- HBasicBlock* block = graph()->blocks()->at(i);
- for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
+ // Perform actual Canonicalization pass.
+ for (int i = 0; i < blocks->length(); ++i) {
+ for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current();
- if (instr->IsAllocate() || instr->IsAllocateObject()) {
- CollectIfNoEscapingUses(instr);
- }
+ HValue* value = instr->Canonicalize();
+ if (value != instr) instr->DeleteAndReplaceWith(value);
}
}
}
-
} } // namespace v8::internal
« no previous file with comments | « src/hydrogen-canonicalize.h ('k') | src/hydrogen-dehoist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698