OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 | 6 |
7 #include "src/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 case IrOpcode::kChangeBitToBool: | 26 case IrOpcode::kChangeBitToBool: |
27 return ChangeBitToBool(node->InputAt(0), control); | 27 return ChangeBitToBool(node->InputAt(0), control); |
28 case IrOpcode::kChangeBoolToBit: | 28 case IrOpcode::kChangeBoolToBit: |
29 return ChangeBoolToBit(node->InputAt(0)); | 29 return ChangeBoolToBit(node->InputAt(0)); |
30 case IrOpcode::kChangeFloat64ToTagged: | 30 case IrOpcode::kChangeFloat64ToTagged: |
31 return ChangeFloat64ToTagged(node->InputAt(0), control); | 31 return ChangeFloat64ToTagged(node->InputAt(0), control); |
32 case IrOpcode::kChangeInt31ToTagged: | 32 case IrOpcode::kChangeInt31ToTagged: |
33 return ChangeInt31ToTagged(node->InputAt(0), control); | 33 return ChangeInt31ToTagged(node->InputAt(0), control); |
34 case IrOpcode::kChangeInt32ToTagged: | 34 case IrOpcode::kChangeInt32ToTagged: |
35 return ChangeInt32ToTagged(node->InputAt(0), control); | 35 return ChangeInt32ToTagged(node->InputAt(0), control); |
36 case IrOpcode::kChangeSmiToInt32: | 36 case IrOpcode::kChangeTaggedSignedToInt32: |
37 return ChangeSmiToInt32(node->InputAt(0)); | 37 return ChangeTaggedSignedToInt32(node->InputAt(0)); |
38 case IrOpcode::kChangeTaggedToFloat64: | 38 case IrOpcode::kChangeTaggedToFloat64: |
39 return ChangeTaggedToFloat64(node->InputAt(0), control); | 39 return ChangeTaggedToFloat64(node->InputAt(0), control); |
40 case IrOpcode::kChangeTaggedToInt32: | 40 case IrOpcode::kChangeTaggedToInt32: |
41 return ChangeTaggedToUI32(node->InputAt(0), control, kSigned); | 41 return ChangeTaggedToUI32(node->InputAt(0), control, kSigned); |
42 case IrOpcode::kChangeTaggedToUint32: | 42 case IrOpcode::kChangeTaggedToUint32: |
43 return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned); | 43 return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned); |
44 case IrOpcode::kChangeUint32ToTagged: | 44 case IrOpcode::kChangeUint32ToTagged: |
45 return ChangeUint32ToTagged(node->InputAt(0), control); | 45 return ChangeUint32ToTagged(node->InputAt(0), control); |
46 case IrOpcode::kLoadField: | 46 case IrOpcode::kLoadField: |
47 return LoadField(node); | 47 return LoadField(node); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 265 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
266 Node* vfalse = graph()->NewNode(common()->Projection(0), add); | 266 Node* vfalse = graph()->NewNode(common()->Projection(0), add); |
267 | 267 |
268 control = graph()->NewNode(common()->Merge(2), if_true, if_false); | 268 control = graph()->NewNode(common()->Merge(2), if_true, if_false); |
269 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 269 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
270 vtrue, vfalse, control); | 270 vtrue, vfalse, control); |
271 } | 271 } |
272 return Replace(value); | 272 return Replace(value); |
273 } | 273 } |
274 | 274 |
275 Reduction ChangeLowering::ChangeSmiToInt32(Node* value) { | 275 Reduction ChangeLowering::ChangeTaggedSignedToInt32(Node* value) { |
276 return Replace(ChangeSmiToWord32(value)); | 276 return Replace(ChangeSmiToWord32(value)); |
277 } | 277 } |
278 | 278 |
279 Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control, | 279 Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control, |
280 Signedness signedness) { | 280 Signedness signedness) { |
281 if (NodeProperties::GetType(value)->Is(Type::TaggedSigned())) { | |
282 return ChangeSmiToInt32(value); | |
283 } | |
284 | |
285 const Operator* op = (signedness == kSigned) | 281 const Operator* op = (signedness == kSigned) |
286 ? machine()->ChangeFloat64ToInt32() | 282 ? machine()->ChangeFloat64ToInt32() |
287 : machine()->ChangeFloat64ToUint32(); | 283 : machine()->ChangeFloat64ToUint32(); |
288 | 284 |
289 if (NodeProperties::GetType(value)->Is(Type::TaggedPointer()) && | 285 if (NodeProperties::GetType(value)->Is(Type::TaggedPointer()) && |
290 NodeProperties::GetType(value)->Is(Type::Number())) { | 286 NodeProperties::GetType(value)->Is(Type::Number())) { |
291 return Replace(graph()->NewNode(op, LoadHeapNumberValue(value, control))); | 287 return Replace(graph()->NewNode(op, LoadHeapNumberValue(value, control))); |
292 } | 288 } |
293 | 289 |
294 Node* check = TestNotSmi(value); | 290 Node* check = TestNotSmi(value); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 693 } |
698 | 694 |
699 | 695 |
700 MachineOperatorBuilder* ChangeLowering::machine() const { | 696 MachineOperatorBuilder* ChangeLowering::machine() const { |
701 return jsgraph()->machine(); | 697 return jsgraph()->machine(); |
702 } | 698 } |
703 | 699 |
704 } // namespace compiler | 700 } // namespace compiler |
705 } // namespace internal | 701 } // namespace internal |
706 } // namespace v8 | 702 } // namespace v8 |
OLD | NEW |