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. | |
titzer
2013/08/26 11:27:24
Do we need to test modifications of the captured o
Michael Starzinger
2013/08/26 16:15:44
Done. I added modifications of fields after the de
| |
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.c = 3.0; | |
147 this.d = 4.5; | |
148 } | |
149 function constructor2() { | |
150 this.e = 5.0; | |
151 this.f = new constructor1(); | |
152 assertEquals(1.0, this.f.a); | |
153 assertEquals(2.3, this.f.b); | |
154 assertEquals(5.0, this.e); | |
155 this.g = 6.7; | |
156 } | |
157 function func() { | |
158 var o = new constructor2(); | |
159 assertEquals(1.0, o.f.a); | |
160 assertEquals(2.3, o.f.b); | |
161 assertEquals(3.0, o.f.c); | |
162 assertEquals(4.5, o.f.d); | |
163 assertEquals(5.0, o.e); | |
164 assertEquals(6.7, o.g); | |
165 } | |
166 func(); func(); | |
167 %OptimizeFunctionOnNextCall(func); | |
168 func(); func(); | |
169 delete deopt.deopt; | |
170 func(); func(); | |
171 })(); | |
OLD | NEW |