Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: src/compiler/bounds-check-lowering.cc

Issue 768543002: [WIP] TrapHandler 2014/11/27. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/bounds-check-lowering.h ('k') | src/compiler/js-typed-lowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/compiler/bounds-check-lowering.h ('k') | src/compiler/js-typed-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698