| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Test operations that involve one or more constants. | 28 // Test operations that involve one or more constants. |
| 29 // The code generator now handles compile-time constants specially. | 29 // The code generator now handles compile-time constants specially. |
| 30 // Test the code generated when operands are known at compile time | 30 // Test the code generated when operands are known at compile time |
| 31 | 31 |
| 32 // Flags: --legacy-const |
| 33 |
| 32 // Test count operations involving constants | 34 // Test count operations involving constants |
| 33 function test_count() { | 35 function test_count() { |
| 34 var x = "foo"; | 36 var x = "foo"; |
| 35 var y = "3"; | 37 var y = "3"; |
| 36 | 38 |
| 37 x += x++; // ++ and -- apply ToNumber to their operand, even for postfix. | 39 x += x++; // ++ and -- apply ToNumber to their operand, even for postfix. |
| 38 assertEquals(x, "fooNaN", "fooNaN test"); | 40 assertEquals(x, "fooNaN", "fooNaN test"); |
| 39 x = "luft"; | 41 x = "luft"; |
| 40 x += ++x; | 42 x += ++x; |
| 41 assertEquals(x, "luftNaN", "luftNaN test"); | 43 assertEquals(x, "luftNaN", "luftNaN test"); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 x = 123; | 225 x = 123; |
| 224 // Answer is non-smi and lhs of << is a temporary heap number that we think | 226 // Answer is non-smi and lhs of << is a temporary heap number that we think |
| 225 // we can overwrite (but we can't because it's a Smi). | 227 // we can overwrite (but we can't because it's a Smi). |
| 226 assertEquals(1073741824, (x * x) << 30); | 228 assertEquals(1073741824, (x * x) << 30); |
| 227 } | 229 } |
| 228 | 230 |
| 229 | 231 |
| 230 test(); | 232 test(); |
| 231 BoolTest(); | 233 BoolTest(); |
| 232 ShiftTest(); | 234 ShiftTest(); |
| OLD | NEW |