OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 assertEquals(2.3, o2.d.b); | 125 assertEquals(2.3, o2.d.b); |
126 assertEquals(3.0, o2.d.c); | 126 assertEquals(3.0, o2.d.c); |
127 assertEquals(4.5, o2.e); | 127 assertEquals(4.5, o2.e); |
128 } | 128 } |
129 func(); func(); | 129 func(); func(); |
130 %OptimizeFunctionOnNextCall(func); | 130 %OptimizeFunctionOnNextCall(func); |
131 func(); func(); | 131 func(); func(); |
132 delete deopt.deopt; | 132 delete deopt.deopt; |
133 func(); func(); | 133 func(); func(); |
134 })(); | 134 })(); |
| 135 |
| 136 |
| 137 // Test deoptimization with captured objects on operand stack. |
| 138 (function testDeoptOperand() { |
| 139 var deopt = { deopt:false }; |
| 140 function constructor1() { |
| 141 this.a = 1.0; |
| 142 this.b = 2.3; |
| 143 deopt.deopt; |
| 144 assertEquals(1.0, this.a); |
| 145 assertEquals(2.3, this.b); |
| 146 this.b = 2.7; |
| 147 this.c = 3.0; |
| 148 this.d = 4.5; |
| 149 } |
| 150 function constructor2() { |
| 151 this.e = 5.0; |
| 152 this.f = new constructor1(); |
| 153 assertEquals(1.0, this.f.a); |
| 154 assertEquals(2.7, this.f.b); |
| 155 assertEquals(3.0, this.f.c); |
| 156 assertEquals(4.5, this.f.d); |
| 157 assertEquals(5.0, this.e); |
| 158 this.e = 5.9; |
| 159 this.g = 6.7; |
| 160 } |
| 161 function func() { |
| 162 var o = new constructor2(); |
| 163 assertEquals(1.0, o.f.a); |
| 164 assertEquals(2.7, o.f.b); |
| 165 assertEquals(3.0, o.f.c); |
| 166 assertEquals(4.5, o.f.d); |
| 167 assertEquals(5.9, o.e); |
| 168 assertEquals(6.7, o.g); |
| 169 } |
| 170 func(); func(); |
| 171 %OptimizeFunctionOnNextCall(func); |
| 172 func(); func(); |
| 173 delete deopt.deopt; |
| 174 func(); func(); |
| 175 })(); |
OLD | NEW |