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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 | 406 |
407 MUST_USE_RESULT | 407 MUST_USE_RESULT |
408 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( | 408 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( |
409 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { | 409 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { |
410 if (!receiver->IsJSArray()) return NULL; | 410 if (!receiver->IsJSArray()) return NULL; |
411 JSArray* array = JSArray::cast(receiver); | 411 JSArray* array = JSArray::cast(receiver); |
412 HeapObject* elms = array->elements(); | 412 HeapObject* elms = array->elements(); |
413 Map* map = elms->map(); | 413 Map* map = elms->map(); |
414 if (map == heap->fixed_array_map()) { | 414 if (map == heap->fixed_array_map()) { |
415 if (args == NULL || !array->HasFastSmiOnlyElements()) { | 415 if (array->HasFastElements()) return elms; |
| 416 if (args == NULL) { |
| 417 if (array->HasFastDoubleElements()) { |
| 418 ASSERT(elms == heap->empty_fixed_array()); |
| 419 MaybeObject* maybe_transition = |
| 420 array->TransitionElementsKind(FAST_ELEMENTS); |
| 421 if (maybe_transition->IsFailure()) return maybe_transition; |
| 422 } |
416 return elms; | 423 return elms; |
417 } | 424 } |
418 } else if (map == heap->fixed_cow_array_map()) { | 425 } else if (map == heap->fixed_cow_array_map()) { |
419 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); | 426 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); |
420 if (args == NULL || !array->HasFastSmiOnlyElements() || | 427 if (args == NULL || array->HasFastElements() || |
421 maybe_writable_result->IsFailure()) { | 428 maybe_writable_result->IsFailure()) { |
422 return maybe_writable_result; | 429 return maybe_writable_result; |
423 } | 430 } |
424 } else { | 431 } else { |
425 return NULL; | 432 return NULL; |
426 } | 433 } |
427 | 434 |
428 // Need to ensure that the arguments passed in args can be contained in | 435 // Need to ensure that the arguments passed in args can be contained in |
429 // the array. | 436 // the array. |
430 int args_length = args->length(); | 437 int args_length = args->length(); |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 return Handle<Code>(code_address); \ | 1680 return Handle<Code>(code_address); \ |
1674 } | 1681 } |
1675 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1682 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1676 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1683 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1677 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1684 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1678 #undef DEFINE_BUILTIN_ACCESSOR_C | 1685 #undef DEFINE_BUILTIN_ACCESSOR_C |
1679 #undef DEFINE_BUILTIN_ACCESSOR_A | 1686 #undef DEFINE_BUILTIN_ACCESSOR_A |
1680 | 1687 |
1681 | 1688 |
1682 } } // namespace v8::internal | 1689 } } // namespace v8::internal |
OLD | NEW |