| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 function assign1(x) { x += 1; o.x = x; } | 34 function assign1(x) { x += 1; o.x = x; } |
| 35 assign1(max_smi); | 35 assign1(max_smi); |
| 36 assertEquals(max_smi + 1, o.x); | 36 assertEquals(max_smi + 1, o.x); |
| 37 | 37 |
| 38 assign1(1.1); | 38 assign1(1.1); |
| 39 assertEquals(2.1, o.x); | 39 assertEquals(2.1, o.x); |
| 40 | 40 |
| 41 | 41 |
| 42 // Test deopt with count operation on named property. | 42 // Test deopt with count operation on named property. |
| 43 function assign2(p) { p.x += 1 } | 43 function assign2(p) { p.x += 1; } |
| 44 | 44 |
| 45 o.x = "42"; | 45 o.x = "42"; |
| 46 assign2(o); | 46 assign2(o); |
| 47 assertEquals("421", o.x); | 47 assertEquals("421", o.x); |
| 48 | 48 |
| 49 var s = max_smi - 10; | 49 var s = max_smi - 10; |
| 50 o.x = s; | 50 o.x = s; |
| 51 for(var i = 0; i < 20; i++) { | 51 for(var i = 0; i < 20; i++) { |
| 52 assign2(o); | 52 assign2(o); |
| 53 if (i == 4) { | 53 if (i == 4) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 %OptimizeFunctionOnNextCall(assign9); | 120 %OptimizeFunctionOnNextCall(assign9); |
| 121 q[0] = 42; | 121 q[0] = 42; |
| 122 assertEquals(44, assign9(q, 1)); | 122 assertEquals(44, assign9(q, 1)); |
| 123 | 123 |
| 124 q[0] = 42; | 124 q[0] = 42; |
| 125 assertEquals(44.1, assign9(q, 1.1)); | 125 assertEquals(44.1, assign9(q, 1.1)); |
| 126 q[0] = 42.1; | 126 q[0] = 42.1; |
| 127 assertEquals(44.1, assign9(q, 1)); | 127 assertEquals(44.1, assign9(q, 1)); |
| 128 | 128 |
| 129 // Test deopt because of a failed map check on the load. | 129 // Test deopt because of a failed map check on the load. |
| 130 function assign10(p) { return p.x += 1 } | 130 function assign10(p) { return p.x += 1; } |
| 131 var g1 = {x:0}; | 131 var g1 = {x:0}; |
| 132 var g2 = {y:0, x:42}; | 132 var g2 = {y:0, x:42}; |
| 133 for (var i = 0; i < 5; ++i) { | 133 for (var i = 0; i < 5; ++i) { |
| 134 g1.x = 42; | 134 g1.x = 42; |
| 135 assertEquals(43, assign10(g1)); | 135 assertEquals(43, assign10(g1)); |
| 136 assertEquals(43, g1.x); | 136 assertEquals(43, g1.x); |
| 137 } | 137 } |
| 138 %OptimizeFunctionOnNextCall(assign10); | 138 %OptimizeFunctionOnNextCall(assign10); |
| 139 g1.x = 42; | 139 g1.x = 42; |
| 140 assertEquals(43, assign10(g1)); | 140 assertEquals(43, assign10(g1)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 171 assign12(o); | 171 assign12(o); |
| 172 } | 172 } |
| 173 %OptimizeFunctionOnNextCall(assign12); | 173 %OptimizeFunctionOnNextCall(assign12); |
| 174 o[0] = "a"; | 174 o[0] = "a"; |
| 175 assign12(o); | 175 assign12(o); |
| 176 | 176 |
| 177 assertEquals("a11", assign12(o)); | 177 assertEquals("a11", assign12(o)); |
| 178 o[0] = g4; | 178 o[0] = g4; |
| 179 assertEquals(43, assign12(o)); | 179 assertEquals(43, assign12(o)); |
| 180 assertEquals("bar", o.y); | 180 assertEquals("bar", o.y); |
| OLD | NEW |