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/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 break; | 618 break; |
619 case IrOpcode::kTruncateTaggedToFloat64: | 619 case IrOpcode::kTruncateTaggedToFloat64: |
620 state = LowerTruncateTaggedToFloat64(node, *effect, *control); | 620 state = LowerTruncateTaggedToFloat64(node, *effect, *control); |
621 break; | 621 break; |
622 case IrOpcode::kCheckBounds: | 622 case IrOpcode::kCheckBounds: |
623 state = LowerCheckBounds(node, frame_state, *effect, *control); | 623 state = LowerCheckBounds(node, frame_state, *effect, *control); |
624 break; | 624 break; |
625 case IrOpcode::kCheckNumber: | 625 case IrOpcode::kCheckNumber: |
626 state = LowerCheckNumber(node, frame_state, *effect, *control); | 626 state = LowerCheckNumber(node, frame_state, *effect, *control); |
627 break; | 627 break; |
| 628 case IrOpcode::kCheckString: |
| 629 state = LowerCheckString(node, frame_state, *effect, *control); |
| 630 break; |
628 case IrOpcode::kCheckIf: | 631 case IrOpcode::kCheckIf: |
629 state = LowerCheckIf(node, frame_state, *effect, *control); | 632 state = LowerCheckIf(node, frame_state, *effect, *control); |
630 break; | 633 break; |
631 case IrOpcode::kCheckTaggedPointer: | 634 case IrOpcode::kCheckTaggedPointer: |
632 state = LowerCheckTaggedPointer(node, frame_state, *effect, *control); | 635 state = LowerCheckTaggedPointer(node, frame_state, *effect, *control); |
633 break; | 636 break; |
634 case IrOpcode::kCheckTaggedSigned: | 637 case IrOpcode::kCheckTaggedSigned: |
635 state = LowerCheckTaggedSigned(node, frame_state, *effect, *control); | 638 state = LowerCheckTaggedSigned(node, frame_state, *effect, *control); |
636 break; | 639 break; |
637 case IrOpcode::kCheckedInt32Add: | 640 case IrOpcode::kCheckedInt32Add: |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 frame_state, efalse0, if_false0); | 1040 frame_state, efalse0, if_false0); |
1038 } | 1041 } |
1039 | 1042 |
1040 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1043 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
1041 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1044 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
1042 | 1045 |
1043 return ValueEffectControl(value, effect, control); | 1046 return ValueEffectControl(value, effect, control); |
1044 } | 1047 } |
1045 | 1048 |
1046 EffectControlLinearizer::ValueEffectControl | 1049 EffectControlLinearizer::ValueEffectControl |
| 1050 EffectControlLinearizer::LowerCheckString(Node* node, Node* frame_state, |
| 1051 Node* effect, Node* control) { |
| 1052 Node* value = node->InputAt(0); |
| 1053 |
| 1054 Node* check0 = ObjectIsSmi(value); |
| 1055 control = effect = |
| 1056 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kSmi), check0, |
| 1057 frame_state, effect, control); |
| 1058 |
| 1059 Node* value_map = effect = graph()->NewNode( |
| 1060 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); |
| 1061 Node* value_instance_type = effect = graph()->NewNode( |
| 1062 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), value_map, |
| 1063 effect, control); |
| 1064 |
| 1065 Node* check1 = |
| 1066 graph()->NewNode(machine()->Uint32LessThan(), value_instance_type, |
| 1067 jsgraph()->Uint32Constant(FIRST_NONSTRING_TYPE)); |
| 1068 control = effect = graph()->NewNode( |
| 1069 common()->DeoptimizeUnless(DeoptimizeReason::kWrongInstanceType), check1, |
| 1070 frame_state, effect, control); |
| 1071 |
| 1072 return ValueEffectControl(value, effect, control); |
| 1073 } |
| 1074 |
| 1075 EffectControlLinearizer::ValueEffectControl |
1047 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, | 1076 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, |
1048 Node* effect, Node* control) { | 1077 Node* effect, Node* control) { |
1049 Node* value = node->InputAt(0); | 1078 Node* value = node->InputAt(0); |
1050 | 1079 |
1051 control = effect = | 1080 control = effect = |
1052 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNoReason), | 1081 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNoReason), |
1053 value, frame_state, effect, control); | 1082 value, frame_state, effect, control); |
1054 | 1083 |
1055 return ValueEffectControl(value, effect, control); | 1084 return ValueEffectControl(value, effect, control); |
1056 } | 1085 } |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 2228 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
2200 Operator::kNoThrow); | 2229 Operator::kNoThrow); |
2201 to_number_operator_.set(common()->Call(desc)); | 2230 to_number_operator_.set(common()->Call(desc)); |
2202 } | 2231 } |
2203 return to_number_operator_.get(); | 2232 return to_number_operator_.get(); |
2204 } | 2233 } |
2205 | 2234 |
2206 } // namespace compiler | 2235 } // namespace compiler |
2207 } // namespace internal | 2236 } // namespace internal |
2208 } // namespace v8 | 2237 } // namespace v8 |
OLD | NEW |