| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/compiler/bounds-check-lowering.h" |
| 6 |
| 7 #include "src/compiler/js-graph.h" |
| 8 |
| 9 namespace v8 { |
| 10 namespace internal { |
| 11 namespace compiler { |
| 12 |
| 13 BoundsCheckLowering::~BoundsCheckLowering() {} |
| 14 |
| 15 |
| 16 Reduction BoundsCheckLowering::Reduce(Node* node) { |
| 17 if (node->opcode() != IrOpcode::kBoundsCheck) return NoChange(); |
| 18 Node* const offset = node->InputAt(0); |
| 19 Node* const length = node->InputAt(1); |
| 20 Node* const select = graph()->NewNode( |
| 21 common()->Select(kMachUint32, BranchHint::kTrue), |
| 22 graph()->NewNode(machine()->Uint32LessThan(), offset, length), offset, |
| 23 length); |
| 24 return Replace(select); |
| 25 } |
| 26 |
| 27 |
| 28 Graph* BoundsCheckLowering::graph() const { return jsgraph()->graph(); } |
| 29 |
| 30 |
| 31 CommonOperatorBuilder* BoundsCheckLowering::common() const { |
| 32 return jsgraph()->common(); |
| 33 } |
| 34 |
| 35 |
| 36 MachineOperatorBuilder* BoundsCheckLowering::machine() const { |
| 37 return jsgraph()->machine(); |
| 38 } |
| 39 |
| 40 } // namespace compiler |
| 41 } // namespace internal |
| 42 } // namespace v8 |
| OLD | NEW |