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

Side by Side Diff: src/compiler/simplified-operator-reducer.cc

Issue 763963002: [turbofan] Add checked load/store operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reapply fix. Created 6 years 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 unified diff | Download patch
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/typer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/js-graph.h" 5 #include "src/compiler/js-graph.h"
6 #include "src/compiler/machine-operator.h" 6 #include "src/compiler/machine-operator.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/simplified-operator-reducer.h" 8 #include "src/compiler/simplified-operator-reducer.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 m.node()->InputAt(0)); 91 m.node()->InputAt(0));
92 } 92 }
93 if (m.IsChangeUint32ToTagged()) return Replace(m.node()->InputAt(0)); 93 if (m.IsChangeUint32ToTagged()) return Replace(m.node()->InputAt(0));
94 break; 94 break;
95 } 95 }
96 case IrOpcode::kChangeUint32ToTagged: { 96 case IrOpcode::kChangeUint32ToTagged: {
97 Uint32Matcher m(node->InputAt(0)); 97 Uint32Matcher m(node->InputAt(0));
98 if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value())); 98 if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value()));
99 break; 99 break;
100 } 100 }
101 case IrOpcode::kLoadElement: {
102 ElementAccess access = ElementAccessOf(node->op());
103 if (access.bounds_check == kTypedArrayBoundsCheck) {
104 NumberMatcher mkey(node->InputAt(1));
105 NumberMatcher mlength(node->InputAt(2));
106 if (mkey.HasValue() && mlength.HasValue()) {
107 // Skip the typed array bounds check if key and length are constant.
108 if (mkey.Value() >= 0 && mkey.Value() < mlength.Value()) {
109 access.bounds_check = kNoBoundsCheck;
110 node->set_op(simplified()->LoadElement(access));
111 return Changed(node);
112 }
113 }
114 }
115 break;
116 }
117 case IrOpcode::kStoreElement: {
118 ElementAccess access = ElementAccessOf(node->op());
119 if (access.bounds_check == kTypedArrayBoundsCheck) {
120 NumberMatcher mkey(node->InputAt(1));
121 NumberMatcher mlength(node->InputAt(2));
122 if (mkey.HasValue() && mlength.HasValue()) {
123 // Skip the typed array bounds check if key and length are constant.
124 if (mkey.Value() >= 0 && mkey.Value() < mlength.Value()) {
125 access.bounds_check = kNoBoundsCheck;
126 node->set_op(simplified()->StoreElement(access));
127 return Changed(node);
128 }
129 }
130 }
131 break;
132 }
133 default: 101 default:
134 break; 102 break;
135 } 103 }
136 return NoChange(); 104 return NoChange();
137 } 105 }
138 106
139 107
140 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op, 108 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op,
141 Node* a) { 109 Node* a) {
142 node->set_op(op); 110 node->set_op(op);
(...skipping 30 matching lines...) Expand all
173 } 141 }
174 142
175 143
176 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { 144 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
177 return jsgraph()->machine(); 145 return jsgraph()->machine();
178 } 146 }
179 147
180 } // namespace compiler 148 } // namespace compiler
181 } // namespace internal 149 } // namespace internal
182 } // namespace v8 150 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/typer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698