| Index: src/compiler/bounds-check-lowering.cc
|
| diff --git a/src/compiler/bounds-check-lowering.cc b/src/compiler/bounds-check-lowering.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fac51f8be13eccffd952b9564dd5748aaa582b28
|
| --- /dev/null
|
| +++ b/src/compiler/bounds-check-lowering.cc
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2014 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "src/compiler/bounds-check-lowering.h"
|
| +
|
| +#include "src/compiler/js-graph.h"
|
| +
|
| +namespace v8 {
|
| +namespace internal {
|
| +namespace compiler {
|
| +
|
| +BoundsCheckLowering::~BoundsCheckLowering() {}
|
| +
|
| +
|
| +Reduction BoundsCheckLowering::Reduce(Node* node) {
|
| + if (node->opcode() != IrOpcode::kBoundsCheck) return NoChange();
|
| + Node* const offset = node->InputAt(0);
|
| + Node* const length = node->InputAt(1);
|
| + Node* const select = graph()->NewNode(
|
| + common()->Select(kMachUint32, BranchHint::kTrue),
|
| + graph()->NewNode(machine()->Uint32LessThan(), offset, length), offset,
|
| + length);
|
| + return Replace(select);
|
| +}
|
| +
|
| +
|
| +Graph* BoundsCheckLowering::graph() const { return jsgraph()->graph(); }
|
| +
|
| +
|
| +CommonOperatorBuilder* BoundsCheckLowering::common() const {
|
| + return jsgraph()->common();
|
| +}
|
| +
|
| +
|
| +MachineOperatorBuilder* BoundsCheckLowering::machine() const {
|
| + return jsgraph()->machine();
|
| +}
|
| +
|
| +} // namespace compiler
|
| +} // namespace internal
|
| +} // namespace v8
|
|
|