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

Side by Side Diff: test/mjsunit/compiler/turbo-number-feedback.js

Issue 1921563002: [turbofan] Initial version of number type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax --turbo-type-feedback
6
7 (function AddSubtractSmis() {
8 function f0(a, b, c) {
9 return a + b - c;
10 }
11
12 assertEquals(4, f0(3, 2, 1));
13 assertEquals(4, f0(3, 2, 1));
14 %OptimizeFunctionOnNextCall(f0);
15 assertEquals(4, f0(3, 2, 1));
16 })();
17
18 (function AddSubtractDoubles() {
19 function f1(a, b, c) {
20 return a + b - c;
21 }
22
23 assertEquals(4.5, f1(3.5, 2.5, 1.5));
24 assertEquals(4.5, f1(3.5, 2.5, 1.5));
25 %OptimizeFunctionOnNextCall(f1);
26 assertEquals(4.5, f1(3.5, 2.5, 1.5));
27 assertEquals(4, f1(3, 2, 1));
28 assertTrue(isNaN(f1(3, 2, undefined)));
29 assertTrue(isNaN(f1(3, undefined, 1)));
30 })();
31
32 (function CheckUint32ToInt32Conv() {
33 function f2(a) {
34 return (a >>> 0) + 1;
35 }
36
37 assertEquals(1, f2(0));
38 assertEquals(1, f2(0));
39 %OptimizeFunctionOnNextCall(f2);
40 assertEquals(1, f2(0));
41 assertEquals(4294967295, f2(-2));
42 })();
43
44 (function CheckFloat64ToInt32Conv() {
45 function f3(a, b) {
46 var x = 0;
47 if (a) {
48 x = 0.5;
49 }
50 return x + b;
51 }
52
53 assertEquals(1, f3(0, 1));
54 assertEquals(1, f3(0, 1));
55 %OptimizeFunctionOnNextCall(f3);
56 assertEquals(1, f3(0, 1));
57 assertEquals(1.5, f3(1, 1));
58 })();
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-representation-change.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698