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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 } | 704 } |
705 | 705 |
706 int len = Smi::cast(array->length())->value(); | 706 int len = Smi::cast(array->length())->value(); |
707 if (len == 0) return heap->undefined_value(); | 707 if (len == 0) return heap->undefined_value(); |
708 | 708 |
709 // Get first element | 709 // Get first element |
710 ElementsAccessor* accessor = array->GetElementsAccessor(); | 710 ElementsAccessor* accessor = array->GetElementsAccessor(); |
711 Object* first; | 711 Object* first; |
712 MaybeObject* maybe_first = accessor->Get(receiver, array, 0, elms_obj); | 712 MaybeObject* maybe_first = accessor->Get(receiver, array, 0, elms_obj); |
713 if (!maybe_first->To(&first)) return maybe_first; | 713 if (!maybe_first->To(&first)) return maybe_first; |
| 714 if (first->IsTheHole()) { |
| 715 first = heap->undefined_value(); |
| 716 } |
714 | 717 |
715 if (!heap->lo_space()->Contains(elms_obj)) { | 718 if (!heap->lo_space()->Contains(elms_obj)) { |
716 array->set_elements(LeftTrimFixedArray(heap, elms_obj, 1)); | 719 array->set_elements(LeftTrimFixedArray(heap, elms_obj, 1)); |
717 } else { | 720 } else { |
718 // Shift the elements. | 721 // Shift the elements. |
719 if (elms_obj->IsFixedArray()) { | 722 if (elms_obj->IsFixedArray()) { |
720 FixedArray* elms = FixedArray::cast(elms_obj); | 723 FixedArray* elms = FixedArray::cast(elms_obj); |
721 AssertNoAllocation no_gc; | 724 AssertNoAllocation no_gc; |
722 MoveElements(heap, &no_gc, elms, 0, elms, 1, len - 1); | 725 MoveElements(heap, &no_gc, elms, 0, elms, 1, len - 1); |
723 elms->set(len - 1, heap->the_hole_value()); | 726 elms->set(len - 1, heap->the_hole_value()); |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 return Handle<Code>(code_address); \ | 1918 return Handle<Code>(code_address); \ |
1916 } | 1919 } |
1917 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1920 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1918 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1921 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1919 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1922 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1920 #undef DEFINE_BUILTIN_ACCESSOR_C | 1923 #undef DEFINE_BUILTIN_ACCESSOR_C |
1921 #undef DEFINE_BUILTIN_ACCESSOR_A | 1924 #undef DEFINE_BUILTIN_ACCESSOR_A |
1922 | 1925 |
1923 | 1926 |
1924 } } // namespace v8::internal | 1927 } } // namespace v8::internal |
OLD | NEW |