| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Case: new Array(length) as allocation site | 227 // Case: new Array(length) as allocation site |
| 228 obj = newarraycase_length_smidouble(1); | 228 obj = newarraycase_length_smidouble(1); |
| 229 assertKind(elements_kind.fast_smi_only, obj); | 229 assertKind(elements_kind.fast_smi_only, obj); |
| 230 obj = newarraycase_length_smidouble(1.5); | 230 obj = newarraycase_length_smidouble(1.5); |
| 231 assertKind(elements_kind.fast_double, obj); | 231 assertKind(elements_kind.fast_double, obj); |
| 232 obj = newarraycase_length_smidouble(2); | 232 obj = newarraycase_length_smidouble(2); |
| 233 assertKind(elements_kind.fast_double, obj); | 233 assertKind(elements_kind.fast_double, obj); |
| 234 | 234 |
| 235 // Try to continue the transition to fast object. This won't work for | 235 // Try to continue the transition to fast object. |
| 236 // constructed arrays because constructor dispatch is done on the | 236 // TODO(mvstanton): re-enable commented out code when |
| 237 // elements kind, and a DOUBLE array constructor won't create an allocation | 237 // FLAG_pretenuring_call_new is turned on in the build. |
| 238 // memento. | |
| 239 obj = newarraycase_length_smidouble("coates"); | 238 obj = newarraycase_length_smidouble("coates"); |
| 240 assertKind(elements_kind.fast, obj); | 239 assertKind(elements_kind.fast, obj); |
| 241 obj = newarraycase_length_smidouble(2); | 240 obj = newarraycase_length_smidouble(2); |
| 242 assertKind(elements_kind.fast_double, obj); | 241 // assertKind(elements_kind.fast, obj); |
| 243 | 242 |
| 244 function newarraycase_length_smiobj(value) { | 243 function newarraycase_length_smiobj(value) { |
| 245 var a = new Array(3); | 244 var a = new Array(3); |
| 246 a[0] = value; | 245 a[0] = value; |
| 247 return a; | 246 return a; |
| 248 } | 247 } |
| 249 | 248 |
| 250 // Case: new Array(<length>) as allocation site, smi->fast | 249 // Case: new Array(<length>) as allocation site, smi->fast |
| 251 obj = newarraycase_length_smiobj(1); | 250 obj = newarraycase_length_smiobj(1); |
| 252 assertKind(elements_kind.fast_smi_only, obj); | 251 assertKind(elements_kind.fast_smi_only, obj); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 obj[0][0] = 3.5; | 481 obj[0][0] = 3.5; |
| 483 obj[1][0][0] = "goodbye"; | 482 obj[1][0][0] = "goodbye"; |
| 484 assertKind(elements_kind.fast_double, obj[0]); | 483 assertKind(elements_kind.fast_double, obj[0]); |
| 485 assertKind(elements_kind.fast, obj[1][0]); | 484 assertKind(elements_kind.fast, obj[1][0]); |
| 486 | 485 |
| 487 obj = get_deep_nested_literal(); | 486 obj = get_deep_nested_literal(); |
| 488 assertKind(elements_kind.fast_double, obj[0]); | 487 assertKind(elements_kind.fast_double, obj[0]); |
| 489 assertKind(elements_kind.fast, obj[1][0]); | 488 assertKind(elements_kind.fast, obj[1][0]); |
| 490 })(); | 489 })(); |
| 491 } | 490 } |
| OLD | NEW |