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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 assertEquals(3, oob(cons1, false)); | 264 assertEquals(3, oob(cons1, false)); |
265 assertEquals(3, oob(cons1, false)); | 265 assertEquals(3, oob(cons1, false)); |
266 assertEquals(7, oob(cons2, true)); | 266 assertEquals(7, oob(cons2, true)); |
267 assertEquals(7, oob(cons2, true)); | 267 assertEquals(7, oob(cons2, true)); |
268 gc(); // Clears type feedback of constructor call. | 268 gc(); // Clears type feedback of constructor call. |
269 assertEquals(7, oob(cons2, true)); | 269 assertEquals(7, oob(cons2, true)); |
270 assertEquals(7, oob(cons2, true)); | 270 assertEquals(7, oob(cons2, true)); |
271 %OptimizeFunctionOnNextCall(oob); | 271 %OptimizeFunctionOnNextCall(oob); |
272 assertEquals(7, oob(cons2, true)); | 272 assertEquals(7, oob(cons2, true)); |
273 })(); | 273 })(); |
| 274 |
| 275 |
| 276 // Test non-shallow nested graph of captured objects. |
| 277 (function testDeep() { |
| 278 var deopt = { deopt:false }; |
| 279 function constructor1() { |
| 280 this.x = 23; |
| 281 } |
| 282 function constructor2(nested) { |
| 283 this.a = 17; |
| 284 this.b = nested; |
| 285 this.c = 42; |
| 286 } |
| 287 function deep() { |
| 288 var o1 = new constructor1(); |
| 289 var o2 = new constructor2(o1); |
| 290 assertEquals(17, o2.a); |
| 291 assertEquals(23, o2.b.x); |
| 292 assertEquals(42, o2.c); |
| 293 o1.x = 99; |
| 294 deopt.deopt; |
| 295 assertEquals(99, o1.x); |
| 296 assertEquals(99, o2.b.x); |
| 297 } |
| 298 deep(); deep(); |
| 299 %OptimizeFunctionOnNextCall(deep); |
| 300 deep(); deep(); |
| 301 delete deopt.deopt; |
| 302 deep(); deep(); |
| 303 })(); |
OLD | NEW |