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

Side by Side Diff: src/heap.cc

Issue 22925004: Introduce Heap::SelectSpace helper for allocations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Hannes Payer. Created 7 years, 3 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 | « src/heap.h ('k') | src/heap-inl.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 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 set_external_map(external_map); 2833 set_external_map(external_map);
2834 2834
2835 ASSERT(!InNewSpace(empty_fixed_array())); 2835 ASSERT(!InNewSpace(empty_fixed_array()));
2836 return true; 2836 return true;
2837 } 2837 }
2838 2838
2839 2839
2840 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) { 2840 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) {
2841 // Statically ensure that it is safe to allocate heap numbers in paged 2841 // Statically ensure that it is safe to allocate heap numbers in paged
2842 // spaces. 2842 // spaces.
2843 int size = HeapNumber::kSize;
2843 STATIC_ASSERT(HeapNumber::kSize <= Page::kNonCodeObjectAreaSize); 2844 STATIC_ASSERT(HeapNumber::kSize <= Page::kNonCodeObjectAreaSize);
2844 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 2845 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure);
2845 2846
2846 Object* result; 2847 Object* result;
2847 { MaybeObject* maybe_result = 2848 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
2848 AllocateRaw(HeapNumber::kSize, space, OLD_DATA_SPACE);
2849 if (!maybe_result->ToObject(&result)) return maybe_result; 2849 if (!maybe_result->ToObject(&result)) return maybe_result;
2850 } 2850 }
2851 2851
2852 HeapObject::cast(result)->set_map_no_write_barrier(heap_number_map()); 2852 HeapObject::cast(result)->set_map_no_write_barrier(heap_number_map());
2853 HeapNumber::cast(result)->set_value(value); 2853 HeapNumber::cast(result)->set_value(value);
2854 return result; 2854 return result;
2855 } 2855 }
2856 2856
2857 2857
2858 MaybeObject* Heap::AllocateHeapNumber(double value) { 2858 MaybeObject* Heap::AllocateHeapNumber(double value) {
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4002 String* answer = String::cast(result); 4002 String* answer = String::cast(result);
4003 answer->Set(0, code); 4003 answer->Set(0, code);
4004 return answer; 4004 return answer;
4005 } 4005 }
4006 4006
4007 4007
4008 MaybeObject* Heap::AllocateByteArray(int length, PretenureFlag pretenure) { 4008 MaybeObject* Heap::AllocateByteArray(int length, PretenureFlag pretenure) {
4009 if (length < 0 || length > ByteArray::kMaxLength) { 4009 if (length < 0 || length > ByteArray::kMaxLength) {
4010 return Failure::OutOfMemoryException(0x7); 4010 return Failure::OutOfMemoryException(0x7);
4011 } 4011 }
4012 if (pretenure == NOT_TENURED) {
4013 return AllocateByteArray(length);
4014 }
4015 int size = ByteArray::SizeFor(length); 4012 int size = ByteArray::SizeFor(length);
4016 AllocationSpace space = 4013 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure);
4017 (size > Page::kMaxNonCodeHeapObjectSize) ? LO_SPACE : OLD_DATA_SPACE;
4018 Object* result;
4019 { MaybeObject* maybe_result = AllocateRaw(size, space, space);
4020 if (!maybe_result->ToObject(&result)) return maybe_result;
4021 }
4022
4023 reinterpret_cast<ByteArray*>(result)->set_map_no_write_barrier(
4024 byte_array_map());
4025 reinterpret_cast<ByteArray*>(result)->set_length(length);
4026 return result;
4027 }
4028
4029
4030 MaybeObject* Heap::AllocateByteArray(int length) {
4031 if (length < 0 || length > ByteArray::kMaxLength) {
4032 return Failure::OutOfMemoryException(0x8);
4033 }
4034 int size = ByteArray::SizeFor(length);
4035 AllocationSpace space =
4036 (size > Page::kMaxNonCodeHeapObjectSize) ? LO_SPACE : NEW_SPACE;
4037 Object* result; 4014 Object* result;
4038 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); 4015 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
4039 if (!maybe_result->ToObject(&result)) return maybe_result; 4016 if (!maybe_result->ToObject(&result)) return maybe_result;
4040 } 4017 }
4041 4018
4042 reinterpret_cast<ByteArray*>(result)->set_map_no_write_barrier( 4019 reinterpret_cast<ByteArray*>(result)->set_map_no_write_barrier(
4043 byte_array_map()); 4020 byte_array_map());
4044 reinterpret_cast<ByteArray*>(result)->set_length(length); 4021 reinterpret_cast<ByteArray*>(result)->set_length(length);
4045 return result; 4022 return result;
4046 } 4023 }
(...skipping 10 matching lines...) Expand all
4057 filler->set_map_no_write_barrier(free_space_map()); 4034 filler->set_map_no_write_barrier(free_space_map());
4058 FreeSpace::cast(filler)->set_size(size); 4035 FreeSpace::cast(filler)->set_size(size);
4059 } 4036 }
4060 } 4037 }
4061 4038
4062 4039
4063 MaybeObject* Heap::AllocateExternalArray(int length, 4040 MaybeObject* Heap::AllocateExternalArray(int length,
4064 ExternalArrayType array_type, 4041 ExternalArrayType array_type,
4065 void* external_pointer, 4042 void* external_pointer,
4066 PretenureFlag pretenure) { 4043 PretenureFlag pretenure) {
4067 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 4044 int size = ExternalArray::kAlignedSize;
4045 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure);
4068 Object* result; 4046 Object* result;
4069 { MaybeObject* maybe_result = AllocateRaw(ExternalArray::kAlignedSize, 4047 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
4070 space,
4071 OLD_DATA_SPACE);
4072 if (!maybe_result->ToObject(&result)) return maybe_result; 4048 if (!maybe_result->ToObject(&result)) return maybe_result;
4073 } 4049 }
4074 4050
4075 reinterpret_cast<ExternalArray*>(result)->set_map_no_write_barrier( 4051 reinterpret_cast<ExternalArray*>(result)->set_map_no_write_barrier(
4076 MapForExternalArrayType(array_type)); 4052 MapForExternalArrayType(array_type));
4077 reinterpret_cast<ExternalArray*>(result)->set_length(length); 4053 reinterpret_cast<ExternalArray*>(result)->set_length(length);
4078 reinterpret_cast<ExternalArray*>(result)->set_external_pointer( 4054 reinterpret_cast<ExternalArray*>(result)->set_external_pointer(
4079 external_pointer); 4055 external_pointer);
4080 4056
4081 return result; 4057 return result;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
4498 int prop_size = map->InitialPropertiesLength(); 4474 int prop_size = map->InitialPropertiesLength();
4499 ASSERT(prop_size >= 0); 4475 ASSERT(prop_size >= 0);
4500 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size, pretenure); 4476 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size, pretenure);
4501 if (!maybe_properties->To(&properties)) return maybe_properties; 4477 if (!maybe_properties->To(&properties)) return maybe_properties;
4502 } 4478 }
4503 } else { 4479 } else {
4504 properties = empty_fixed_array(); 4480 properties = empty_fixed_array();
4505 } 4481 }
4506 4482
4507 // Allocate the JSObject. 4483 // Allocate the JSObject.
4508 AllocationSpace space = 4484 int size = map->instance_size();
4509 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; 4485 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, pretenure);
4510 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE;
4511 Object* obj; 4486 Object* obj;
4512 MaybeObject* maybe_obj = Allocate(map, space); 4487 MaybeObject* maybe_obj = Allocate(map, space);
4513 if (!maybe_obj->To(&obj)) return maybe_obj; 4488 if (!maybe_obj->To(&obj)) return maybe_obj;
4514 4489
4515 // Initialize the JSObject. 4490 // Initialize the JSObject.
4516 InitializeJSObjectFromMap(JSObject::cast(obj), properties, map); 4491 InitializeJSObjectFromMap(JSObject::cast(obj), properties, map);
4517 ASSERT(JSObject::cast(obj)->HasFastElements() || 4492 ASSERT(JSObject::cast(obj)->HasFastElements() ||
4518 JSObject::cast(obj)->HasExternalArrayElements()); 4493 JSObject::cast(obj)->HasExternalArrayElements());
4519 return obj; 4494 return obj;
4520 } 4495 }
(...skipping 12 matching lines...) Expand all
4533 4508
4534 // Allocate the backing storage for the properties. 4509 // Allocate the backing storage for the properties.
4535 int prop_size = map->InitialPropertiesLength(); 4510 int prop_size = map->InitialPropertiesLength();
4536 ASSERT(prop_size >= 0); 4511 ASSERT(prop_size >= 0);
4537 FixedArray* properties; 4512 FixedArray* properties;
4538 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); 4513 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size);
4539 if (!maybe_properties->To(&properties)) return maybe_properties; 4514 if (!maybe_properties->To(&properties)) return maybe_properties;
4540 } 4515 }
4541 4516
4542 // Allocate the JSObject. 4517 // Allocate the JSObject.
4543 AllocationSpace space = NEW_SPACE; 4518 int size = map->instance_size();
4544 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; 4519 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, NOT_TENURED);
4545 Object* obj; 4520 Object* obj;
4546 MaybeObject* maybe_obj = 4521 MaybeObject* maybe_obj =
4547 AllocateWithAllocationSite(map, space, allocation_site); 4522 AllocateWithAllocationSite(map, space, allocation_site);
4548 if (!maybe_obj->To(&obj)) return maybe_obj; 4523 if (!maybe_obj->To(&obj)) return maybe_obj;
4549 4524
4550 // Initialize the JSObject. 4525 // Initialize the JSObject.
4551 InitializeJSObjectFromMap(JSObject::cast(obj), properties, map); 4526 InitializeJSObjectFromMap(JSObject::cast(obj), properties, map);
4552 ASSERT(JSObject::cast(obj)->HasFastElements()); 4527 ASSERT(JSObject::cast(obj)->HasFastElements());
4553 return obj; 4528 return obj;
4554 } 4529 }
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
5311 } 5286 }
5312 map = ascii_internalized_string_map(); 5287 map = ascii_internalized_string_map();
5313 size = SeqOneByteString::SizeFor(chars); 5288 size = SeqOneByteString::SizeFor(chars);
5314 } else { 5289 } else {
5315 if (chars > SeqTwoByteString::kMaxLength) { 5290 if (chars > SeqTwoByteString::kMaxLength) {
5316 return Failure::OutOfMemoryException(0xa); 5291 return Failure::OutOfMemoryException(0xa);
5317 } 5292 }
5318 map = internalized_string_map(); 5293 map = internalized_string_map();
5319 size = SeqTwoByteString::SizeFor(chars); 5294 size = SeqTwoByteString::SizeFor(chars);
5320 } 5295 }
5296 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED);
5321 5297
5322 // Allocate string. 5298 // Allocate string.
5323 Object* result; 5299 Object* result;
5324 { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize) 5300 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
5325 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE)
5326 : old_data_space_->AllocateRaw(size);
5327 if (!maybe_result->ToObject(&result)) return maybe_result; 5301 if (!maybe_result->ToObject(&result)) return maybe_result;
5328 } 5302 }
5329 5303
5330 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(map); 5304 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(map);
5331 // Set length and hash fields of the allocated string. 5305 // Set length and hash fields of the allocated string.
5332 String* answer = String::cast(result); 5306 String* answer = String::cast(result);
5333 answer->set_length(chars); 5307 answer->set_length(chars);
5334 answer->set_hash_field(hash_field); 5308 answer->set_hash_field(hash_field);
5335 5309
5336 ASSERT_EQ(size, answer->Size()); 5310 ASSERT_EQ(size, answer->Size());
(...skipping 18 matching lines...) Expand all
5355 Vector<const char>, int, uint32_t); 5329 Vector<const char>, int, uint32_t);
5356 5330
5357 5331
5358 MaybeObject* Heap::AllocateRawOneByteString(int length, 5332 MaybeObject* Heap::AllocateRawOneByteString(int length,
5359 PretenureFlag pretenure) { 5333 PretenureFlag pretenure) {
5360 if (length < 0 || length > SeqOneByteString::kMaxLength) { 5334 if (length < 0 || length > SeqOneByteString::kMaxLength) {
5361 return Failure::OutOfMemoryException(0xb); 5335 return Failure::OutOfMemoryException(0xb);
5362 } 5336 }
5363 int size = SeqOneByteString::SizeFor(length); 5337 int size = SeqOneByteString::SizeFor(length);
5364 ASSERT(size <= SeqOneByteString::kMaxSize); 5338 ASSERT(size <= SeqOneByteString::kMaxSize);
5365 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 5339 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure);
5366 AllocationSpace retry_space = OLD_DATA_SPACE;
5367
5368 if (size > Page::kMaxNonCodeHeapObjectSize) {
5369 // Allocate in large object space, retry space will be ignored.
5370 space = LO_SPACE;
5371 }
5372 5340
5373 Object* result; 5341 Object* result;
5374 { MaybeObject* maybe_result = AllocateRaw(size, space, retry_space); 5342 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
5375 if (!maybe_result->ToObject(&result)) return maybe_result; 5343 if (!maybe_result->ToObject(&result)) return maybe_result;
5376 } 5344 }
5377 5345
5378 // Partially initialize the object. 5346 // Partially initialize the object.
5379 HeapObject::cast(result)->set_map_no_write_barrier(ascii_string_map()); 5347 HeapObject::cast(result)->set_map_no_write_barrier(ascii_string_map());
5380 String::cast(result)->set_length(length); 5348 String::cast(result)->set_length(length);
5381 String::cast(result)->set_hash_field(String::kEmptyHashField); 5349 String::cast(result)->set_hash_field(String::kEmptyHashField);
5382 ASSERT_EQ(size, HeapObject::cast(result)->Size()); 5350 ASSERT_EQ(size, HeapObject::cast(result)->Size());
5383 5351
5384 return result; 5352 return result;
5385 } 5353 }
5386 5354
5387 5355
5388 MaybeObject* Heap::AllocateRawTwoByteString(int length, 5356 MaybeObject* Heap::AllocateRawTwoByteString(int length,
5389 PretenureFlag pretenure) { 5357 PretenureFlag pretenure) {
5390 if (length < 0 || length > SeqTwoByteString::kMaxLength) { 5358 if (length < 0 || length > SeqTwoByteString::kMaxLength) {
5391 return Failure::OutOfMemoryException(0xc); 5359 return Failure::OutOfMemoryException(0xc);
5392 } 5360 }
5393 int size = SeqTwoByteString::SizeFor(length); 5361 int size = SeqTwoByteString::SizeFor(length);
5394 ASSERT(size <= SeqTwoByteString::kMaxSize); 5362 ASSERT(size <= SeqTwoByteString::kMaxSize);
5395 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 5363 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure);
5396 AllocationSpace retry_space = OLD_DATA_SPACE;
5397
5398 if (size > Page::kMaxNonCodeHeapObjectSize) {
5399 // Allocate in large object space, retry space will be ignored.
5400 space = LO_SPACE;
5401 }
5402 5364
5403 Object* result; 5365 Object* result;
5404 { MaybeObject* maybe_result = AllocateRaw(size, space, retry_space); 5366 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
5405 if (!maybe_result->ToObject(&result)) return maybe_result; 5367 if (!maybe_result->ToObject(&result)) return maybe_result;
5406 } 5368 }
5407 5369
5408 // Partially initialize the object. 5370 // Partially initialize the object.
5409 HeapObject::cast(result)->set_map_no_write_barrier(string_map()); 5371 HeapObject::cast(result)->set_map_no_write_barrier(string_map());
5410 String::cast(result)->set_length(length); 5372 String::cast(result)->set_length(length);
5411 String::cast(result)->set_hash_field(String::kEmptyHashField); 5373 String::cast(result)->set_hash_field(String::kEmptyHashField);
5412 ASSERT_EQ(size, HeapObject::cast(result)->Size()); 5374 ASSERT_EQ(size, HeapObject::cast(result)->Size());
5413 return result; 5375 return result;
5414 } 5376 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
5538 MemsetPointer(array->data_start(), undefined_value(), length); 5500 MemsetPointer(array->data_start(), undefined_value(), length);
5539 return result; 5501 return result;
5540 } 5502 }
5541 5503
5542 5504
5543 MaybeObject* Heap::AllocateRawFixedArray(int length, PretenureFlag pretenure) { 5505 MaybeObject* Heap::AllocateRawFixedArray(int length, PretenureFlag pretenure) {
5544 if (length < 0 || length > FixedArray::kMaxLength) { 5506 if (length < 0 || length > FixedArray::kMaxLength) {
5545 return Failure::OutOfMemoryException(0xe); 5507 return Failure::OutOfMemoryException(0xe);
5546 } 5508 }
5547 int size = FixedArray::SizeFor(length); 5509 int size = FixedArray::SizeFor(length);
5548 AllocationSpace space = 5510 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, pretenure);
5549 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE;
5550 AllocationSpace retry_space = OLD_POINTER_SPACE;
5551 5511
5552 if (size > Page::kMaxNonCodeHeapObjectSize) { 5512 return AllocateRaw(size, space, OLD_POINTER_SPACE);
5553 // Allocate in large object space, retry space will be ignored.
5554 space = LO_SPACE;
5555 }
5556
5557 return AllocateRaw(size, space, retry_space);
5558 } 5513 }
5559 5514
5560 5515
5561 MUST_USE_RESULT static MaybeObject* AllocateFixedArrayWithFiller( 5516 MUST_USE_RESULT static MaybeObject* AllocateFixedArrayWithFiller(
5562 Heap* heap, 5517 Heap* heap,
5563 int length, 5518 int length,
5564 PretenureFlag pretenure, 5519 PretenureFlag pretenure,
5565 Object* filler) { 5520 Object* filler) {
5566 ASSERT(length >= 0); 5521 ASSERT(length >= 0);
5567 ASSERT(heap->empty_fixed_array()->IsFixedArray()); 5522 ASSERT(heap->empty_fixed_array()->IsFixedArray());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
5665 return elements; 5620 return elements;
5666 } 5621 }
5667 5622
5668 5623
5669 MaybeObject* Heap::AllocateRawFixedDoubleArray(int length, 5624 MaybeObject* Heap::AllocateRawFixedDoubleArray(int length,
5670 PretenureFlag pretenure) { 5625 PretenureFlag pretenure) {
5671 if (length < 0 || length > FixedDoubleArray::kMaxLength) { 5626 if (length < 0 || length > FixedDoubleArray::kMaxLength) {
5672 return Failure::OutOfMemoryException(0xf); 5627 return Failure::OutOfMemoryException(0xf);
5673 } 5628 }
5674 int size = FixedDoubleArray::SizeFor(length); 5629 int size = FixedDoubleArray::SizeFor(length);
5675 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
5676 AllocationSpace retry_space = OLD_DATA_SPACE;
5677
5678 #ifndef V8_HOST_ARCH_64_BIT 5630 #ifndef V8_HOST_ARCH_64_BIT
5679 size += kPointerSize; 5631 size += kPointerSize;
5680 #endif 5632 #endif
5681 5633 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure);
5682 if (size > Page::kMaxNonCodeHeapObjectSize) {
5683 // Allocate in large object space, retry space will be ignored.
5684 space = LO_SPACE;
5685 }
5686 5634
5687 HeapObject* object; 5635 HeapObject* object;
5688 { MaybeObject* maybe_object = AllocateRaw(size, space, retry_space); 5636 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_DATA_SPACE);
5689 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; 5637 if (!maybe_object->To<HeapObject>(&object)) return maybe_object;
5690 } 5638 }
5691 5639
5692 return EnsureDoubleAligned(this, object, size); 5640 return EnsureDoubleAligned(this, object, size);
5693 } 5641 }
5694 5642
5695 5643
5696 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { 5644 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
5697 Object* result; 5645 Object* result;
5698 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); 5646 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
5882 switch (type) { 5830 switch (type) {
5883 #define MAKE_CASE(NAME, Name, name) \ 5831 #define MAKE_CASE(NAME, Name, name) \
5884 case NAME##_TYPE: map = name##_map(); break; 5832 case NAME##_TYPE: map = name##_map(); break;
5885 STRUCT_LIST(MAKE_CASE) 5833 STRUCT_LIST(MAKE_CASE)
5886 #undef MAKE_CASE 5834 #undef MAKE_CASE
5887 default: 5835 default:
5888 UNREACHABLE(); 5836 UNREACHABLE();
5889 return Failure::InternalError(); 5837 return Failure::InternalError();
5890 } 5838 }
5891 int size = map->instance_size(); 5839 int size = map->instance_size();
5892 AllocationSpace space = 5840 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED);
5893 (size > Page::kMaxNonCodeHeapObjectSize) ? LO_SPACE : OLD_POINTER_SPACE;
5894 Object* result; 5841 Object* result;
5895 { MaybeObject* maybe_result = Allocate(map, space); 5842 { MaybeObject* maybe_result = Allocate(map, space);
5896 if (!maybe_result->ToObject(&result)) return maybe_result; 5843 if (!maybe_result->ToObject(&result)) return maybe_result;
5897 } 5844 }
5898 Struct::cast(result)->InitializeBody(size); 5845 Struct::cast(result)->InitializeBody(size);
5899 return result; 5846 return result;
5900 } 5847 }
5901 5848
5902 5849
5903 bool Heap::IsHeapIterable() { 5850 bool Heap::IsHeapIterable() {
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
8045 if (FLAG_parallel_recompilation) { 7992 if (FLAG_parallel_recompilation) {
8046 heap_->relocation_mutex_->Lock(); 7993 heap_->relocation_mutex_->Lock();
8047 #ifdef DEBUG 7994 #ifdef DEBUG
8048 heap_->relocation_mutex_locked_by_optimizer_thread_ = 7995 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8049 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 7996 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8050 #endif // DEBUG 7997 #endif // DEBUG
8051 } 7998 }
8052 } 7999 }
8053 8000
8054 } } // namespace v8::internal 8001 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698