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

Side by Side Diff: test/mjsunit/compiler/math-mul.js

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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 // Flags: --allow-natives-syntax 5 // Flags: --allow-natives-syntax
6 6
7 // For TurboFan, make sure we can eliminate the -0 return value check 7 // For TurboFan, make sure we can eliminate the -0 return value check
8 // by recognizing a constant value. 8 // by recognizing a constant value.
9 function gotaconstant(y) { return 15 * y; } 9 function gotaconstant(y) { return 15 * y; }
10 assertEquals(45, gotaconstant(3)); 10 assertEquals(45, gotaconstant(3));
(...skipping 17 matching lines...) Expand all
28 28
29 assertEquals(-0, test(-3, 0)); 29 assertEquals(-0, test(-3, 0));
30 assertEquals(-0, test(0, -0)); 30 assertEquals(-0, test(0, -0));
31 31
32 32
33 const SMI_MAX = (1 << 29) - 1 + (1 << 29); // Create without overflowing. 33 const SMI_MAX = (1 << 29) - 1 + (1 << 29); // Create without overflowing.
34 const SMI_MIN = -SMI_MAX - 1; // Create without overflowing. 34 const SMI_MIN = -SMI_MAX - 1; // Create without overflowing.
35 35
36 // multiply by 3 to avoid compiler optimizations that convert 2*x to x + x. 36 // multiply by 3 to avoid compiler optimizations that convert 2*x to x + x.
37 assertEquals(SMI_MAX + SMI_MAX + SMI_MAX, test(SMI_MAX, 3)); 37 assertEquals(SMI_MAX + SMI_MAX + SMI_MAX, test(SMI_MAX, 3));
38
39 // Verify that strength reduction will reduce the -0 check quite a bit
40 // if we have a negative integer constant.
41 function negtest(y) { return -3 * y; }
42 assertEquals(-12, negtest(4));
43 assertEquals(-12, negtest(4));
44 %OptimizeFunctionOnNextCall(negtest);
45 negtest(4);
46
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698