OLD | NEW |
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 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 | 2812 |
2813 MaybeObject* Heap::AllocateBox(Object* value, PretenureFlag pretenure) { | 2813 MaybeObject* Heap::AllocateBox(Object* value, PretenureFlag pretenure) { |
2814 Box* result; | 2814 Box* result; |
2815 MaybeObject* maybe_result = AllocateStruct(BOX_TYPE); | 2815 MaybeObject* maybe_result = AllocateStruct(BOX_TYPE); |
2816 if (!maybe_result->To(&result)) return maybe_result; | 2816 if (!maybe_result->To(&result)) return maybe_result; |
2817 result->set_value(value); | 2817 result->set_value(value); |
2818 return result; | 2818 return result; |
2819 } | 2819 } |
2820 | 2820 |
2821 | 2821 |
| 2822 MaybeObject* Heap::AllocateAllocationSite() { |
| 2823 Object* result; |
| 2824 { MaybeObject* maybe_result = Allocate(allocation_site_map(), |
| 2825 OLD_POINTER_SPACE); |
| 2826 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2827 } |
| 2828 AllocationSite::cast(result)->Initialize(); |
| 2829 return result; |
| 2830 } |
| 2831 |
| 2832 |
2822 MaybeObject* Heap::CreateOddball(const char* to_string, | 2833 MaybeObject* Heap::CreateOddball(const char* to_string, |
2823 Object* to_number, | 2834 Object* to_number, |
2824 byte kind) { | 2835 byte kind) { |
2825 Object* result; | 2836 Object* result; |
2826 { MaybeObject* maybe_result = Allocate(oddball_map(), OLD_POINTER_SPACE); | 2837 { MaybeObject* maybe_result = Allocate(oddball_map(), OLD_POINTER_SPACE); |
2827 if (!maybe_result->ToObject(&result)) return maybe_result; | 2838 if (!maybe_result->ToObject(&result)) return maybe_result; |
2828 } | 2839 } |
2829 return Oddball::cast(result)->Initialize(to_string, to_number, kind); | 2840 return Oddball::cast(result)->Initialize(to_string, to_number, kind); |
2830 } | 2841 } |
2831 | 2842 |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4117 #ifdef VERIFY_HEAP | 4128 #ifdef VERIFY_HEAP |
4118 if (FLAG_verify_heap) { | 4129 if (FLAG_verify_heap) { |
4119 code->Verify(); | 4130 code->Verify(); |
4120 } | 4131 } |
4121 #endif | 4132 #endif |
4122 return new_code; | 4133 return new_code; |
4123 } | 4134 } |
4124 | 4135 |
4125 | 4136 |
4126 MaybeObject* Heap::AllocateWithAllocationSite(Map* map, AllocationSpace space, | 4137 MaybeObject* Heap::AllocateWithAllocationSite(Map* map, AllocationSpace space, |
4127 Handle<Object> allocation_site_info_payload) { | 4138 Handle<AllocationSite> allocation_site) { |
4128 ASSERT(gc_state_ == NOT_IN_GC); | 4139 ASSERT(gc_state_ == NOT_IN_GC); |
4129 ASSERT(map->instance_type() != MAP_TYPE); | 4140 ASSERT(map->instance_type() != MAP_TYPE); |
4130 // If allocation failures are disallowed, we may allocate in a different | 4141 // If allocation failures are disallowed, we may allocate in a different |
4131 // space when new space is full and the object is not a large object. | 4142 // space when new space is full and the object is not a large object. |
4132 AllocationSpace retry_space = | 4143 AllocationSpace retry_space = |
4133 (space != NEW_SPACE) ? space : TargetSpaceId(map->instance_type()); | 4144 (space != NEW_SPACE) ? space : TargetSpaceId(map->instance_type()); |
4134 int size = map->instance_size() + AllocationSiteInfo::kSize; | 4145 int size = map->instance_size() + AllocationSiteInfo::kSize; |
4135 Object* result; | 4146 Object* result; |
4136 MaybeObject* maybe_result = AllocateRaw(size, space, retry_space); | 4147 MaybeObject* maybe_result = AllocateRaw(size, space, retry_space); |
4137 if (!maybe_result->ToObject(&result)) return maybe_result; | 4148 if (!maybe_result->ToObject(&result)) return maybe_result; |
4138 // No need for write barrier since object is white and map is in old space. | 4149 // No need for write barrier since object is white and map is in old space. |
4139 HeapObject::cast(result)->set_map_no_write_barrier(map); | 4150 HeapObject::cast(result)->set_map_no_write_barrier(map); |
4140 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( | 4151 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( |
4141 reinterpret_cast<Address>(result) + map->instance_size()); | 4152 reinterpret_cast<Address>(result) + map->instance_size()); |
4142 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); | 4153 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); |
4143 alloc_info->set_payload(*allocation_site_info_payload, SKIP_WRITE_BARRIER); | 4154 alloc_info->set_payload(*allocation_site, SKIP_WRITE_BARRIER); |
4144 return result; | 4155 return result; |
4145 } | 4156 } |
4146 | 4157 |
4147 | 4158 |
4148 MaybeObject* Heap::Allocate(Map* map, AllocationSpace space) { | 4159 MaybeObject* Heap::Allocate(Map* map, AllocationSpace space) { |
4149 ASSERT(gc_state_ == NOT_IN_GC); | 4160 ASSERT(gc_state_ == NOT_IN_GC); |
4150 ASSERT(map->instance_type() != MAP_TYPE); | 4161 ASSERT(map->instance_type() != MAP_TYPE); |
4151 // If allocation failures are disallowed, we may allocate in a different | 4162 // If allocation failures are disallowed, we may allocate in a different |
4152 // space when new space is full and the object is not a large object. | 4163 // space when new space is full and the object is not a large object. |
4153 AllocationSpace retry_space = | 4164 AllocationSpace retry_space = |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4389 InitializeJSObjectFromMap(JSObject::cast(obj), | 4400 InitializeJSObjectFromMap(JSObject::cast(obj), |
4390 FixedArray::cast(properties), | 4401 FixedArray::cast(properties), |
4391 map); | 4402 map); |
4392 ASSERT(JSObject::cast(obj)->HasFastElements() || | 4403 ASSERT(JSObject::cast(obj)->HasFastElements() || |
4393 JSObject::cast(obj)->HasExternalArrayElements()); | 4404 JSObject::cast(obj)->HasExternalArrayElements()); |
4394 return obj; | 4405 return obj; |
4395 } | 4406 } |
4396 | 4407 |
4397 | 4408 |
4398 MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map, | 4409 MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map, |
4399 Handle<Object> allocation_site_info_payload) { | 4410 Handle<AllocationSite> allocation_site) { |
4400 // JSFunctions should be allocated using AllocateFunction to be | 4411 // JSFunctions should be allocated using AllocateFunction to be |
4401 // properly initialized. | 4412 // properly initialized. |
4402 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); | 4413 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
4403 | 4414 |
4404 // Both types of global objects should be allocated using | 4415 // Both types of global objects should be allocated using |
4405 // AllocateGlobalObject to be properly initialized. | 4416 // AllocateGlobalObject to be properly initialized. |
4406 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 4417 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
4407 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 4418 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
4408 | 4419 |
4409 // Allocate the backing storage for the properties. | 4420 // Allocate the backing storage for the properties. |
4410 int prop_size = map->InitialPropertiesLength(); | 4421 int prop_size = map->InitialPropertiesLength(); |
4411 ASSERT(prop_size >= 0); | 4422 ASSERT(prop_size >= 0); |
4412 Object* properties; | 4423 Object* properties; |
4413 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); | 4424 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); |
4414 if (!maybe_properties->ToObject(&properties)) return maybe_properties; | 4425 if (!maybe_properties->ToObject(&properties)) return maybe_properties; |
4415 } | 4426 } |
4416 | 4427 |
4417 // Allocate the JSObject. | 4428 // Allocate the JSObject. |
4418 AllocationSpace space = NEW_SPACE; | 4429 AllocationSpace space = NEW_SPACE; |
4419 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; | 4430 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
4420 Object* obj; | 4431 Object* obj; |
4421 MaybeObject* maybe_obj = AllocateWithAllocationSite(map, space, | 4432 MaybeObject* maybe_obj = AllocateWithAllocationSite(map, space, |
4422 allocation_site_info_payload); | 4433 allocation_site); |
4423 if (!maybe_obj->To(&obj)) return maybe_obj; | 4434 if (!maybe_obj->To(&obj)) return maybe_obj; |
4424 | 4435 |
4425 // Initialize the JSObject. | 4436 // Initialize the JSObject. |
4426 InitializeJSObjectFromMap(JSObject::cast(obj), | 4437 InitializeJSObjectFromMap(JSObject::cast(obj), |
4427 FixedArray::cast(properties), | 4438 FixedArray::cast(properties), |
4428 map); | 4439 map); |
4429 ASSERT(JSObject::cast(obj)->HasFastElements()); | 4440 ASSERT(JSObject::cast(obj)->HasFastElements()); |
4430 return obj; | 4441 return obj; |
4431 } | 4442 } |
4432 | 4443 |
(...skipping 15 matching lines...) Expand all Loading... |
4448 #ifdef DEBUG | 4459 #ifdef DEBUG |
4449 // Make sure result is NOT a global object if valid. | 4460 // Make sure result is NOT a global object if valid. |
4450 Object* non_failure; | 4461 Object* non_failure; |
4451 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); | 4462 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); |
4452 #endif | 4463 #endif |
4453 return result; | 4464 return result; |
4454 } | 4465 } |
4455 | 4466 |
4456 | 4467 |
4457 MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor, | 4468 MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor, |
4458 Handle<Object> allocation_site_info_payload) { | 4469 Handle<AllocationSite> allocation_site) { |
4459 // Allocate the initial map if absent. | 4470 // Allocate the initial map if absent. |
4460 if (!constructor->has_initial_map()) { | 4471 if (!constructor->has_initial_map()) { |
4461 Object* initial_map; | 4472 Object* initial_map; |
4462 { MaybeObject* maybe_initial_map = AllocateInitialMap(constructor); | 4473 { MaybeObject* maybe_initial_map = AllocateInitialMap(constructor); |
4463 if (!maybe_initial_map->ToObject(&initial_map)) return maybe_initial_map; | 4474 if (!maybe_initial_map->ToObject(&initial_map)) return maybe_initial_map; |
4464 } | 4475 } |
4465 constructor->set_initial_map(Map::cast(initial_map)); | 4476 constructor->set_initial_map(Map::cast(initial_map)); |
4466 Map::cast(initial_map)->set_constructor(constructor); | 4477 Map::cast(initial_map)->set_constructor(constructor); |
4467 } | 4478 } |
4468 // Allocate the object based on the constructors initial map, or the payload | 4479 // Allocate the object based on the constructors initial map, or the payload |
4469 // advice | 4480 // advice |
4470 Map* initial_map = constructor->initial_map(); | 4481 Map* initial_map = constructor->initial_map(); |
4471 | 4482 |
4472 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast( | 4483 Smi* smi = Smi::cast(allocation_site->payload()); |
4473 *allocation_site_info_payload); | |
4474 Smi* smi = Smi::cast(cell->value()); | |
4475 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); | 4484 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); |
4476 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; | 4485 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; |
4477 if (to_kind != initial_map->elements_kind()) { | 4486 if (to_kind != initial_map->elements_kind()) { |
4478 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); | 4487 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); |
4479 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; | 4488 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; |
4480 // Possibly alter the mode, since we found an updated elements kind | 4489 // Possibly alter the mode, since we found an updated elements kind |
4481 // in the type info cell. | 4490 // in the type info cell. |
4482 mode = AllocationSiteInfo::GetMode(to_kind); | 4491 mode = AllocationSite::GetMode(to_kind); |
4483 } | 4492 } |
4484 | 4493 |
4485 MaybeObject* result; | 4494 MaybeObject* result; |
4486 if (mode == TRACK_ALLOCATION_SITE) { | 4495 if (mode == TRACK_ALLOCATION_SITE) { |
4487 result = AllocateJSObjectFromMapWithAllocationSite(initial_map, | 4496 result = AllocateJSObjectFromMapWithAllocationSite(initial_map, |
4488 allocation_site_info_payload); | 4497 allocation_site); |
4489 } else { | 4498 } else { |
4490 result = AllocateJSObjectFromMap(initial_map, NOT_TENURED); | 4499 result = AllocateJSObjectFromMap(initial_map, NOT_TENURED); |
4491 } | 4500 } |
4492 #ifdef DEBUG | 4501 #ifdef DEBUG |
4493 // Make sure result is NOT a global object if valid. | 4502 // Make sure result is NOT a global object if valid. |
4494 Object* non_failure; | 4503 Object* non_failure; |
4495 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); | 4504 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); |
4496 #endif | 4505 #endif |
4497 return result; | 4506 return result; |
4498 } | 4507 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4573 array->set_elements(elms); | 4582 array->set_elements(elms); |
4574 array->set_length(Smi::FromInt(length)); | 4583 array->set_length(Smi::FromInt(length)); |
4575 return array; | 4584 return array; |
4576 } | 4585 } |
4577 | 4586 |
4578 | 4587 |
4579 MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite( | 4588 MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite( |
4580 ElementsKind elements_kind, | 4589 ElementsKind elements_kind, |
4581 int length, | 4590 int length, |
4582 int capacity, | 4591 int capacity, |
4583 Handle<Object> allocation_site_payload, | 4592 Handle<AllocationSite> allocation_site, |
4584 ArrayStorageAllocationMode mode) { | 4593 ArrayStorageAllocationMode mode) { |
4585 MaybeObject* maybe_array = AllocateJSArrayWithAllocationSite(elements_kind, | 4594 MaybeObject* maybe_array = AllocateJSArrayWithAllocationSite(elements_kind, |
4586 allocation_site_payload); | 4595 allocation_site); |
4587 JSArray* array; | 4596 JSArray* array; |
4588 if (!maybe_array->To(&array)) return maybe_array; | 4597 if (!maybe_array->To(&array)) return maybe_array; |
4589 return AllocateJSArrayStorage(array, length, capacity, mode); | 4598 return AllocateJSArrayStorage(array, length, capacity, mode); |
4590 } | 4599 } |
4591 | 4600 |
4592 | 4601 |
4593 MaybeObject* Heap::AllocateJSArrayStorage( | 4602 MaybeObject* Heap::AllocateJSArrayStorage( |
4594 JSArray* array, | 4603 JSArray* array, |
4595 int length, | 4604 int length, |
4596 int capacity, | 4605 int capacity, |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4825 { MaybeObject* maybe_prop = CopyFixedArray(properties); | 4834 { MaybeObject* maybe_prop = CopyFixedArray(properties); |
4826 if (!maybe_prop->ToObject(&prop)) return maybe_prop; | 4835 if (!maybe_prop->ToObject(&prop)) return maybe_prop; |
4827 } | 4836 } |
4828 JSObject::cast(clone)->set_properties(FixedArray::cast(prop), wb_mode); | 4837 JSObject::cast(clone)->set_properties(FixedArray::cast(prop), wb_mode); |
4829 } | 4838 } |
4830 // Return the new clone. | 4839 // Return the new clone. |
4831 return clone; | 4840 return clone; |
4832 } | 4841 } |
4833 | 4842 |
4834 | 4843 |
4835 MaybeObject* Heap::CopyJSObjectWithAllocationSite(JSObject* source) { | 4844 MaybeObject* Heap::CopyJSObjectWithAllocationSite(JSObject* source, |
| 4845 AllocationSite* site) { |
4836 // Never used to copy functions. If functions need to be copied we | 4846 // Never used to copy functions. If functions need to be copied we |
4837 // have to be careful to clear the literals array. | 4847 // have to be careful to clear the literals array. |
4838 SLOW_ASSERT(!source->IsJSFunction()); | 4848 SLOW_ASSERT(!source->IsJSFunction()); |
4839 | 4849 |
4840 // Make the clone. | 4850 // Make the clone. |
4841 Map* map = source->map(); | 4851 Map* map = source->map(); |
4842 int object_size = map->instance_size(); | 4852 int object_size = map->instance_size(); |
4843 Object* clone; | 4853 Object* clone; |
4844 | 4854 |
4845 ASSERT(map->CanTrackAllocationSite()); | 4855 ASSERT(map->CanTrackAllocationSite()); |
(...skipping 29 matching lines...) Expand all Loading... |
4875 } | 4885 } |
4876 | 4886 |
4877 // Track allocation site information, if we failed to allocate it inline. | 4887 // Track allocation site information, if we failed to allocate it inline. |
4878 if (InNewSpace(clone) && | 4888 if (InNewSpace(clone) && |
4879 adjusted_object_size == object_size) { | 4889 adjusted_object_size == object_size) { |
4880 MaybeObject* maybe_alloc_info = | 4890 MaybeObject* maybe_alloc_info = |
4881 AllocateStruct(ALLOCATION_SITE_INFO_TYPE); | 4891 AllocateStruct(ALLOCATION_SITE_INFO_TYPE); |
4882 AllocationSiteInfo* alloc_info; | 4892 AllocationSiteInfo* alloc_info; |
4883 if (maybe_alloc_info->To(&alloc_info)) { | 4893 if (maybe_alloc_info->To(&alloc_info)) { |
4884 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); | 4894 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); |
4885 alloc_info->set_payload(source, SKIP_WRITE_BARRIER); | 4895 alloc_info->set_payload(site, SKIP_WRITE_BARRIER); |
4886 } | 4896 } |
4887 } | 4897 } |
4888 } else { | 4898 } else { |
4889 wb_mode = SKIP_WRITE_BARRIER; | 4899 wb_mode = SKIP_WRITE_BARRIER; |
4890 adjusted_object_size += AllocationSiteInfo::kSize; | 4900 adjusted_object_size += AllocationSiteInfo::kSize; |
4891 | 4901 |
4892 { MaybeObject* maybe_clone = new_space_.AllocateRaw(adjusted_object_size); | 4902 { MaybeObject* maybe_clone = new_space_.AllocateRaw(adjusted_object_size); |
4893 if (!maybe_clone->ToObject(&clone)) return maybe_clone; | 4903 if (!maybe_clone->ToObject(&clone)) return maybe_clone; |
4894 } | 4904 } |
4895 SLOW_ASSERT(InNewSpace(clone)); | 4905 SLOW_ASSERT(InNewSpace(clone)); |
4896 // Since we know the clone is allocated in new space, we can copy | 4906 // Since we know the clone is allocated in new space, we can copy |
4897 // the contents without worrying about updating the write barrier. | 4907 // the contents without worrying about updating the write barrier. |
4898 CopyBlock(HeapObject::cast(clone)->address(), | 4908 CopyBlock(HeapObject::cast(clone)->address(), |
4899 source->address(), | 4909 source->address(), |
4900 object_size); | 4910 object_size); |
4901 } | 4911 } |
4902 | 4912 |
4903 if (adjusted_object_size > object_size) { | 4913 if (adjusted_object_size > object_size) { |
4904 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( | 4914 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( |
4905 reinterpret_cast<Address>(clone) + object_size); | 4915 reinterpret_cast<Address>(clone) + object_size); |
4906 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); | 4916 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); |
4907 alloc_info->set_payload(source, SKIP_WRITE_BARRIER); | 4917 alloc_info->set_payload(site, SKIP_WRITE_BARRIER); |
4908 } | 4918 } |
4909 | 4919 |
4910 SLOW_ASSERT( | 4920 SLOW_ASSERT( |
4911 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); | 4921 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); |
4912 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); | 4922 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); |
4913 FixedArray* properties = FixedArray::cast(source->properties()); | 4923 FixedArray* properties = FixedArray::cast(source->properties()); |
4914 // Update elements if necessary. | 4924 // Update elements if necessary. |
4915 if (elements->length() > 0) { | 4925 if (elements->length() > 0) { |
4916 Object* elem; | 4926 Object* elem; |
4917 { MaybeObject* maybe_elem; | 4927 { MaybeObject* maybe_elem; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5313 JSFunction* array_function = native_context->array_function(); | 5323 JSFunction* array_function = native_context->array_function(); |
5314 Map* map = array_function->initial_map(); | 5324 Map* map = array_function->initial_map(); |
5315 Map* transition_map = isolate()->get_initial_js_array_map(elements_kind); | 5325 Map* transition_map = isolate()->get_initial_js_array_map(elements_kind); |
5316 if (transition_map != NULL) map = transition_map; | 5326 if (transition_map != NULL) map = transition_map; |
5317 return AllocateJSObjectFromMap(map, pretenure); | 5327 return AllocateJSObjectFromMap(map, pretenure); |
5318 } | 5328 } |
5319 | 5329 |
5320 | 5330 |
5321 MaybeObject* Heap::AllocateJSArrayWithAllocationSite( | 5331 MaybeObject* Heap::AllocateJSArrayWithAllocationSite( |
5322 ElementsKind elements_kind, | 5332 ElementsKind elements_kind, |
5323 Handle<Object> allocation_site_info_payload) { | 5333 Handle<AllocationSite> allocation_site) { |
5324 Context* native_context = isolate()->context()->native_context(); | 5334 Context* native_context = isolate()->context()->native_context(); |
5325 JSFunction* array_function = native_context->array_function(); | 5335 JSFunction* array_function = native_context->array_function(); |
5326 Map* map = array_function->initial_map(); | 5336 Map* map = array_function->initial_map(); |
5327 Object* maybe_map_array = native_context->js_array_maps(); | 5337 Object* maybe_map_array = native_context->js_array_maps(); |
5328 if (!maybe_map_array->IsUndefined()) { | 5338 if (!maybe_map_array->IsUndefined()) { |
5329 Object* maybe_transitioned_map = | 5339 Object* maybe_transitioned_map = |
5330 FixedArray::cast(maybe_map_array)->get(elements_kind); | 5340 FixedArray::cast(maybe_map_array)->get(elements_kind); |
5331 if (!maybe_transitioned_map->IsUndefined()) { | 5341 if (!maybe_transitioned_map->IsUndefined()) { |
5332 map = Map::cast(maybe_transitioned_map); | 5342 map = Map::cast(maybe_transitioned_map); |
5333 } | 5343 } |
5334 } | 5344 } |
5335 return AllocateJSObjectFromMapWithAllocationSite(map, | 5345 return AllocateJSObjectFromMapWithAllocationSite(map, allocation_site); |
5336 allocation_site_info_payload); | |
5337 } | 5346 } |
5338 | 5347 |
5339 | 5348 |
5340 MaybeObject* Heap::AllocateEmptyFixedArray() { | 5349 MaybeObject* Heap::AllocateEmptyFixedArray() { |
5341 int size = FixedArray::SizeFor(0); | 5350 int size = FixedArray::SizeFor(0); |
5342 Object* result; | 5351 Object* result; |
5343 { MaybeObject* maybe_result = | 5352 { MaybeObject* maybe_result = |
5344 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); | 5353 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); |
5345 if (!maybe_result->ToObject(&result)) return maybe_result; | 5354 if (!maybe_result->ToObject(&result)) return maybe_result; |
5346 } | 5355 } |
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8014 if (FLAG_parallel_recompilation) { | 8023 if (FLAG_parallel_recompilation) { |
8015 heap_->relocation_mutex_->Lock(); | 8024 heap_->relocation_mutex_->Lock(); |
8016 #ifdef DEBUG | 8025 #ifdef DEBUG |
8017 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8026 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
8018 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8027 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
8019 #endif // DEBUG | 8028 #endif // DEBUG |
8020 } | 8029 } |
8021 } | 8030 } |
8022 | 8031 |
8023 } } // namespace v8::internal | 8032 } } // namespace v8::internal |
OLD | NEW |