Reviewers: jarin,

Description:
[turbofan] Lower more number operations to integer operations.

If the typer was able to prove that a NumberAdd/Sub/Mul/Div/Mod always
produces a Signed32/Unsigned32 value, and the inputs are
Signed32/Unsigned32, we can lower the node to the corresponding integer
operation instead, no matter what the uses are.

[email protected]

Please review this at https://codereview.chromium.org/1140933002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+6, -2 lines):
  M src/compiler/simplified-lowering.cc


Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 39246df24609db6d039b5a78459cf5a97662b701..050d6ce0873211d55f179b50b1f4c1e88ef39b67 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -444,7 +444,9 @@ class RepresentationSelector {
   }

   bool CanLowerToInt32Binop(Node* node, MachineTypeUnion use) {
- return BothInputsAre(node, Type::Signed32()) && !CanObserveNonInt32(use);
+    return BothInputsAre(node, Type::Signed32()) &&
+           (!CanObserveNonInt32(use) ||
+            NodeProperties::GetBounds(node).upper->Is(Type::Signed32()));
   }

   bool CanLowerToInt32AdditiveBinop(Node* node, MachineTypeUnion use) {
@@ -453,7 +455,9 @@ class RepresentationSelector {
   }

   bool CanLowerToUint32Binop(Node* node, MachineTypeUnion use) {
- return BothInputsAre(node, Type::Unsigned32()) && !CanObserveNonUint32(use);
+    return BothInputsAre(node, Type::Unsigned32()) &&
+           (!CanObserveNonUint32(use) ||
+            NodeProperties::GetBounds(node).upper->Is(Type::Unsigned32()));
   }

   bool CanLowerToUint32AdditiveBinop(Node* node, MachineTypeUnion use) {


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to