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

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

Issue 1128133003: [turbofan] Make an OptionalOperator for MachineOperatorBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: OPTIONAL macro Created 5 years, 6 months 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 | « no previous file | src/compiler/js-intrinsic-lowering.cc » ('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/common-operator-reducer.h" 5 #include "src/compiler/common-operator-reducer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) && 172 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
173 vfalse->opcode() == IrOpcode::kFloat32Sub) { 173 vfalse->opcode() == IrOpcode::kFloat32Sub) {
174 Float32BinopMatcher mvfalse(vfalse); 174 Float32BinopMatcher mvfalse(vfalse);
175 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) { 175 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
176 // We might now be able to further reduce the {merge} node. 176 // We might now be able to further reduce the {merge} node.
177 Revisit(merge); 177 Revisit(merge);
178 return Change(node, machine()->Float32Abs(), vtrue); 178 return Change(node, machine()->Float32Abs(), vtrue);
179 } 179 }
180 } 180 }
181 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) && 181 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
182 machine()->HasFloat32Min()) { 182 machine()->Float32Min().IsSupported()) {
183 // We might now be able to further reduce the {merge} node. 183 // We might now be able to further reduce the {merge} node.
184 Revisit(merge); 184 Revisit(merge);
185 return Change(node, machine()->Float32Min(), vtrue, vfalse); 185 return Change(node, machine()->Float32Min().op(), vtrue, vfalse);
186 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) && 186 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
187 machine()->HasFloat32Max()) { 187 machine()->Float32Max().IsSupported()) {
188 // We might now be able to further reduce the {merge} node. 188 // We might now be able to further reduce the {merge} node.
189 Revisit(merge); 189 Revisit(merge);
190 return Change(node, machine()->Float32Max(), vtrue, vfalse); 190 return Change(node, machine()->Float32Max().op(), vtrue, vfalse);
191 } 191 }
192 } else if (cond->opcode() == IrOpcode::kFloat64LessThan) { 192 } else if (cond->opcode() == IrOpcode::kFloat64LessThan) {
193 Float64BinopMatcher mcond(cond); 193 Float64BinopMatcher mcond(cond);
194 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) && 194 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
195 vfalse->opcode() == IrOpcode::kFloat64Sub) { 195 vfalse->opcode() == IrOpcode::kFloat64Sub) {
196 Float64BinopMatcher mvfalse(vfalse); 196 Float64BinopMatcher mvfalse(vfalse);
197 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) { 197 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
198 // We might now be able to further reduce the {merge} node. 198 // We might now be able to further reduce the {merge} node.
199 Revisit(merge); 199 Revisit(merge);
200 return Change(node, machine()->Float64Abs(), vtrue); 200 return Change(node, machine()->Float64Abs(), vtrue);
201 } 201 }
202 } 202 }
203 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) && 203 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
204 machine()->HasFloat64Min()) { 204 machine()->Float64Min().IsSupported()) {
205 // We might now be able to further reduce the {merge} node. 205 // We might now be able to further reduce the {merge} node.
206 Revisit(merge); 206 Revisit(merge);
207 return Change(node, machine()->Float64Min(), vtrue, vfalse); 207 return Change(node, machine()->Float64Min().op(), vtrue, vfalse);
208 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) && 208 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
209 machine()->HasFloat64Max()) { 209 machine()->Float64Max().IsSupported()) {
210 // We might now be able to further reduce the {merge} node. 210 // We might now be able to further reduce the {merge} node.
211 Revisit(merge); 211 Revisit(merge);
212 return Change(node, machine()->Float64Max(), vtrue, vfalse); 212 return Change(node, machine()->Float64Max().op(), vtrue, vfalse);
213 } 213 }
214 } 214 }
215 } 215 }
216 } 216 }
217 Node* const value = node->InputAt(0); 217 Node* const value = node->InputAt(0);
218 DCHECK_NE(node, value); 218 DCHECK_NE(node, value);
219 for (int i = 1; i < input_count; ++i) { 219 for (int i = 1; i < input_count; ++i) {
220 Node* const input = node->InputAt(i); 220 Node* const input = node->InputAt(i);
221 if (input == node) { 221 if (input == node) {
222 // Ignore redundant inputs. 222 // Ignore redundant inputs.
(...skipping 26 matching lines...) Expand all
249 case IrOpcode::kFloat32LessThan: { 249 case IrOpcode::kFloat32LessThan: {
250 Float32BinopMatcher mcond(cond); 250 Float32BinopMatcher mcond(cond);
251 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) && 251 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
252 vfalse->opcode() == IrOpcode::kFloat32Sub) { 252 vfalse->opcode() == IrOpcode::kFloat32Sub) {
253 Float32BinopMatcher mvfalse(vfalse); 253 Float32BinopMatcher mvfalse(vfalse);
254 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) { 254 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
255 return Change(node, machine()->Float32Abs(), vtrue); 255 return Change(node, machine()->Float32Abs(), vtrue);
256 } 256 }
257 } 257 }
258 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) && 258 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
259 machine()->HasFloat32Min()) { 259 machine()->Float32Min().IsSupported()) {
260 return Change(node, machine()->Float32Min(), vtrue, vfalse); 260 return Change(node, machine()->Float32Min().op(), vtrue, vfalse);
261 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) && 261 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
262 machine()->HasFloat32Max()) { 262 machine()->Float32Max().IsSupported()) {
263 return Change(node, machine()->Float32Max(), vtrue, vfalse); 263 return Change(node, machine()->Float32Max().op(), vtrue, vfalse);
264 } 264 }
265 break; 265 break;
266 } 266 }
267 case IrOpcode::kFloat64LessThan: { 267 case IrOpcode::kFloat64LessThan: {
268 Float64BinopMatcher mcond(cond); 268 Float64BinopMatcher mcond(cond);
269 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) && 269 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
270 vfalse->opcode() == IrOpcode::kFloat64Sub) { 270 vfalse->opcode() == IrOpcode::kFloat64Sub) {
271 Float64BinopMatcher mvfalse(vfalse); 271 Float64BinopMatcher mvfalse(vfalse);
272 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) { 272 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
273 return Change(node, machine()->Float64Abs(), vtrue); 273 return Change(node, machine()->Float64Abs(), vtrue);
274 } 274 }
275 } 275 }
276 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) && 276 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
277 machine()->HasFloat64Min()) { 277 machine()->Float64Min().IsSupported()) {
278 return Change(node, machine()->Float64Min(), vtrue, vfalse); 278 return Change(node, machine()->Float64Min().op(), vtrue, vfalse);
279 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) && 279 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
280 machine()->HasFloat64Max()) { 280 machine()->Float64Max().IsSupported()) {
281 return Change(node, machine()->Float64Max(), vtrue, vfalse); 281 return Change(node, machine()->Float64Max().op(), vtrue, vfalse);
282 } 282 }
283 break; 283 break;
284 } 284 }
285 default: 285 default:
286 break; 286 break;
287 } 287 }
288 return NoChange(); 288 return NoChange();
289 } 289 }
290 290
291 291
(...skipping 11 matching lines...) Expand all
303 node->set_op(op); 303 node->set_op(op);
304 node->ReplaceInput(0, a); 304 node->ReplaceInput(0, a);
305 node->ReplaceInput(1, b); 305 node->ReplaceInput(1, b);
306 node->TrimInputCount(2); 306 node->TrimInputCount(2);
307 return Changed(node); 307 return Changed(node);
308 } 308 }
309 309
310 } // namespace compiler 310 } // namespace compiler
311 } // namespace internal 311 } // namespace internal
312 } // namespace v8 312 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-intrinsic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698