Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f4a637c008612f9faaf858d14d00855c3865576e..aea01dc8a93473b3eb09fcad2f069845e304a41b 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -2015,9 +2015,10 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) { |
DCHECK(number_of_fields == old_number_of_fields + 1); |
// This migration is a transition from a map that has run out of property |
// space. Therefore it could be done by extending the backing store. |
+ int grow_by = external - object->properties()->length(); |
Handle<FixedArray> old_storage = handle(object->properties(), isolate); |
Handle<FixedArray> new_storage = |
- FixedArray::CopySize(old_storage, external); |
+ isolate->factory()->CopyFixedArrayAndGrow(old_storage, grow_by); |
// Properly initialize newly added property. |
Handle<Object> value; |
@@ -7496,10 +7497,11 @@ void CodeCache::UpdateDefaultCache( |
// Extend the code cache with some new entries (at least one). Must be a |
// multiple of the entry size. |
- int new_length = length + ((length >> 1)) + kCodeCacheEntrySize; |
+ Isolate* isolate = cache->GetIsolate(); |
+ int new_length = length + (length >> 1) + kCodeCacheEntrySize; |
new_length = new_length - new_length % kCodeCacheEntrySize; |
DCHECK((new_length % kCodeCacheEntrySize) == 0); |
- cache = FixedArray::CopySize(cache, new_length); |
+ cache = isolate->factory()->CopyFixedArrayAndGrow(cache, new_length - length); |
// Add the (name, code) pair to the new cache. |
cache->set(length + kCodeCacheEntryNameOffset, *name); |
@@ -7892,27 +7894,6 @@ MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first, |
} |
-Handle<FixedArray> FixedArray::CopySize( |
- Handle<FixedArray> array, int new_length, PretenureFlag pretenure) { |
- Isolate* isolate = array->GetIsolate(); |
- if (new_length == 0) return isolate->factory()->empty_fixed_array(); |
- Handle<FixedArray> result = |
- isolate->factory()->NewFixedArray(new_length, pretenure); |
- // Copy the content |
- DisallowHeapAllocation no_gc; |
- int len = array->length(); |
- if (new_length < len) len = new_length; |
- // We are taking the map from the old fixed array so the map is sure to |
- // be an immortal immutable object. |
- result->set_map_no_write_barrier(array->map()); |
- WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); |
- for (int i = 0; i < len; i++) { |
- result->set(i, array->get(i), mode); |
- } |
- return result; |
-} |
- |
- |
void FixedArray::CopyTo(int pos, FixedArray* dest, int dest_pos, int len) { |
DisallowHeapAllocation no_gc; |
WriteBarrierMode mode = dest->GetWriteBarrierMode(no_gc); |
@@ -8097,9 +8078,12 @@ Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) { |
int capacity = array->length(); |
bool empty = (capacity == 0); |
if (capacity < kFirstIndex + length) { |
- capacity = kFirstIndex + length; |
- capacity = capacity + Max(capacity / 2, 2); |
- array = Handle<ArrayList>::cast(FixedArray::CopySize(array, capacity)); |
+ Isolate* isolate = array->GetIsolate(); |
+ int new_capacity = kFirstIndex + length; |
+ new_capacity = new_capacity + Max(new_capacity / 2, 2); |
+ int grow_by = new_capacity - capacity; |
+ array = Handle<ArrayList>::cast( |
+ isolate->factory()->CopyFixedArrayAndGrow(array, grow_by)); |
if (empty) array->SetLength(0); |
} |
return array; |
@@ -11929,9 +11913,10 @@ Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, |
Handle<DependentCode> DependentCode::EnsureSpace( |
Handle<DependentCode> entries) { |
+ Isolate* isolate = entries->GetIsolate(); |
if (entries->length() == 0) { |
entries = Handle<DependentCode>::cast( |
- FixedArray::CopySize(entries, kCodesStartIndex + 1, TENURED)); |
+ isolate->factory()->NewFixedArray(kCodesStartIndex + 1, TENURED)); |
for (int g = 0; g < kGroupCount; g++) { |
entries->set_number_of_entries(static_cast<DependencyGroup>(g), 0); |
} |
@@ -11941,8 +11926,9 @@ Handle<DependentCode> DependentCode::EnsureSpace( |
GroupStartIndexes starts(*entries); |
int capacity = |
kCodesStartIndex + DependentCode::Grow(starts.number_of_entries()); |
+ int grow_by = capacity - entries->length(); |
return Handle<DependentCode>::cast( |
- FixedArray::CopySize(entries, capacity, TENURED)); |
+ isolate->factory()->CopyFixedArrayAndGrow(entries, grow_by, TENURED)); |
} |