OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 4439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4450 return result; | 4450 return result; |
4451 } | 4451 } |
4452 | 4452 |
4453 | 4453 |
4454 AllocationResult Heap::AllocateEmptyFixedTypedArray( | 4454 AllocationResult Heap::AllocateEmptyFixedTypedArray( |
4455 ExternalArrayType array_type) { | 4455 ExternalArrayType array_type) { |
4456 return AllocateFixedTypedArray(0, array_type, false, TENURED); | 4456 return AllocateFixedTypedArray(0, array_type, false, TENURED); |
4457 } | 4457 } |
4458 | 4458 |
4459 | 4459 |
4460 AllocationResult Heap::CopyFixedArrayAndGrow(FixedArray* src, int grow_by) { | 4460 AllocationResult Heap::CopyFixedArrayAndGrow(FixedArray* src, int grow_by, |
| 4461 PretenureFlag pretenure) { |
4461 int old_len = src->length(); | 4462 int old_len = src->length(); |
4462 int new_len = old_len + grow_by; | 4463 int new_len = old_len + grow_by; |
| 4464 DCHECK(new_len >= old_len); |
4463 HeapObject* obj; | 4465 HeapObject* obj; |
4464 { | 4466 { |
4465 AllocationResult allocation = AllocateRawFixedArray(new_len, NOT_TENURED); | 4467 AllocationResult allocation = AllocateRawFixedArray(new_len, pretenure); |
4466 if (!allocation.To(&obj)) return allocation; | 4468 if (!allocation.To(&obj)) return allocation; |
4467 } | 4469 } |
4468 obj->set_map_no_write_barrier(fixed_array_map()); | 4470 obj->set_map_no_write_barrier(fixed_array_map()); |
4469 FixedArray* result = FixedArray::cast(obj); | 4471 FixedArray* result = FixedArray::cast(obj); |
4470 result->set_length(new_len); | 4472 result->set_length(new_len); |
4471 | 4473 |
4472 // Copy the content. | 4474 // Copy the content. |
4473 DisallowHeapAllocation no_gc; | 4475 DisallowHeapAllocation no_gc; |
4474 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); | 4476 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); |
4475 for (int i = 0; i < old_len; i++) result->set(i, src->get(i), mode); | 4477 for (int i = 0; i < old_len; i++) result->set(i, src->get(i), mode); |
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6899 *object_type = "CODE_TYPE"; \ | 6901 *object_type = "CODE_TYPE"; \ |
6900 *object_sub_type = "CODE_AGE/" #name; \ | 6902 *object_sub_type = "CODE_AGE/" #name; \ |
6901 return true; | 6903 return true; |
6902 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6904 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6903 #undef COMPARE_AND_RETURN_NAME | 6905 #undef COMPARE_AND_RETURN_NAME |
6904 } | 6906 } |
6905 return false; | 6907 return false; |
6906 } | 6908 } |
6907 } // namespace internal | 6909 } // namespace internal |
6908 } // namespace v8 | 6910 } // namespace v8 |
OLD | NEW |