Commit 8c26a93f authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

[turbofan] Use enum instead of bool for parameter.

TEST=compiler-unittests
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/517123004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23509 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 804ef93d
...@@ -28,9 +28,9 @@ Reduction ChangeLowering::Reduce(Node* node) { ...@@ -28,9 +28,9 @@ Reduction ChangeLowering::Reduce(Node* node) {
case IrOpcode::kChangeTaggedToFloat64: case IrOpcode::kChangeTaggedToFloat64:
return ChangeTaggedToFloat64(node->InputAt(0), control); return ChangeTaggedToFloat64(node->InputAt(0), control);
case IrOpcode::kChangeTaggedToInt32: case IrOpcode::kChangeTaggedToInt32:
return ChangeTaggedToI32(node->InputAt(0), control, true); return ChangeTaggedToUI32(node->InputAt(0), control, kSigned);
case IrOpcode::kChangeTaggedToUint32: case IrOpcode::kChangeTaggedToUint32:
return ChangeTaggedToI32(node->InputAt(0), control, false); return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned);
case IrOpcode::kChangeUint32ToTagged: case IrOpcode::kChangeUint32ToTagged:
return ChangeUint32ToTagged(node->InputAt(0), control); return ChangeUint32ToTagged(node->InputAt(0), control);
default: default:
...@@ -168,8 +168,8 @@ Reduction ChangeLowering::ChangeInt32ToTagged(Node* val, Node* control) { ...@@ -168,8 +168,8 @@ Reduction ChangeLowering::ChangeInt32ToTagged(Node* val, Node* control) {
} }
Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control, Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control,
bool is_signed) { Signedness signedness) {
STATIC_ASSERT(kSmiTag == 0); STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagMask == 1); STATIC_ASSERT(kSmiTagMask == 1);
...@@ -178,8 +178,8 @@ Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control, ...@@ -178,8 +178,8 @@ Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control,
Node* branch = graph()->NewNode(common()->Branch(), tag, control); Node* branch = graph()->NewNode(common()->Branch(), tag, control);
Node* if_true = graph()->NewNode(common()->IfTrue(), branch); Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
Operator* op = is_signed ? machine()->ChangeFloat64ToInt32() Operator* op = (signedness == kSigned) ? machine()->ChangeFloat64ToInt32()
: machine()->ChangeFloat64ToUint32(); : machine()->ChangeFloat64ToUint32();
Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true)); Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true));
Node* if_false = graph()->NewNode(common()->IfFalse(), branch); Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
......
...@@ -27,6 +27,8 @@ class ChangeLowering V8_FINAL : public Reducer { ...@@ -27,6 +27,8 @@ class ChangeLowering V8_FINAL : public Reducer {
virtual Reduction Reduce(Node* node) V8_OVERRIDE; virtual Reduction Reduce(Node* node) V8_OVERRIDE;
private: private:
enum Signedness { kSigned, kUnsigned };
Node* HeapNumberValueIndexConstant(); Node* HeapNumberValueIndexConstant();
Node* SmiMaxValueConstant(); Node* SmiMaxValueConstant();
Node* SmiShiftBitsConstant(); Node* SmiShiftBitsConstant();
...@@ -40,7 +42,7 @@ class ChangeLowering V8_FINAL : public Reducer { ...@@ -40,7 +42,7 @@ class ChangeLowering V8_FINAL : public Reducer {
Reduction ChangeFloat64ToTagged(Node* val, Node* control); Reduction ChangeFloat64ToTagged(Node* val, Node* control);
Reduction ChangeInt32ToTagged(Node* val, Node* control); Reduction ChangeInt32ToTagged(Node* val, Node* control);
Reduction ChangeTaggedToFloat64(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); Reduction ChangeUint32ToTagged(Node* val, Node* control);
Graph* graph() const; Graph* graph() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment