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

Side by Side Diff: src/hydrogen.cc

Issue 16741002: Skip some conditional deopts for Div/Mul when all uses are truncating (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added regression test Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 instr != NULL; 2087 instr != NULL;
2088 instr = instr->next()) { 2088 instr = instr->next()) {
2089 instr->FinalizeUniqueValueId(); 2089 instr->FinalizeUniqueValueId();
2090 } 2090 }
2091 } 2091 }
2092 } 2092 }
2093 2093
2094 2094
2095 void HGraph::Canonicalize() { 2095 void HGraph::Canonicalize() {
2096 HPhase phase("H_Canonicalize", this); 2096 HPhase phase("H_Canonicalize", this);
2097 // Before removing no-op instructions, save their semantic value.
2098 // We must be careful not to set the flag unnecessarily, because GVN
2099 // cannot identify two instructions when their flag value differs.
2097 for (int i = 0; i < blocks()->length(); ++i) { 2100 for (int i = 0; i < blocks()->length(); ++i) {
2098 HInstruction* instr = blocks()->at(i)->first(); 2101 HInstruction* instr = blocks()->at(i)->first();
2099 while (instr != NULL) { 2102 while (instr != NULL) {
2103 if (instr->IsArithmeticBinaryOperation() &&
2104 instr->representation().IsInteger32() &&
2105 instr->HasAtLeastOneUseWithFlagAndNoneWithout(
2106 HInstruction::kTruncatingToInt32)) {
2107 instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32);
2108 }
2109 instr = instr->next();
2110 }
2111 }
2112 // Perform actual Canonicalization pass.
2113 for (int i = 0; i < blocks()->length(); ++i) {
2114 HInstruction* instr = blocks()->at(i)->first();
2115 while (instr != NULL) {
2100 HValue* value = instr->Canonicalize(); 2116 HValue* value = instr->Canonicalize();
2101 if (value != instr) instr->DeleteAndReplaceWith(value); 2117 if (value != instr) instr->DeleteAndReplaceWith(value);
2102 instr = instr->next(); 2118 instr = instr->next();
2103 } 2119 }
2104 } 2120 }
2105 } 2121 }
2106 2122
2107 // Block ordering was implemented with two mutually recursive methods, 2123 // Block ordering was implemented with two mutually recursive methods,
2108 // HGraph::Postorder and HGraph::PostorderLoopBlocks. 2124 // HGraph::Postorder and HGraph::PostorderLoopBlocks.
2109 // The recursion could lead to stack overflow so the algorithm has been 2125 // The recursion could lead to stack overflow so the algorithm has been
(...skipping 9490 matching lines...) Expand 10 before | Expand all | Expand 10 after
11600 } 11616 }
11601 } 11617 }
11602 11618
11603 #ifdef DEBUG 11619 #ifdef DEBUG
11604 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11620 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11605 if (allocator_ != NULL) allocator_->Verify(); 11621 if (allocator_ != NULL) allocator_->Verify();
11606 #endif 11622 #endif
11607 } 11623 }
11608 11624
11609 } } // namespace v8::internal 11625 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698