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 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 SKIP_WRITE_BARRIER); | 2895 SKIP_WRITE_BARRIER); |
2896 cell->set_value(the_hole_value()); | 2896 cell->set_value(the_hole_value()); |
2897 cell->set_type(HeapType::None()); | 2897 cell->set_type(HeapType::None()); |
2898 return result; | 2898 return result; |
2899 } | 2899 } |
2900 | 2900 |
2901 | 2901 |
2902 AllocationResult Heap::AllocateWeakCell(HeapObject* value) { | 2902 AllocationResult Heap::AllocateWeakCell(HeapObject* value) { |
2903 int size = WeakCell::kSize; | 2903 int size = WeakCell::kSize; |
2904 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize); | 2904 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize); |
2905 HeapObject* result; | 2905 HeapObject* result = NULL; |
2906 { | 2906 { |
2907 AllocationResult allocation = | 2907 AllocationResult allocation = |
2908 AllocateRaw(size, OLD_POINTER_SPACE, OLD_POINTER_SPACE); | 2908 AllocateRaw(size, OLD_POINTER_SPACE, OLD_POINTER_SPACE); |
2909 if (!allocation.To(&result)) return allocation; | 2909 if (!allocation.To(&result)) return allocation; |
2910 } | 2910 } |
2911 result->set_map_no_write_barrier(weak_cell_map()); | 2911 result->set_map_no_write_barrier(weak_cell_map()); |
2912 WeakCell::cast(result)->initialize(value); | 2912 WeakCell::cast(result)->initialize(value); |
2913 WeakCell::cast(result)->set_next(undefined_value(), SKIP_WRITE_BARRIER); | 2913 WeakCell::cast(result)->set_next(undefined_value(), SKIP_WRITE_BARRIER); |
2914 return result; | 2914 return result; |
2915 } | 2915 } |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4471 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); | 4471 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); |
4472 constant_pool->InitExtended(small, extended); | 4472 constant_pool->InitExtended(small, extended); |
4473 constant_pool->ClearPtrEntries(isolate()); | 4473 constant_pool->ClearPtrEntries(isolate()); |
4474 return constant_pool; | 4474 return constant_pool; |
4475 } | 4475 } |
4476 | 4476 |
4477 | 4477 |
4478 AllocationResult Heap::AllocateEmptyConstantPoolArray() { | 4478 AllocationResult Heap::AllocateEmptyConstantPoolArray() { |
4479 ConstantPoolArray::NumberOfEntries small(0, 0, 0, 0); | 4479 ConstantPoolArray::NumberOfEntries small(0, 0, 0, 0); |
4480 int size = ConstantPoolArray::SizeFor(small); | 4480 int size = ConstantPoolArray::SizeFor(small); |
4481 HeapObject* result; | 4481 HeapObject* result = NULL; |
4482 { | 4482 { |
4483 AllocationResult allocation = | 4483 AllocationResult allocation = |
4484 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); | 4484 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); |
4485 if (!allocation.To(&result)) return allocation; | 4485 if (!allocation.To(&result)) return allocation; |
4486 } | 4486 } |
4487 result->set_map_no_write_barrier(constant_pool_array_map()); | 4487 result->set_map_no_write_barrier(constant_pool_array_map()); |
4488 ConstantPoolArray::cast(result)->Init(small); | 4488 ConstantPoolArray::cast(result)->Init(small); |
4489 return result; | 4489 return result; |
4490 } | 4490 } |
4491 | 4491 |
4492 | 4492 |
4493 AllocationResult Heap::AllocateSymbol() { | 4493 AllocationResult Heap::AllocateSymbol() { |
4494 // Statically ensure that it is safe to allocate symbols in paged spaces. | 4494 // Statically ensure that it is safe to allocate symbols in paged spaces. |
4495 STATIC_ASSERT(Symbol::kSize <= Page::kMaxRegularHeapObjectSize); | 4495 STATIC_ASSERT(Symbol::kSize <= Page::kMaxRegularHeapObjectSize); |
4496 | 4496 |
4497 HeapObject* result; | 4497 HeapObject* result = NULL; |
4498 AllocationResult allocation = | 4498 AllocationResult allocation = |
4499 AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE); | 4499 AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE); |
4500 if (!allocation.To(&result)) return allocation; | 4500 if (!allocation.To(&result)) return allocation; |
4501 | 4501 |
4502 result->set_map_no_write_barrier(symbol_map()); | 4502 result->set_map_no_write_barrier(symbol_map()); |
4503 | 4503 |
4504 // Generate a random hash value. | 4504 // Generate a random hash value. |
4505 int hash; | 4505 int hash; |
4506 int attempts = 0; | 4506 int attempts = 0; |
4507 do { | 4507 do { |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6449 static_cast<int>(object_sizes_last_time_[index])); | 6449 static_cast<int>(object_sizes_last_time_[index])); |
6450 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6450 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6451 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6451 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6452 | 6452 |
6453 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6453 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6454 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6454 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6455 ClearObjectStats(); | 6455 ClearObjectStats(); |
6456 } | 6456 } |
6457 } | 6457 } |
6458 } // namespace v8::internal | 6458 } // namespace v8::internal |
OLD | NEW |