| 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 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4401 | 4401 |
| 4402 | 4402 |
| 4403 AllocationResult Heap::AllocateFixedArrayWithFiller(int length, | 4403 AllocationResult Heap::AllocateFixedArrayWithFiller(int length, |
| 4404 PretenureFlag pretenure, | 4404 PretenureFlag pretenure, |
| 4405 Object* filler) { | 4405 Object* filler) { |
| 4406 DCHECK(length >= 0); | 4406 DCHECK(length >= 0); |
| 4407 DCHECK(empty_fixed_array()->IsFixedArray()); | 4407 DCHECK(empty_fixed_array()->IsFixedArray()); |
| 4408 if (length == 0) return empty_fixed_array(); | 4408 if (length == 0) return empty_fixed_array(); |
| 4409 | 4409 |
| 4410 DCHECK(!InNewSpace(filler)); | 4410 DCHECK(!InNewSpace(filler)); |
| 4411 HeapObject* result; | 4411 HeapObject* result = nullptr; |
| 4412 { | 4412 { |
| 4413 AllocationResult allocation = AllocateRawFixedArray(length, pretenure); | 4413 AllocationResult allocation = AllocateRawFixedArray(length, pretenure); |
| 4414 if (!allocation.To(&result)) return allocation; | 4414 if (!allocation.To(&result)) return allocation; |
| 4415 } | 4415 } |
| 4416 | 4416 |
| 4417 result->set_map_no_write_barrier(fixed_array_map()); | 4417 result->set_map_no_write_barrier(fixed_array_map()); |
| 4418 FixedArray* array = FixedArray::cast(result); | 4418 FixedArray* array = FixedArray::cast(result); |
| 4419 array->set_length(length); | 4419 array->set_length(length); |
| 4420 MemsetPointer(array->data_start(), filler, length); | 4420 MemsetPointer(array->data_start(), filler, length); |
| 4421 return array; | 4421 return array; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4498 | 4498 |
| 4499 | 4499 |
| 4500 AllocationResult Heap::AllocateExtendedConstantPoolArray( | 4500 AllocationResult Heap::AllocateExtendedConstantPoolArray( |
| 4501 const ConstantPoolArray::NumberOfEntries& small, | 4501 const ConstantPoolArray::NumberOfEntries& small, |
| 4502 const ConstantPoolArray::NumberOfEntries& extended) { | 4502 const ConstantPoolArray::NumberOfEntries& extended) { |
| 4503 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType)); | 4503 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType)); |
| 4504 CHECK(extended.are_in_range(0, kMaxInt)); | 4504 CHECK(extended.are_in_range(0, kMaxInt)); |
| 4505 int size = ConstantPoolArray::SizeForExtended(small, extended); | 4505 int size = ConstantPoolArray::SizeForExtended(small, extended); |
| 4506 AllocationSpace space = SelectSpace(size, TENURED); | 4506 AllocationSpace space = SelectSpace(size, TENURED); |
| 4507 | 4507 |
| 4508 HeapObject* object; | 4508 HeapObject* object = nullptr; |
| 4509 { | 4509 { |
| 4510 AllocationResult allocation = | 4510 AllocationResult allocation = |
| 4511 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned); | 4511 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned); |
| 4512 if (!allocation.To(&object)) return allocation; | 4512 if (!allocation.To(&object)) return allocation; |
| 4513 } | 4513 } |
| 4514 object->set_map_no_write_barrier(constant_pool_array_map()); | 4514 object->set_map_no_write_barrier(constant_pool_array_map()); |
| 4515 | 4515 |
| 4516 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); | 4516 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); |
| 4517 constant_pool->InitExtended(small, extended); | 4517 constant_pool->InitExtended(small, extended); |
| 4518 constant_pool->ClearPtrEntries(isolate()); | 4518 constant_pool->ClearPtrEntries(isolate()); |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6666 *object_type = "CODE_TYPE"; \ | 6666 *object_type = "CODE_TYPE"; \ |
| 6667 *object_sub_type = "CODE_AGE/" #name; \ | 6667 *object_sub_type = "CODE_AGE/" #name; \ |
| 6668 return true; | 6668 return true; |
| 6669 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6669 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
| 6670 #undef COMPARE_AND_RETURN_NAME | 6670 #undef COMPARE_AND_RETURN_NAME |
| 6671 } | 6671 } |
| 6672 return false; | 6672 return false; |
| 6673 } | 6673 } |
| 6674 } // namespace internal | 6674 } // namespace internal |
| 6675 } // namespace v8 | 6675 } // namespace v8 |
| OLD | NEW |