| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   615       break; |   615       break; | 
|   616     case IrOpcode::kChangeTaggedToFloat64: |   616     case IrOpcode::kChangeTaggedToFloat64: | 
|   617       state = LowerChangeTaggedToFloat64(node, *effect, *control); |   617       state = LowerChangeTaggedToFloat64(node, *effect, *control); | 
|   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::kCheckMaps: | 
 |   626       state = LowerCheckMaps(node, frame_state, *effect, *control); | 
 |   627       break; | 
|   625     case IrOpcode::kCheckNumber: |   628     case IrOpcode::kCheckNumber: | 
|   626       state = LowerCheckNumber(node, frame_state, *effect, *control); |   629       state = LowerCheckNumber(node, frame_state, *effect, *control); | 
|   627       break; |   630       break; | 
|   628     case IrOpcode::kCheckString: |   631     case IrOpcode::kCheckString: | 
|   629       state = LowerCheckString(node, frame_state, *effect, *control); |   632       state = LowerCheckString(node, frame_state, *effect, *control); | 
|   630       break; |   633       break; | 
|   631     case IrOpcode::kCheckIf: |   634     case IrOpcode::kCheckIf: | 
|   632       state = LowerCheckIf(node, frame_state, *effect, *control); |   635       state = LowerCheckIf(node, frame_state, *effect, *control); | 
|   633       break; |   636       break; | 
|   634     case IrOpcode::kCheckTaggedPointer: |   637     case IrOpcode::kCheckTaggedPointer: | 
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1016  |  1019  | 
|  1017   Node* check = graph()->NewNode(machine()->Uint32LessThan(), index, limit); |  1020   Node* check = graph()->NewNode(machine()->Uint32LessThan(), index, limit); | 
|  1018   control = effect = graph()->NewNode( |  1021   control = effect = graph()->NewNode( | 
|  1019       common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check, |  1022       common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check, | 
|  1020       frame_state, effect, control); |  1023       frame_state, effect, control); | 
|  1021  |  1024  | 
|  1022   return ValueEffectControl(index, effect, control); |  1025   return ValueEffectControl(index, effect, control); | 
|  1023 } |  1026 } | 
|  1024  |  1027  | 
|  1025 EffectControlLinearizer::ValueEffectControl |  1028 EffectControlLinearizer::ValueEffectControl | 
 |  1029 EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state, | 
 |  1030                                         Node* effect, Node* control) { | 
 |  1031   Node* value = node->InputAt(0); | 
 |  1032  | 
 |  1033   // Load the current map of the {value}. | 
 |  1034   Node* value_map = effect = graph()->NewNode( | 
 |  1035       simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); | 
 |  1036  | 
 |  1037   int const map_count = node->op()->ValueInputCount() - 1; | 
 |  1038   Node** controls = temp_zone()->NewArray<Node*>(map_count); | 
 |  1039   Node** effects = temp_zone()->NewArray<Node*>(map_count + 1); | 
 |  1040  | 
 |  1041   for (int i = 0; i < map_count; ++i) { | 
 |  1042     Node* map = node->InputAt(1 + i); | 
 |  1043  | 
 |  1044     Node* check = graph()->NewNode(machine()->WordEqual(), value_map, map); | 
 |  1045     if (i == map_count - 1) { | 
 |  1046       controls[i] = effects[i] = graph()->NewNode( | 
 |  1047           common()->DeoptimizeUnless(DeoptimizeReason::kWrongMap), check, | 
 |  1048           frame_state, effect, control); | 
 |  1049     } else { | 
 |  1050       control = graph()->NewNode(common()->Branch(), check, control); | 
 |  1051       controls[i] = graph()->NewNode(common()->IfTrue(), control); | 
 |  1052       control = graph()->NewNode(common()->IfFalse(), control); | 
 |  1053       effects[i] = effect; | 
 |  1054     } | 
 |  1055   } | 
 |  1056  | 
 |  1057   control = graph()->NewNode(common()->Merge(map_count), map_count, controls); | 
 |  1058   effects[map_count] = control; | 
 |  1059   effect = | 
 |  1060       graph()->NewNode(common()->EffectPhi(map_count), map_count + 1, effects); | 
 |  1061  | 
 |  1062   return ValueEffectControl(value, effect, control); | 
 |  1063 } | 
 |  1064  | 
 |  1065 EffectControlLinearizer::ValueEffectControl | 
|  1026 EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state, |  1066 EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state, | 
|  1027                                           Node* effect, Node* control) { |  1067                                           Node* effect, Node* control) { | 
|  1028   Node* value = node->InputAt(0); |  1068   Node* value = node->InputAt(0); | 
|  1029  |  1069  | 
|  1030   Node* check0 = ObjectIsSmi(value); |  1070   Node* check0 = ObjectIsSmi(value); | 
|  1031   Node* branch0 = |  1071   Node* branch0 = | 
|  1032       graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); |  1072       graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); | 
|  1033  |  1073  | 
|  1034   Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |  1074   Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 
|  1035   Node* etrue0 = effect; |  1075   Node* etrue0 = effect; | 
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2537         isolate(), graph()->zone(), callable.descriptor(), 0, flags, |  2577         isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 
|  2538         Operator::kNoThrow); |  2578         Operator::kNoThrow); | 
|  2539     to_number_operator_.set(common()->Call(desc)); |  2579     to_number_operator_.set(common()->Call(desc)); | 
|  2540   } |  2580   } | 
|  2541   return to_number_operator_.get(); |  2581   return to_number_operator_.get(); | 
|  2542 } |  2582 } | 
|  2543  |  2583  | 
|  2544 }  // namespace compiler |  2584 }  // namespace compiler | 
|  2545 }  // namespace internal |  2585 }  // namespace internal | 
|  2546 }  // namespace v8 |  2586 }  // namespace v8 | 
| OLD | NEW |