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

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

Issue 2167643002: [Turbofan] Make the -0 deopt case more efficient in multiplication. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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
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/machine-operator-reducer.h" 5 #include "src/compiler/machine-operator-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 case IrOpcode::kInt32Mod: 257 case IrOpcode::kInt32Mod:
258 return ReduceInt32Mod(node); 258 return ReduceInt32Mod(node);
259 case IrOpcode::kUint32Mod: 259 case IrOpcode::kUint32Mod:
260 return ReduceUint32Mod(node); 260 return ReduceUint32Mod(node);
261 case IrOpcode::kInt32LessThan: { 261 case IrOpcode::kInt32LessThan: {
262 Int32BinopMatcher m(node); 262 Int32BinopMatcher m(node);
263 if (m.IsFoldable()) { // K < K => K 263 if (m.IsFoldable()) { // K < K => K
264 return ReplaceBool(m.left().Value() < m.right().Value()); 264 return ReplaceBool(m.left().Value() < m.right().Value());
265 } 265 }
266 if (m.LeftEqualsRight()) return ReplaceBool(false); // x < x => false 266 if (m.LeftEqualsRight()) return ReplaceBool(false); // x < x => false
267 if (m.left().IsWord32Or() && m.right().Is(0)) { // (X | Y) < 0 ...
268 // This targets the check for -0 after multiplication.
Benedikt Meurer 2016/07/20 17:37:44 This is a detail that is not necessarily relevant.
269 Int32BinopMatcher mleftmatcher(m.left().node());
270 if ((mleftmatcher.left().HasValue() &&
Benedikt Meurer 2016/07/20 17:37:44 Please add a IsNegative() helper to the Int32Match
271 mleftmatcher.left().Value() < 0) ||
272 (mleftmatcher.right().HasValue() &&
273 mleftmatcher.right().Value() < 0)) {
274 return ReplaceBool(true); // and X < 0 or Y < 0 => true
275 }
276 }
267 break; 277 break;
268 } 278 }
269 case IrOpcode::kInt32LessThanOrEqual: { 279 case IrOpcode::kInt32LessThanOrEqual: {
270 Int32BinopMatcher m(node); 280 Int32BinopMatcher m(node);
271 if (m.IsFoldable()) { // K <= K => K 281 if (m.IsFoldable()) { // K <= K => K
272 return ReplaceBool(m.left().Value() <= m.right().Value()); 282 return ReplaceBool(m.left().Value() <= m.right().Value());
273 } 283 }
274 if (m.LeftEqualsRight()) return ReplaceBool(true); // x <= x => true 284 if (m.LeftEqualsRight()) return ReplaceBool(true); // x <= x => true
275 break; 285 break;
276 } 286 }
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 MachineOperatorBuilder* MachineOperatorReducer::machine() const { 1252 MachineOperatorBuilder* MachineOperatorReducer::machine() const {
1243 return jsgraph()->machine(); 1253 return jsgraph()->machine();
1244 } 1254 }
1245 1255
1246 1256
1247 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } 1257 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
1248 1258
1249 } // namespace compiler 1259 } // namespace compiler
1250 } // namespace internal 1260 } // namespace internal
1251 } // namespace v8 1261 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/math-mul.js » ('j') | test/unittests/compiler/machine-operator-reducer-unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698