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

Side by Side Diff: src/heap.cc

Issue 209473006: Ensure that we don't mark weak heap references in the constant pool array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: replace with CHECK Created 6 years, 8 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/lithium-codegen.cc » ('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 5263 matching lines...) Expand 10 before | Expand all | Expand 10 after
5274 } 5274 }
5275 5275
5276 return EnsureDoubleAligned(this, object, size); 5276 return EnsureDoubleAligned(this, object, size);
5277 } 5277 }
5278 5278
5279 5279
5280 MaybeObject* Heap::AllocateConstantPoolArray(int number_of_int64_entries, 5280 MaybeObject* Heap::AllocateConstantPoolArray(int number_of_int64_entries,
5281 int number_of_code_ptr_entries, 5281 int number_of_code_ptr_entries,
5282 int number_of_heap_ptr_entries, 5282 int number_of_heap_ptr_entries,
5283 int number_of_int32_entries) { 5283 int number_of_int32_entries) {
5284 ASSERT(number_of_int64_entries > 0 || number_of_code_ptr_entries > 0 || 5284 CHECK(number_of_int64_entries >= 0 &&
5285 number_of_heap_ptr_entries > 0 || number_of_int32_entries > 0); 5285 number_of_int64_entries <= ConstantPoolArray::kMaxEntriesPerType &&
5286 number_of_code_ptr_entries >= 0 &&
5287 number_of_code_ptr_entries <= ConstantPoolArray::kMaxEntriesPerType &&
5288 number_of_heap_ptr_entries >= 0 &&
5289 number_of_heap_ptr_entries <= ConstantPoolArray::kMaxEntriesPerType &&
5290 number_of_int32_entries >= 0 &&
5291 number_of_int32_entries <= ConstantPoolArray::kMaxEntriesPerType);
5286 int size = ConstantPoolArray::SizeFor(number_of_int64_entries, 5292 int size = ConstantPoolArray::SizeFor(number_of_int64_entries,
5287 number_of_code_ptr_entries, 5293 number_of_code_ptr_entries,
5288 number_of_heap_ptr_entries, 5294 number_of_heap_ptr_entries,
5289 number_of_int32_entries); 5295 number_of_int32_entries);
5290 #ifndef V8_HOST_ARCH_64_BIT 5296 #ifndef V8_HOST_ARCH_64_BIT
5291 size += kPointerSize; 5297 size += kPointerSize;
5292 #endif 5298 #endif
5293 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED); 5299 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED);
5294 5300
5295 HeapObject* object; 5301 HeapObject* object;
5296 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_POINTER_SPACE); 5302 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_POINTER_SPACE);
5297 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; 5303 if (!maybe_object->To<HeapObject>(&object)) return maybe_object;
5298 } 5304 }
5299 object = EnsureDoubleAligned(this, object, size); 5305 object = EnsureDoubleAligned(this, object, size);
5300 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map()); 5306 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map());
5301 5307
5302 ConstantPoolArray* constant_pool = 5308 ConstantPoolArray* constant_pool =
5303 reinterpret_cast<ConstantPoolArray*>(object); 5309 reinterpret_cast<ConstantPoolArray*>(object);
5304 constant_pool->SetEntryCounts(number_of_int64_entries, 5310 constant_pool->Init(number_of_int64_entries,
5305 number_of_code_ptr_entries, 5311 number_of_code_ptr_entries,
5306 number_of_heap_ptr_entries, 5312 number_of_heap_ptr_entries,
5307 number_of_int32_entries); 5313 number_of_int32_entries);
5308 if (number_of_code_ptr_entries > 0) { 5314 if (number_of_code_ptr_entries > 0) {
5309 int offset = 5315 int offset =
5310 constant_pool->OffsetOfElementAt(constant_pool->first_code_ptr_index()); 5316 constant_pool->OffsetOfElementAt(constant_pool->first_code_ptr_index());
5311 MemsetPointer( 5317 MemsetPointer(
5312 reinterpret_cast<Address*>(HeapObject::RawField(constant_pool, offset)), 5318 reinterpret_cast<Address*>(HeapObject::RawField(constant_pool, offset)),
5313 isolate()->builtins()->builtin(Builtins::kIllegal)->entry(), 5319 isolate()->builtins()->builtin(Builtins::kIllegal)->entry(),
5314 number_of_code_ptr_entries); 5320 number_of_code_ptr_entries);
5315 } 5321 }
5316 if (number_of_heap_ptr_entries > 0) { 5322 if (number_of_heap_ptr_entries > 0) {
5317 int offset = 5323 int offset =
5318 constant_pool->OffsetOfElementAt(constant_pool->first_heap_ptr_index()); 5324 constant_pool->OffsetOfElementAt(constant_pool->first_heap_ptr_index());
5319 MemsetPointer( 5325 MemsetPointer(
5320 HeapObject::RawField(constant_pool, offset), 5326 HeapObject::RawField(constant_pool, offset),
5321 undefined_value(), 5327 undefined_value(),
5322 number_of_heap_ptr_entries); 5328 number_of_heap_ptr_entries);
5323 } 5329 }
5324 return constant_pool; 5330 return constant_pool;
5325 } 5331 }
5326 5332
5327 5333
5328 MaybeObject* Heap::AllocateEmptyConstantPoolArray() { 5334 MaybeObject* Heap::AllocateEmptyConstantPoolArray() {
5329 int size = ConstantPoolArray::SizeFor(0, 0, 0, 0); 5335 int size = ConstantPoolArray::SizeFor(0, 0, 0, 0);
5330 Object* result; 5336 Object* result;
5331 { MaybeObject* maybe_result = 5337 { MaybeObject* maybe_result =
5332 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); 5338 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE);
5333 if (!maybe_result->ToObject(&result)) return maybe_result; 5339 if (!maybe_result->ToObject(&result)) return maybe_result;
5334 } 5340 }
5335 HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map()); 5341 HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map());
5336 ConstantPoolArray::cast(result)->SetEntryCounts(0, 0, 0, 0); 5342 ConstantPoolArray::cast(result)->Init(0, 0, 0, 0);
5337 return result; 5343 return result;
5338 } 5344 }
5339 5345
5340 5346
5341 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { 5347 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
5342 Object* result; 5348 Object* result;
5343 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); 5349 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure);
5344 if (!maybe_result->ToObject(&result)) return maybe_result; 5350 if (!maybe_result->ToObject(&result)) return maybe_result;
5345 } 5351 }
5346 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( 5352 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(
(...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after
7689 static_cast<int>(object_sizes_last_time_[index])); 7695 static_cast<int>(object_sizes_last_time_[index]));
7690 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 7696 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
7691 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7697 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7692 7698
7693 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7699 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7694 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7700 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7695 ClearObjectStats(); 7701 ClearObjectStats();
7696 } 7702 }
7697 7703
7698 } } // namespace v8::internal 7704 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/lithium-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698