OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/compiler-source-position-table.h" | 9 #include "src/compiler/compiler-source-position-table.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 break; | 626 break; |
627 case IrOpcode::kChangeTaggedToInt32: | 627 case IrOpcode::kChangeTaggedToInt32: |
628 result = LowerChangeTaggedToInt32(node); | 628 result = LowerChangeTaggedToInt32(node); |
629 break; | 629 break; |
630 case IrOpcode::kChangeTaggedToUint32: | 630 case IrOpcode::kChangeTaggedToUint32: |
631 result = LowerChangeTaggedToUint32(node); | 631 result = LowerChangeTaggedToUint32(node); |
632 break; | 632 break; |
633 case IrOpcode::kChangeTaggedToFloat64: | 633 case IrOpcode::kChangeTaggedToFloat64: |
634 result = LowerChangeTaggedToFloat64(node); | 634 result = LowerChangeTaggedToFloat64(node); |
635 break; | 635 break; |
| 636 case IrOpcode::kChangeTaggedToTaggedSigned: |
| 637 result = LowerChangeTaggedToTaggedSigned(node); |
| 638 break; |
636 case IrOpcode::kTruncateTaggedToBit: | 639 case IrOpcode::kTruncateTaggedToBit: |
637 result = LowerTruncateTaggedToBit(node); | 640 result = LowerTruncateTaggedToBit(node); |
638 break; | 641 break; |
639 case IrOpcode::kTruncateTaggedToFloat64: | 642 case IrOpcode::kTruncateTaggedToFloat64: |
640 result = LowerTruncateTaggedToFloat64(node); | 643 result = LowerTruncateTaggedToFloat64(node); |
641 break; | 644 break; |
642 case IrOpcode::kCheckBounds: | 645 case IrOpcode::kCheckBounds: |
643 result = LowerCheckBounds(node, frame_state); | 646 result = LowerCheckBounds(node, frame_state); |
644 break; | 647 break; |
645 case IrOpcode::kCheckMaps: | 648 case IrOpcode::kCheckMaps: |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 __ Goto(&done, vfalse); | 1028 __ Goto(&done, vfalse); |
1026 | 1029 |
1027 __ Bind(&done); | 1030 __ Bind(&done); |
1028 return done.PhiAt(0); | 1031 return done.PhiAt(0); |
1029 } | 1032 } |
1030 | 1033 |
1031 Node* EffectControlLinearizer::LowerChangeTaggedToFloat64(Node* node) { | 1034 Node* EffectControlLinearizer::LowerChangeTaggedToFloat64(Node* node) { |
1032 return LowerTruncateTaggedToFloat64(node); | 1035 return LowerTruncateTaggedToFloat64(node); |
1033 } | 1036 } |
1034 | 1037 |
| 1038 Node* EffectControlLinearizer::LowerChangeTaggedToTaggedSigned(Node* node) { |
| 1039 Node* value = node->InputAt(0); |
| 1040 |
| 1041 auto if_not_smi = __ MakeDeferredLabel<1>(); |
| 1042 auto done = __ MakeLabel<2>(MachineRepresentation::kWord32); |
| 1043 |
| 1044 Node* check = ObjectIsSmi(value); |
| 1045 __ GotoUnless(check, &if_not_smi); |
| 1046 __ Goto(&done, value); |
| 1047 |
| 1048 __ Bind(&if_not_smi); |
| 1049 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); |
| 1050 Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value); |
| 1051 vfalse = __ ChangeFloat64ToInt32(vfalse); |
| 1052 vfalse = ChangeInt32ToSmi(vfalse); |
| 1053 __ Goto(&done, vfalse); |
| 1054 |
| 1055 __ Bind(&done); |
| 1056 return done.PhiAt(0); |
| 1057 } |
| 1058 |
1035 Node* EffectControlLinearizer::LowerTruncateTaggedToFloat64(Node* node) { | 1059 Node* EffectControlLinearizer::LowerTruncateTaggedToFloat64(Node* node) { |
1036 Node* value = node->InputAt(0); | 1060 Node* value = node->InputAt(0); |
1037 | 1061 |
1038 auto if_not_smi = __ MakeDeferredLabel<1>(); | 1062 auto if_not_smi = __ MakeDeferredLabel<1>(); |
1039 auto done = __ MakeLabel<2>(MachineRepresentation::kFloat64); | 1063 auto done = __ MakeLabel<2>(MachineRepresentation::kFloat64); |
1040 | 1064 |
1041 Node* check = ObjectIsSmi(value); | 1065 Node* check = ObjectIsSmi(value); |
1042 __ GotoUnless(check, &if_not_smi); | 1066 __ GotoUnless(check, &if_not_smi); |
1043 Node* vtrue = ChangeSmiToInt32(value); | 1067 Node* vtrue = ChangeSmiToInt32(value); |
1044 vtrue = __ ChangeInt32ToFloat64(vtrue); | 1068 vtrue = __ ChangeInt32ToFloat64(vtrue); |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 return isolate()->factory(); | 2790 return isolate()->factory(); |
2767 } | 2791 } |
2768 | 2792 |
2769 Isolate* EffectControlLinearizer::isolate() const { | 2793 Isolate* EffectControlLinearizer::isolate() const { |
2770 return jsgraph()->isolate(); | 2794 return jsgraph()->isolate(); |
2771 } | 2795 } |
2772 | 2796 |
2773 } // namespace compiler | 2797 } // namespace compiler |
2774 } // namespace internal | 2798 } // namespace internal |
2775 } // namespace v8 | 2799 } // namespace v8 |
OLD | NEW |