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

Unified Diff: src/hydrogen-instructions.cc

Issue 14320021: Ignore observed Double output in binary operations when all uses are truncating to Integer32 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment; blacklisted Mul too Created 7 years, 8 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-instructions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 6496fa8eeb9d96bd3e9e0e0a7827ce41619377fa..23b303b6a31e1e41a83cfe6e62cf3270242ae006 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -2228,13 +2228,24 @@ void HBinaryOperation::InferRepresentation(HInferRepresentation* h_infer) {
}
+bool HBinaryOperation::IgnoreObservedOutputRepresentation(
+ Representation current_rep) {
+ return observed_output_representation_.IsDouble() &&
+ current_rep.IsInteger32() &&
+ // Mul in Integer32 mode would be too precise.
+ !this->IsMul() &&
+ // TODO(jkummerow): Remove blacklisting of Div when the Div
+ // instruction has learned not to deopt when the remainder is
+ // non-zero but all uses are truncating.
+ !this->IsDiv() &&
+ CheckUsesForFlag(kTruncatingToInt32);
+}
+
+
Representation HBinaryOperation::RepresentationFromInputs() {
// Determine the worst case of observed input representations and
// the currently assumed output representation.
Representation rep = representation();
- if (observed_output_representation_.is_more_general_than(rep)) {
- rep = observed_output_representation_;
- }
for (int i = 1; i <= 2; ++i) {
Representation input_rep = observed_input_representation(i);
if (input_rep.is_more_general_than(rep)) rep = input_rep;
@@ -2252,6 +2263,13 @@ Representation HBinaryOperation::RepresentationFromInputs() {
right()->CheckFlag(kFlexibleRepresentation)) {
rep = right_rep;
}
+ // Consider observed output representation, but ignore it if it's Double,
+ // this instruction is not a division, and all its uses are truncating
+ // to Integer32.
+ if (observed_output_representation_.is_more_general_than(rep) &&
+ !IgnoreObservedOutputRepresentation(rep)) {
+ rep = observed_output_representation_;
+ }
return rep;
}
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698