| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 return a; | 275 return a; |
| 276 } | 276 } |
| 277 | 277 |
| 278 obj = newarraycase_list_smiobj(1); | 278 obj = newarraycase_list_smiobj(1); |
| 279 assertKind(elements_kind.fast_smi_only, obj); | 279 assertKind(elements_kind.fast_smi_only, obj); |
| 280 obj = newarraycase_list_smiobj("coates"); | 280 obj = newarraycase_list_smiobj("coates"); |
| 281 assertKind(elements_kind.fast, obj); | 281 assertKind(elements_kind.fast, obj); |
| 282 obj = newarraycase_list_smiobj(2); | 282 obj = newarraycase_list_smiobj(2); |
| 283 assertKind(elements_kind.fast, obj); | 283 assertKind(elements_kind.fast, obj); |
| 284 | 284 |
| 285 // Case: array constructor calls with out of date feedback. |
| 286 // The boilerplate should incorporate all feedback, but the input array |
| 287 // should be minimally transitioned based on immediate need. |
| 288 (function() { |
| 289 function foo(i) { |
| 290 // We have two cases, one for literals one for constructed arrays. |
| 291 var a = (i == 0) |
| 292 ? [1, 2, 3] |
| 293 : new Array(1, 2, 3); |
| 294 return a; |
| 295 } |
| 296 |
| 297 for (i = 0; i < 2; i++) { |
| 298 a = foo(i); |
| 299 b = foo(i); |
| 300 b[5] = 1; // boilerplate goes holey |
| 301 assertHoley(foo(i)); |
| 302 a[0] = 3.5; // boilerplate goes holey double |
| 303 assertKind(elements_kind.fast_double, a); |
| 304 assertNotHoley(a); |
| 305 c = foo(i); |
| 306 assertKind(elements_kind.fast_double, c); |
| 307 assertHoley(c); |
| 308 } |
| 309 })(); |
| 310 |
| 285 function newarraycase_onearg(len, value) { | 311 function newarraycase_onearg(len, value) { |
| 286 var a = new Array(len); | 312 var a = new Array(len); |
| 287 a[0] = value; | 313 a[0] = value; |
| 288 return a; | 314 return a; |
| 289 } | 315 } |
| 290 | 316 |
| 291 obj = newarraycase_onearg(5, 3.5); | 317 obj = newarraycase_onearg(5, 3.5); |
| 292 assertKind(elements_kind.fast_double, obj); | 318 assertKind(elements_kind.fast_double, obj); |
| 293 obj = newarraycase_onearg(10, 5); | 319 obj = newarraycase_onearg(10, 5); |
| 294 assertKind(elements_kind.fast_double, obj); | 320 assertKind(elements_kind.fast_double, obj); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 %ClearFunctionTypeFeedback(instanceof_check); | 373 %ClearFunctionTypeFeedback(instanceof_check); |
| 348 instanceof_check(Array); | 374 instanceof_check(Array); |
| 349 instanceof_check(Array); | 375 instanceof_check(Array); |
| 350 %OptimizeFunctionOnNextCall(instanceof_check); | 376 %OptimizeFunctionOnNextCall(instanceof_check); |
| 351 instanceof_check(Array); | 377 instanceof_check(Array); |
| 352 assertTrue(2 != %GetOptimizationStatus(instanceof_check)); | 378 assertTrue(2 != %GetOptimizationStatus(instanceof_check)); |
| 353 | 379 |
| 354 instanceof_check(realmBArray); | 380 instanceof_check(realmBArray); |
| 355 assertTrue(1 != %GetOptimizationStatus(instanceof_check)); | 381 assertTrue(1 != %GetOptimizationStatus(instanceof_check)); |
| 356 } | 382 } |
| OLD | NEW |