| 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 int len = Smi::cast(array->length())->value(); | 555 int len = Smi::cast(array->length())->value(); |
| 556 if (len == 0) return heap->undefined_value(); | 556 if (len == 0) return heap->undefined_value(); |
| 557 | 557 |
| 558 // Get first element | 558 // Get first element |
| 559 Object* first = elms->get(0); | 559 Object* first = elms->get(0); |
| 560 if (first->IsTheHole()) { | 560 if (first->IsTheHole()) { |
| 561 first = heap->undefined_value(); | 561 first = heap->undefined_value(); |
| 562 } | 562 } |
| 563 | 563 |
| 564 if (!heap->lo_space()->Contains(elms)) { | 564 if (!heap->lo_space()->Contains(elms)) { |
| 565 // As elms still in the same space they used to be, | 565 array->set_elements(LeftTrimFixedArray(heap, elms, 1)); |
| 566 // there is no need to update region dirty mark. | |
| 567 array->set_elements(LeftTrimFixedArray(heap, elms, 1), SKIP_WRITE_BARRIER); | |
| 568 } else { | 566 } else { |
| 569 // Shift the elements. | 567 // Shift the elements. |
| 570 AssertNoAllocation no_gc; | 568 AssertNoAllocation no_gc; |
| 571 MoveElements(heap, &no_gc, elms, 0, elms, 1, len - 1); | 569 MoveElements(heap, &no_gc, elms, 0, elms, 1, len - 1); |
| 572 elms->set(len - 1, heap->the_hole_value()); | 570 elms->set(len - 1, heap->the_hole_value()); |
| 573 } | 571 } |
| 574 | 572 |
| 575 // Set the length. | 573 // Set the length. |
| 576 array->set_length(Smi::FromInt(len - 1)); | 574 array->set_length(Smi::FromInt(len - 1)); |
| 577 | 575 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 (len - actual_delete_count - actual_start)); | 844 (len - actual_delete_count - actual_start)); |
| 847 if (trim_array) { | 845 if (trim_array) { |
| 848 const int delta = actual_delete_count - item_count; | 846 const int delta = actual_delete_count - item_count; |
| 849 | 847 |
| 850 if (actual_start > 0) { | 848 if (actual_start > 0) { |
| 851 AssertNoAllocation no_gc; | 849 AssertNoAllocation no_gc; |
| 852 MoveElements(heap, &no_gc, elms, delta, elms, 0, actual_start); | 850 MoveElements(heap, &no_gc, elms, delta, elms, 0, actual_start); |
| 853 } | 851 } |
| 854 | 852 |
| 855 elms = LeftTrimFixedArray(heap, elms, delta); | 853 elms = LeftTrimFixedArray(heap, elms, delta); |
| 856 array->set_elements(elms, SKIP_WRITE_BARRIER); | 854 array->set_elements(elms); |
| 857 } else { | 855 } else { |
| 858 AssertNoAllocation no_gc; | 856 AssertNoAllocation no_gc; |
| 859 MoveElements(heap, &no_gc, | 857 MoveElements(heap, &no_gc, |
| 860 elms, actual_start + item_count, | 858 elms, actual_start + item_count, |
| 861 elms, actual_start + actual_delete_count, | 859 elms, actual_start + actual_delete_count, |
| 862 (len - actual_delete_count - actual_start)); | 860 (len - actual_delete_count - actual_start)); |
| 863 FillWithHoles(heap, elms, new_length, len); | 861 FillWithHoles(heap, elms, new_length, len); |
| 864 } | 862 } |
| 865 } else if (item_count > actual_delete_count) { | 863 } else if (item_count > actual_delete_count) { |
| 866 // Currently fixed arrays cannot grow too big, so | 864 // Currently fixed arrays cannot grow too big, so |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 return Handle<Code>(code_address); \ | 1713 return Handle<Code>(code_address); \ |
| 1716 } | 1714 } |
| 1717 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1715 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1718 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1716 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1719 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1717 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1720 #undef DEFINE_BUILTIN_ACCESSOR_C | 1718 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1721 #undef DEFINE_BUILTIN_ACCESSOR_A | 1719 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1722 | 1720 |
| 1723 | 1721 |
| 1724 } } // namespace v8::internal | 1722 } } // namespace v8::internal |
| OLD | NEW |