| 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/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 if (fixed_offset == 0) return index; | 1072 if (fixed_offset == 0) return index; |
| 1073 return graph()->NewNode(machine()->Int32Add(), index, | 1073 return graph()->NewNode(machine()->Int32Add(), index, |
| 1074 jsgraph()->Int32Constant(fixed_offset)); | 1074 jsgraph()->Int32Constant(fixed_offset)); |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 | 1077 |
| 1078 void SimplifiedLowering::DoLoadElement(Node* node, MachineType output_type) { | 1078 void SimplifiedLowering::DoLoadElement(Node* node, MachineType output_type) { |
| 1079 const ElementAccess& access = ElementAccessOf(node->op()); | 1079 const ElementAccess& access = ElementAccessOf(node->op()); |
| 1080 const Operator* op = machine()->Load(access.machine_type); | 1080 const Operator* op = machine()->Load(access.machine_type); |
| 1081 Node* key = node->InputAt(1); | 1081 Node* key = node->InputAt(1); |
| 1082 Node* effect = node->InputAt(3); |
| 1082 Node* index = ComputeIndex(access, key); | 1083 Node* index = ComputeIndex(access, key); |
| 1083 if (access.bounds_check == kNoBoundsCheck) { | 1084 if (access.bounds_check == kNoBoundsCheck) { |
| 1084 DCHECK_EQ(access.machine_type, output_type); | 1085 DCHECK_EQ(access.machine_type, output_type); |
| 1085 node->set_op(op); | 1086 node->set_op(op); |
| 1086 node->ReplaceInput(1, index); | 1087 node->ReplaceInput(1, index); |
| 1087 node->RemoveInput(2); | 1088 node->ReplaceInput(2, effect); |
| 1089 node->ReplaceInput(3, graph()->start()); |
| 1088 } else { | 1090 } else { |
| 1089 DCHECK_EQ(kTypedArrayBoundsCheck, access.bounds_check); | 1091 DCHECK_EQ(kTypedArrayBoundsCheck, access.bounds_check); |
| 1090 | 1092 |
| 1091 Node* base = node->InputAt(0); | 1093 Node* base = node->InputAt(0); |
| 1092 Node* length = node->InputAt(2); | 1094 Node* length = node->InputAt(2); |
| 1093 Node* effect = node->InputAt(3); | |
| 1094 Node* control = node->InputAt(4); | |
| 1095 | 1095 |
| 1096 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, length); | 1096 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, length); |
| 1097 Node* branch = | 1097 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check, |
| 1098 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); | 1098 graph()->start()); |
| 1099 | 1099 |
| 1100 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 1100 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
| 1101 Node* load = graph()->NewNode(op, base, index, effect, if_true); | 1101 Node* load = graph()->NewNode(op, base, index, effect, if_true); |
| 1102 Node* result = load; | 1102 Node* result = load; |
| 1103 if (output_type & kRepTagged) { | 1103 if (output_type & kRepTagged) { |
| 1104 // TODO(turbofan): This is ugly as hell! | 1104 // TODO(turbofan): This is ugly as hell! |
| 1105 SimplifiedOperatorBuilder simplified(graph()->zone()); | 1105 SimplifiedOperatorBuilder simplified(graph()->zone()); |
| 1106 RepresentationChanger changer(jsgraph(), &simplified, | 1106 RepresentationChanger changer(jsgraph(), &simplified, |
| 1107 graph()->zone()->isolate()); | 1107 graph()->zone()->isolate()); |
| 1108 result = changer.GetTaggedRepresentationFor(result, access.machine_type); | 1108 result = changer.GetTaggedRepresentationFor(result, access.machine_type); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1235 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
| 1236 node->set_op(machine()->IntLessThanOrEqual()); | 1236 node->set_op(machine()->IntLessThanOrEqual()); |
| 1237 node->ReplaceInput(0, StringComparison(node, true)); | 1237 node->ReplaceInput(0, StringComparison(node, true)); |
| 1238 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1238 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 | 1241 |
| 1242 } // namespace compiler | 1242 } // namespace compiler |
| 1243 } // namespace internal | 1243 } // namespace internal |
| 1244 } // namespace v8 | 1244 } // namespace v8 |
| OLD | NEW |