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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/compiler/turbo-number-feedback.js
diff --git a/test/mjsunit/compiler/turbo-number-feedback.js b/test/mjsunit/compiler/turbo-number-feedback.js
new file mode 100644
index 0000000000000000000000000000000000000000..059a0ca03151e158e76b155261a8bc1ced354ac4
--- /dev/null
+++ b/test/mjsunit/compiler/turbo-number-feedback.js
@@ -0,0 +1,58 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --turbo-type-feedback
+
+(function AddSubtractSmis() {
+ function f0(a, b, c) {
+ return a + b - c;
+ }
+
+ assertEquals(4, f0(3, 2, 1));
+ assertEquals(4, f0(3, 2, 1));
+ %OptimizeFunctionOnNextCall(f0);
+ assertEquals(4, f0(3, 2, 1));
+})();
+
+(function AddSubtractDoubles() {
+ function f1(a, b, c) {
+ return a + b - c;
+ }
+
+ assertEquals(4.5, f1(3.5, 2.5, 1.5));
+ assertEquals(4.5, f1(3.5, 2.5, 1.5));
+ %OptimizeFunctionOnNextCall(f1);
+ assertEquals(4.5, f1(3.5, 2.5, 1.5));
+ assertEquals(4, f1(3, 2, 1));
+ assertTrue(isNaN(f1(3, 2, undefined)));
+ assertTrue(isNaN(f1(3, undefined, 1)));
+})();
+
+(function CheckUint32ToInt32Conv() {
+ function f2(a) {
+ return (a >>> 0) + 1;
+ }
+
+ assertEquals(1, f2(0));
+ assertEquals(1, f2(0));
+ %OptimizeFunctionOnNextCall(f2);
+ assertEquals(1, f2(0));
+ assertEquals(4294967295, f2(-2));
+})();
+
+(function CheckFloat64ToInt32Conv() {
+ function f3(a, b) {
+ var x = 0;
+ if (a) {
+ x = 0.5;
+ }
+ return x + b;
+ }
+
+ assertEquals(1, f3(0, 1));
+ assertEquals(1, f3(0, 1));
+ %OptimizeFunctionOnNextCall(f3);
+ assertEquals(1, f3(0, 1));
+ assertEquals(1.5, f3(1, 1));
+})();
« 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