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

Unified Diff: src/hydrogen-instructions.cc

Issue 258793002: ARM64: Generate optimized code for Math.floor and Math.round with double outputs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 c56f5dc36f8cce87074c070cf4486746d1ad6272..5da613f591e1956bf1167a4a7add99a3d59a0fe4 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -3721,6 +3721,12 @@ HType HChange::CalculateInferredType() {
Representation HUnaryMathOperation::RepresentationFromInputs() {
+ if (SupportsFlexibleFloorAndRound() &&
+ (op_ == kMathFloor || op_ == kMathRound)) {
+ // Floor and Round always take a double input. The integral result can be
+ // used as an integer or a double. Infer the representation from the uses.
+ return Representation::None();
+ }
Representation rep = representation();
// If any of the actual input representation is more general than what we
// have so far but not Tagged, use that representation instead.
@@ -4189,6 +4195,41 @@ HInstruction* HUnaryMathOperation::New(
}
+Representation HUnaryMathOperation::RepresentationFromUses() {
+ if (op_ != kMathFloor && op_ != kMathRound) {
+ return HValue::RepresentationFromUses();
+ }
+
+ // The instruction can have an int32 or double output. Prefer a double
+ // representation if there are double uses.
+ bool has_double_use = false;
+
+ for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
+ HValue* use = it.value();
+ Representation rep = use->RequiredInputRepresentation(it.index());
+ bool rep_required = !rep.IsNone();
+ if (!rep_required) {
Jakob Kummerow 2014/04/25 14:12:03 I'm not sure I like the way you're prioritizing re
Alexandre Rames 2014/04/25 16:05:26 Removed consideration of the required representati
Jakob Kummerow 2014/04/28 13:53:32 Any reason you're not looking at both required and
+ rep = use->observed_input_representation(it.index());
+ }
+ if (FLAG_trace_representation && !rep.IsNone()) {
+ PrintF("#%d %s is %s by #%d %s as %s%s\n",
+ id(), Mnemonic(),
+ rep_required ? "required" : "used",
+ use->id(), use->Mnemonic(), rep.Mnemonic(),
+ (use->CheckFlag(kTruncatingToInt32) ? "-trunc" : ""));
+ }
+ if (rep.IsDouble()) {
+ has_double_use = true;
+ if (!FLAG_trace_representation) {
+ break;
Jakob Kummerow 2014/04/25 14:12:03 nit: indentation. Also, a comment would be nice (e
Alexandre Rames 2014/04/25 16:05:26 Done.
+ }
+ }
+ }
+ return has_double_use ? Representation::Double()
+ : Representation::Integer32();
+}
+
+
HInstruction* HPower::New(Zone* zone,
HValue* context,
HValue* left,
« 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