| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 MoveElements(&no_gc, | 658 MoveElements(&no_gc, |
| 659 elms, actual_start + item_count, | 659 elms, actual_start + item_count, |
| 660 elms, actual_start + actual_delete_count, | 660 elms, actual_start + actual_delete_count, |
| 661 (len - actual_delete_count - actual_start)); | 661 (len - actual_delete_count - actual_start)); |
| 662 FillWithHoles(elms, new_length, len); | 662 FillWithHoles(elms, new_length, len); |
| 663 } else if (item_count > actual_delete_count) { | 663 } else if (item_count > actual_delete_count) { |
| 664 // Currently fixed arrays cannot grow too big, so | 664 // Currently fixed arrays cannot grow too big, so |
| 665 // we should never hit this case. | 665 // we should never hit this case. |
| 666 ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len)); | 666 ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len)); |
| 667 | 667 |
| 668 FixedArray* source_elms = elms; | |
| 669 | |
| 670 // Check if array need to grow. | 668 // Check if array need to grow. |
| 671 if (new_length > elms->length()) { | 669 if (new_length > elms->length()) { |
| 672 // New backing storage is needed. | 670 // New backing storage is needed. |
| 673 int capacity = new_length + (new_length >> 1) + 16; | 671 int capacity = new_length + (new_length >> 1) + 16; |
| 674 Object* obj = Heap::AllocateUninitializedFixedArray(capacity); | 672 Object* obj = Heap::AllocateUninitializedFixedArray(capacity); |
| 675 if (obj->IsFailure()) return obj; | 673 if (obj->IsFailure()) return obj; |
| 676 FixedArray* new_elms = FixedArray::cast(obj); | 674 FixedArray* new_elms = FixedArray::cast(obj); |
| 677 | 675 |
| 678 AssertNoAllocation no_gc; | 676 AssertNoAllocation no_gc; |
| 679 // Copy the part before actual_start as is. | 677 // Copy the part before actual_start as is. |
| 680 CopyElements(&no_gc, new_elms, 0, elms, 0, actual_start); | 678 CopyElements(&no_gc, new_elms, 0, elms, 0, actual_start); |
| 679 CopyElements(&no_gc, |
| 680 new_elms, actual_start + item_count, |
| 681 elms, actual_start + actual_delete_count, |
| 682 (len - actual_delete_count - actual_start)); |
| 681 FillWithHoles(new_elms, new_length, capacity); | 683 FillWithHoles(new_elms, new_length, capacity); |
| 682 | 684 |
| 683 source_elms = elms; | |
| 684 elms = new_elms; | 685 elms = new_elms; |
| 685 array->set_elements(elms); | 686 array->set_elements(elms); |
| 687 } else { |
| 688 AssertNoAllocation no_gc; |
| 689 MoveElements(&no_gc, |
| 690 elms, actual_start + item_count, |
| 691 elms, actual_start + actual_delete_count, |
| 692 (len - actual_delete_count - actual_start)); |
| 686 } | 693 } |
| 687 | |
| 688 AssertNoAllocation no_gc; | |
| 689 MoveElements(&no_gc, | |
| 690 elms, actual_start + item_count, | |
| 691 source_elms, actual_start + actual_delete_count, | |
| 692 (len - actual_delete_count - actual_start)); | |
| 693 } | 694 } |
| 694 | 695 |
| 695 AssertNoAllocation no_gc; | 696 AssertNoAllocation no_gc; |
| 696 WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc); | 697 WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc); |
| 697 for (int k = actual_start; k < actual_start + item_count; k++) { | 698 for (int k = actual_start; k < actual_start + item_count; k++) { |
| 698 elms->set(k, args[3 + k - actual_start], mode); | 699 elms->set(k, args[3 + k - actual_start], mode); |
| 699 } | 700 } |
| 700 | 701 |
| 701 // Set the length. | 702 // Set the length. |
| 702 array->set_length(Smi::FromInt(new_length)); | 703 array->set_length(Smi::FromInt(new_length)); |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 if (entry->contains(pc)) { | 1350 if (entry->contains(pc)) { |
| 1350 return names_[i]; | 1351 return names_[i]; |
| 1351 } | 1352 } |
| 1352 } | 1353 } |
| 1353 } | 1354 } |
| 1354 return NULL; | 1355 return NULL; |
| 1355 } | 1356 } |
| 1356 | 1357 |
| 1357 | 1358 |
| 1358 } } // namespace v8::internal | 1359 } } // namespace v8::internal |
| OLD | NEW |