Reviewers: Sven Panne,

Message:
Cosmetic fix, PTAL

Description:
[turbofan] Use enum instead of bool for parameter.

TEST=compiler-unittests

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+9, -7 lines):
  M src/compiler/change-lowering.h
  M src/compiler/change-lowering.cc


Index: src/compiler/change-lowering.cc
diff --git a/src/compiler/change-lowering.cc b/src/compiler/change-lowering.cc index edf9bc511102b3318fea0f86cf1342741fddfe2e..c2805bb0a329b463536b0deef8edadc6fa567d47 100644
--- a/src/compiler/change-lowering.cc
+++ b/src/compiler/change-lowering.cc
@@ -28,9 +28,9 @@ Reduction ChangeLowering::Reduce(Node* node) {
     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::ChangeInt32ToTagged(Node* val, Node* control) {
 }


-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 @@ Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control,
   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);
Index: src/compiler/change-lowering.h
diff --git a/src/compiler/change-lowering.h b/src/compiler/change-lowering.h
index ade37beccf0fc3621ba12676b177fb299bcf454d..b002369f0bc20b8e1f39f0717e0c8e267e282b74 100644
--- a/src/compiler/change-lowering.h
+++ b/src/compiler/change-lowering.h
@@ -27,6 +27,8 @@ class ChangeLowering V8_FINAL : public Reducer {
   virtual Reduction Reduce(Node* node) V8_OVERRIDE;

  private:
+  enum Signedness { kSigned, kUnsigned };
+
   Node* HeapNumberValueIndexConstant();
   Node* SmiMaxValueConstant();
   Node* SmiShiftBitsConstant();
@@ -40,7 +42,7 @@ class ChangeLowering V8_FINAL : public Reducer {
   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