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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 deopt.deopt; | 294 deopt.deopt; |
295 assertEquals(99, o1.x); | 295 assertEquals(99, o1.x); |
296 assertEquals(99, o2.b.x); | 296 assertEquals(99, o2.b.x); |
297 } | 297 } |
298 deep(); deep(); | 298 deep(); deep(); |
299 %OptimizeFunctionOnNextCall(deep); | 299 %OptimizeFunctionOnNextCall(deep); |
300 deep(); deep(); | 300 deep(); deep(); |
301 delete deopt.deopt; | 301 delete deopt.deopt; |
302 deep(); deep(); | 302 deep(); deep(); |
303 })(); | 303 })(); |
| 304 |
| 305 |
| 306 // Test materialization of a field that requires a Smi value. |
| 307 (function testSmiField() { |
| 308 var deopt = { deopt:false }; |
| 309 function constructor() { |
| 310 this.x = 1; |
| 311 } |
| 312 function field(x) { |
| 313 var o = new constructor(); |
| 314 o.x = x; |
| 315 deopt.deopt |
| 316 assertEquals(x, o.x); |
| 317 } |
| 318 field(1); field(2); |
| 319 %OptimizeFunctionOnNextCall(field); |
| 320 field(3); field(4); |
| 321 delete deopt.deopt; |
| 322 field(5.5); field(6.5); |
| 323 })(); |
| 324 |
| 325 |
| 326 // Test materialization of a field that requires a heap object value. |
| 327 (function testHeapObjectField() { |
| 328 var deopt = { deopt:false }; |
| 329 function constructor() { |
| 330 this.x = {}; |
| 331 } |
| 332 function field(x) { |
| 333 var o = new constructor(); |
| 334 o.x = x; |
| 335 deopt.deopt |
| 336 assertEquals(x, o.x); |
| 337 } |
| 338 field({}); field({}); |
| 339 %OptimizeFunctionOnNextCall(field); |
| 340 field({}); field({}); |
| 341 delete deopt.deopt; |
| 342 field(1); field(2); |
| 343 })(); |
OLD | NEW |