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

Unified Diff: test/mjsunit/double-intrinsics.js

Issue 178583006: Introduce intrinsics for double values in Javascript. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/double-intrinsics.js
diff --git a/test/mjsunit/double-intrinsics.js b/test/mjsunit/double-intrinsics.js
new file mode 100644
index 0000000000000000000000000000000000000000..dd98ad745d501f45ec4affd9418b122c36fe1e04
--- /dev/null
+++ b/test/mjsunit/double-intrinsics.js
@@ -0,0 +1,26 @@
+// Copyright 2014 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
+
+function assertDoubleBits(hi, lo, x) {
+ assertEquals(x, %_ConstructDouble(hi, lo));
+ assertEquals(hi | 0, %_DoubleHi(x));
+ assertEquals(lo | 0, %_DoubleLo(x));
+}
+
+function test() {
+ assertDoubleBits(0x7ff80000, 0x00000000, NaN);
+ assertDoubleBits(0x7ff00000, 0x00000000, Infinity);
+ assertDoubleBits(0xfff00000, 0x00000000, -Infinity);
+ assertDoubleBits(0x80000000, 0x00000000, -0);
+ assertDoubleBits(0x400921fb, 0x54442d18, Math.PI);
+ assertDoubleBits(0xc005bf0a, 0x8b145769, -Math.E);
+ assertDoubleBits(0xbfe80000, 0x00000000, -0.75);
+}
+
+test();
+test();
+%OptimizeFunctionOnNextCall(test);
+test();
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698