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

Side by Side Diff: test/mjsunit/smi-ops.js

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/simple-constructor.js ('k') | test/mjsunit/smi-ops-inlined.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 assertTrue(v == v); 228 assertTrue(v == v);
229 assertTrue(v === v); 229 assertTrue(v === v);
230 assertTrue(v <= v); 230 assertTrue(v <= v);
231 assertTrue(v >= v); 231 assertTrue(v >= v);
232 assertFalse(v < v); 232 assertFalse(v < v);
233 assertFalse(v > v); 233 assertFalse(v > v);
234 assertFalse(v != v); 234 assertFalse(v != v);
235 assertFalse(v !== v); 235 assertFalse(v !== v);
236 236
237 // Right hand side of unary minus is overwritable. 237 // Right hand side of unary minus is overwritable.
238 v = 1.5 238 v = 1.5;
239 assertEquals(-2.25, -(v * v)); 239 assertEquals(-2.25, -(v * v));
240 240
241 // Smi input to bitop gives non-smi result where the rhs is a float that 241 // Smi input to bitop gives non-smi result where the rhs is a float that
242 // can be overwritten. 242 // can be overwritten.
243 var x1 = 0x10000000; 243 var x1 = 0x10000000;
244 var x2 = 0x40000002; 244 var x2 = 0x40000002;
245 var x3 = 0x40000000; 245 var x3 = 0x40000000;
246 assertEquals(0x40000000, x1 << (x2 - x3), "0x10000000<<1(1)"); 246 assertEquals(0x40000000, x1 << (x2 - x3), "0x10000000<<1(1)");
247 247
248 // Smi input to bitop gives non-smi result where the rhs could be overwritten 248 // Smi input to bitop gives non-smi result where the rhs could be overwritten
249 // if it were a float, but it isn't. 249 // if it were a float, but it isn't.
250 x1 = 0x10000000 250 x1 = 0x10000000;
251 x2 = 4 251 x2 = 4;
252 x3 = 2 252 x3 = 2;
253 assertEquals(0x40000000, x1 << (x2 - x3), "0x10000000<<2(2)"); 253 assertEquals(0x40000000, x1 << (x2 - x3), "0x10000000<<2(2)");
254 254
255 255
256 // Test shift operators on non-smi inputs, giving smi and non-smi results. 256 // Test shift operators on non-smi inputs, giving smi and non-smi results.
257 function testShiftNonSmis() { 257 function testShiftNonSmis() {
258 var pos_non_smi = 2000000000; 258 var pos_non_smi = 2000000000;
259 var neg_non_smi = -pos_non_smi; 259 var neg_non_smi = -pos_non_smi;
260 var pos_smi = 1000000000; 260 var pos_smi = 1000000000;
261 var neg_smi = -pos_smi; 261 var neg_smi = -pos_smi;
262 262
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 assertEquals(24, LeftShiftThreeBy(67)); 695 assertEquals(24, LeftShiftThreeBy(67));
696 assertEquals(24, LeftShiftThreeBy(-29)); 696 assertEquals(24, LeftShiftThreeBy(-29));
697 697
698 // Regression test for a bug in the ARM code generator. For some register 698 // Regression test for a bug in the ARM code generator. For some register
699 // allocations we got the Smi overflow case wrong. 699 // allocations we got the Smi overflow case wrong.
700 function f(x, y) { return y + ( 1 << (x & 31)); } 700 function f(x, y) { return y + ( 1 << (x & 31)); }
701 assertEquals(-2147483647, f(31, 1)); 701 assertEquals(-2147483647, f(31, 1));
702 702
703 // Regression test for correct handling of overflow in smi comparison. 703 // Regression test for correct handling of overflow in smi comparison.
704 assertTrue(-0x40000000 < 42); 704 assertTrue(-0x40000000 < 42);
OLDNEW
« no previous file with comments | « test/mjsunit/simple-constructor.js ('k') | test/mjsunit/smi-ops-inlined.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698