Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 | 436 |
| 437 | 437 |
| 438 MUST_USE_RESULT | 438 MUST_USE_RESULT |
| 439 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( | 439 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( |
| 440 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { | 440 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { |
| 441 if (!receiver->IsJSArray()) return NULL; | 441 if (!receiver->IsJSArray()) return NULL; |
| 442 JSArray* array = JSArray::cast(receiver); | 442 JSArray* array = JSArray::cast(receiver); |
| 443 HeapObject* elms = array->elements(); | 443 HeapObject* elms = array->elements(); |
| 444 Map* map = elms->map(); | 444 Map* map = elms->map(); |
| 445 if (map == heap->fixed_array_map()) { | 445 if (map == heap->fixed_array_map()) { |
| 446 if (args == NULL || !array->HasFastSmiOnlyElements()) { | 446 if (array->HasFastElements()) return elms; |
| 447 if (args == NULL) { | |
| 448 if (array->HasFastDoubleElements()) { | |
|
Michael Starzinger
2012/07/20 13:39:40
As discussed offline: This fix might not even be n
| |
| 449 ASSERT(elms == heap->empty_fixed_array()); | |
| 450 MaybeObject* maybe_transition = | |
| 451 array->TransitionElementsKind(FAST_ELEMENTS); | |
| 452 if (maybe_transition->IsFailure()) return maybe_transition; | |
| 453 } | |
| 447 return elms; | 454 return elms; |
| 448 } | 455 } |
| 449 } else if (map == heap->fixed_cow_array_map()) { | 456 } else if (map == heap->fixed_cow_array_map()) { |
| 450 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); | 457 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); |
| 451 if (args == NULL || !array->HasFastSmiOnlyElements() || | 458 if (args == NULL || array->HasFastElements() || |
| 452 maybe_writable_result->IsFailure()) { | 459 maybe_writable_result->IsFailure()) { |
| 453 return maybe_writable_result; | 460 return maybe_writable_result; |
| 454 } | 461 } |
| 455 } else { | 462 } else { |
| 456 return NULL; | 463 return NULL; |
| 457 } | 464 } |
| 458 | 465 |
| 459 // Need to ensure that the arguments passed in args can be contained in | 466 // Need to ensure that the arguments passed in args can be contained in |
| 460 // the array. | 467 // the array. |
| 461 int args_length = args->length(); | 468 int args_length = args->length(); |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1828 return Handle<Code>(code_address); \ | 1835 return Handle<Code>(code_address); \ |
| 1829 } | 1836 } |
| 1830 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1837 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1831 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1838 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1832 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1839 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1833 #undef DEFINE_BUILTIN_ACCESSOR_C | 1840 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1834 #undef DEFINE_BUILTIN_ACCESSOR_A | 1841 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1835 | 1842 |
| 1836 | 1843 |
| 1837 } } // namespace v8::internal | 1844 } } // namespace v8::internal |
| OLD | NEW |