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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 RepresentationChanger* changer) { | 1140 RepresentationChanger* changer) { |
1141 DCHECK_EQ(IrOpcode::kLoadBuffer, node->opcode()); | 1141 DCHECK_EQ(IrOpcode::kLoadBuffer, node->opcode()); |
1142 DCHECK_NE(kMachNone, RepresentationOf(output_type)); | 1142 DCHECK_NE(kMachNone, RepresentationOf(output_type)); |
1143 MachineType const type = BufferAccessOf(node->op()).machine_type(); | 1143 MachineType const type = BufferAccessOf(node->op()).machine_type(); |
1144 if (output_type != type) { | 1144 if (output_type != type) { |
1145 Node* const buffer = node->InputAt(0); | 1145 Node* const buffer = node->InputAt(0); |
1146 Node* const offset = node->InputAt(1); | 1146 Node* const offset = node->InputAt(1); |
1147 Node* const length = node->InputAt(2); | 1147 Node* const length = node->InputAt(2); |
1148 Node* const effect = node->InputAt(3); | 1148 Node* const effect = node->InputAt(3); |
1149 Node* const control = node->InputAt(4); | 1149 Node* const control = node->InputAt(4); |
| 1150 Node* const index = |
| 1151 machine()->Is64() |
| 1152 ? graph()->NewNode(machine()->ChangeUint32ToUint64(), offset) |
| 1153 : offset; |
1150 | 1154 |
1151 Node* check = graph()->NewNode(machine()->Uint32LessThan(), offset, length); | 1155 Node* check = graph()->NewNode(machine()->Uint32LessThan(), offset, length); |
1152 Node* branch = | 1156 Node* branch = |
1153 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); | 1157 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); |
1154 | 1158 |
1155 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 1159 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
1156 Node* etrue = graph()->NewNode(machine()->Load(type), buffer, offset, | 1160 Node* etrue = |
1157 effect, if_true); | 1161 graph()->NewNode(machine()->Load(type), buffer, index, effect, if_true); |
1158 Node* vtrue = changer->GetRepresentationFor(etrue, type, output_type); | 1162 Node* vtrue = changer->GetRepresentationFor(etrue, type, output_type); |
1159 | 1163 |
1160 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 1164 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
1161 Node* efalse = effect; | 1165 Node* efalse = effect; |
1162 Node* vfalse; | 1166 Node* vfalse; |
1163 if (output_type & kRepTagged) { | 1167 if (output_type & kRepTagged) { |
1164 vfalse = jsgraph()->UndefinedConstant(); | 1168 vfalse = jsgraph()->UndefinedConstant(); |
1165 } else if (output_type & kRepFloat64) { | 1169 } else if (output_type & kRepFloat64) { |
1166 vfalse = | 1170 vfalse = |
1167 jsgraph()->Float64Constant(std::numeric_limits<double>::quiet_NaN()); | 1171 jsgraph()->Float64Constant(std::numeric_limits<double>::quiet_NaN()); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 | 1476 |
1473 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1477 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1474 node->set_op(machine()->IntLessThanOrEqual()); | 1478 node->set_op(machine()->IntLessThanOrEqual()); |
1475 node->ReplaceInput(0, StringComparison(node, true)); | 1479 node->ReplaceInput(0, StringComparison(node, true)); |
1476 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1480 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1477 } | 1481 } |
1478 | 1482 |
1479 } // namespace compiler | 1483 } // namespace compiler |
1480 } // namespace internal | 1484 } // namespace internal |
1481 } // namespace v8 | 1485 } // namespace v8 |
OLD | NEW |