Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1472)

Side by Side Diff: src/heap.cc

Issue 145493004: Make the full object memory size of a page available for a single allocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after
2929 } 2929 }
2930 ASSERT(!InNewSpace(empty_fixed_array())); 2930 ASSERT(!InNewSpace(empty_fixed_array()));
2931 return true; 2931 return true;
2932 } 2932 }
2933 2933
2934 2934
2935 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) { 2935 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) {
2936 // Statically ensure that it is safe to allocate heap numbers in paged 2936 // Statically ensure that it is safe to allocate heap numbers in paged
2937 // spaces. 2937 // spaces.
2938 int size = HeapNumber::kSize; 2938 int size = HeapNumber::kSize;
2939 STATIC_ASSERT(HeapNumber::kSize <= Page::kNonCodeObjectAreaSize); 2939 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxNonCodeHeapObjectSize);
2940 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); 2940 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure);
2941 2941
2942 Object* result; 2942 Object* result;
2943 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); 2943 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
2944 if (!maybe_result->ToObject(&result)) return maybe_result; 2944 if (!maybe_result->ToObject(&result)) return maybe_result;
2945 } 2945 }
2946 2946
2947 HeapObject::cast(result)->set_map_no_write_barrier(heap_number_map()); 2947 HeapObject::cast(result)->set_map_no_write_barrier(heap_number_map());
2948 HeapNumber::cast(result)->set_value(value); 2948 HeapNumber::cast(result)->set_value(value);
2949 return result; 2949 return result;
2950 } 2950 }
2951 2951
2952 2952
2953 MaybeObject* Heap::AllocateCell(Object* value) { 2953 MaybeObject* Heap::AllocateCell(Object* value) {
2954 int size = Cell::kSize; 2954 int size = Cell::kSize;
2955 STATIC_ASSERT(Cell::kSize <= Page::kNonCodeObjectAreaSize); 2955 STATIC_ASSERT(Cell::kSize <= Page::kMaxNonCodeHeapObjectSize);
2956 2956
2957 Object* result; 2957 Object* result;
2958 { MaybeObject* maybe_result = AllocateRaw(size, CELL_SPACE, CELL_SPACE); 2958 { MaybeObject* maybe_result = AllocateRaw(size, CELL_SPACE, CELL_SPACE);
2959 if (!maybe_result->ToObject(&result)) return maybe_result; 2959 if (!maybe_result->ToObject(&result)) return maybe_result;
2960 } 2960 }
2961 HeapObject::cast(result)->set_map_no_write_barrier(cell_map()); 2961 HeapObject::cast(result)->set_map_no_write_barrier(cell_map());
2962 Cell::cast(result)->set_value(value); 2962 Cell::cast(result)->set_value(value);
2963 return result; 2963 return result;
2964 } 2964 }
2965 2965
2966 2966
2967 MaybeObject* Heap::AllocatePropertyCell() { 2967 MaybeObject* Heap::AllocatePropertyCell() {
2968 int size = PropertyCell::kSize; 2968 int size = PropertyCell::kSize;
2969 STATIC_ASSERT(PropertyCell::kSize <= Page::kNonCodeObjectAreaSize); 2969 STATIC_ASSERT(PropertyCell::kSize <= Page::kMaxNonCodeHeapObjectSize);
2970 2970
2971 Object* result; 2971 Object* result;
2972 MaybeObject* maybe_result = 2972 MaybeObject* maybe_result =
2973 AllocateRaw(size, PROPERTY_CELL_SPACE, PROPERTY_CELL_SPACE); 2973 AllocateRaw(size, PROPERTY_CELL_SPACE, PROPERTY_CELL_SPACE);
2974 if (!maybe_result->ToObject(&result)) return maybe_result; 2974 if (!maybe_result->ToObject(&result)) return maybe_result;
2975 2975
2976 HeapObject::cast(result)->set_map_no_write_barrier( 2976 HeapObject::cast(result)->set_map_no_write_barrier(
2977 global_property_cell_map()); 2977 global_property_cell_map());
2978 PropertyCell* cell = PropertyCell::cast(result); 2978 PropertyCell* cell = PropertyCell::cast(result);
2979 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), 2979 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()),
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 } 5341 }
5342 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( 5342 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(
5343 hash_table_map()); 5343 hash_table_map());
5344 ASSERT(result->IsHashTable()); 5344 ASSERT(result->IsHashTable());
5345 return result; 5345 return result;
5346 } 5346 }
5347 5347
5348 5348
5349 MaybeObject* Heap::AllocateSymbol() { 5349 MaybeObject* Heap::AllocateSymbol() {
5350 // Statically ensure that it is safe to allocate symbols in paged spaces. 5350 // Statically ensure that it is safe to allocate symbols in paged spaces.
5351 STATIC_ASSERT(Symbol::kSize <= Page::kNonCodeObjectAreaSize); 5351 STATIC_ASSERT(Symbol::kSize <= Page::kMaxNonCodeHeapObjectSize);
5352 5352
5353 Object* result; 5353 Object* result;
5354 MaybeObject* maybe = 5354 MaybeObject* maybe =
5355 AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE); 5355 AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE);
5356 if (!maybe->ToObject(&result)) return maybe; 5356 if (!maybe->ToObject(&result)) return maybe;
5357 5357
5358 HeapObject::cast(result)->set_map_no_write_barrier(symbol_map()); 5358 HeapObject::cast(result)->set_map_no_write_barrier(symbol_map());
5359 5359
5360 // Generate a random hash value. 5360 // Generate a random hash value.
5361 int hash; 5361 int hash;
(...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after
7740 static_cast<int>(object_sizes_last_time_[index])); 7740 static_cast<int>(object_sizes_last_time_[index]));
7741 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 7741 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
7742 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7742 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7743 7743
7744 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7744 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7745 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7745 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7746 ClearObjectStats(); 7746 ClearObjectStats();
7747 } 7747 }
7748 7748
7749 } } // namespace v8::internal 7749 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698