Revision: 23509
Author:   [email protected]
Date:     Fri Aug 29 06:42:41 2014 UTC
Log:      [turbofan] Use enum instead of bool for parameter.

TEST=compiler-unittests
[email protected]

Review URL: https://codereview.chromium.org/517123004
https://code.google.com/p/v8/source/detail?r=23509

Modified:
 /branches/bleeding_edge/src/compiler/change-lowering.cc
 /branches/bleeding_edge/src/compiler/change-lowering.h

=======================================
--- /branches/bleeding_edge/src/compiler/change-lowering.cc Thu Aug 28 13:17:38 2014 UTC +++ /branches/bleeding_edge/src/compiler/change-lowering.cc Fri Aug 29 06:42:41 2014 UTC
@@ -28,9 +28,9 @@
     case IrOpcode::kChangeTaggedToFloat64:
       return ChangeTaggedToFloat64(node->InputAt(0), control);
     case IrOpcode::kChangeTaggedToInt32:
-      return ChangeTaggedToI32(node->InputAt(0), control, true);
+      return ChangeTaggedToUI32(node->InputAt(0), control, kSigned);
     case IrOpcode::kChangeTaggedToUint32:
-      return ChangeTaggedToI32(node->InputAt(0), control, false);
+      return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned);
     case IrOpcode::kChangeUint32ToTagged:
       return ChangeUint32ToTagged(node->InputAt(0), control);
     default:
@@ -168,8 +168,8 @@
 }


-Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control,
-                                            bool is_signed) {
+Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control,
+                                             Signedness signedness) {
   STATIC_ASSERT(kSmiTag == 0);
   STATIC_ASSERT(kSmiTagMask == 1);

@@ -178,8 +178,8 @@
   Node* branch = graph()->NewNode(common()->Branch(), tag, control);

   Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
-  Operator* op = is_signed ? machine()->ChangeFloat64ToInt32()
-                           : machine()->ChangeFloat64ToUint32();
+ Operator* op = (signedness == kSigned) ? machine()->ChangeFloat64ToInt32() + : machine()->ChangeFloat64ToUint32();
   Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true));

   Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
=======================================
--- /branches/bleeding_edge/src/compiler/change-lowering.h Wed Aug 27 13:49:30 2014 UTC +++ /branches/bleeding_edge/src/compiler/change-lowering.h Fri Aug 29 06:42:41 2014 UTC
@@ -27,6 +27,8 @@
   virtual Reduction Reduce(Node* node) V8_OVERRIDE;

  private:
+  enum Signedness { kSigned, kUnsigned };
+
   Node* HeapNumberValueIndexConstant();
   Node* SmiMaxValueConstant();
   Node* SmiShiftBitsConstant();
@@ -40,7 +42,7 @@
   Reduction ChangeFloat64ToTagged(Node* val, Node* control);
   Reduction ChangeInt32ToTagged(Node* val, Node* control);
   Reduction ChangeTaggedToFloat64(Node* val, Node* control);
-  Reduction ChangeTaggedToI32(Node* val, Node* control, bool is_signed);
+ Reduction ChangeTaggedToUI32(Node* val, Node* control, Signedness signedness);
   Reduction ChangeUint32ToTagged(Node* val, Node* control);

   Graph* graph() const;

--
--
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