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 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 | 2632 |
2633 void Map::ClearCodeCache() { | 2633 void Map::ClearCodeCache() { |
2634 // No write barrier is needed since empty_fixed_array is not in new space. | 2634 // No write barrier is needed since empty_fixed_array is not in new space. |
2635 // Please note this function is used during marking: | 2635 // Please note this function is used during marking: |
2636 // - MarkCompactCollector::MarkUnmarkedObject | 2636 // - MarkCompactCollector::MarkUnmarkedObject |
2637 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); | 2637 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); |
2638 WRITE_FIELD(this, kCodeCacheOffset, Heap::empty_fixed_array()); | 2638 WRITE_FIELD(this, kCodeCacheOffset, Heap::empty_fixed_array()); |
2639 } | 2639 } |
2640 | 2640 |
2641 | 2641 |
| 2642 void JSArray::EnsureSize(int required_size) { |
| 2643 ASSERT(HasFastElements()); |
| 2644 if (elements()->length() >= required_size) return; |
| 2645 Expand(required_size); |
| 2646 } |
| 2647 |
| 2648 |
2642 void JSArray::SetContent(FixedArray* storage) { | 2649 void JSArray::SetContent(FixedArray* storage) { |
2643 set_length(Smi::FromInt(storage->length()), SKIP_WRITE_BARRIER); | 2650 set_length(Smi::FromInt(storage->length()), SKIP_WRITE_BARRIER); |
2644 set_elements(storage); | 2651 set_elements(storage); |
2645 } | 2652 } |
2646 | 2653 |
2647 | 2654 |
2648 Object* FixedArray::Copy() { | 2655 Object* FixedArray::Copy() { |
2649 if (length() == 0) return this; | 2656 if (length() == 0) return this; |
2650 return Heap::CopyFixedArray(this); | 2657 return Heap::CopyFixedArray(this); |
2651 } | 2658 } |
(...skipping 16 matching lines...) Expand all Loading... |
2668 #undef WRITE_INT_FIELD | 2675 #undef WRITE_INT_FIELD |
2669 #undef READ_SHORT_FIELD | 2676 #undef READ_SHORT_FIELD |
2670 #undef WRITE_SHORT_FIELD | 2677 #undef WRITE_SHORT_FIELD |
2671 #undef READ_BYTE_FIELD | 2678 #undef READ_BYTE_FIELD |
2672 #undef WRITE_BYTE_FIELD | 2679 #undef WRITE_BYTE_FIELD |
2673 | 2680 |
2674 | 2681 |
2675 } } // namespace v8::internal | 2682 } } // namespace v8::internal |
2676 | 2683 |
2677 #endif // V8_OBJECTS_INL_H_ | 2684 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |