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 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2870 | 2870 |
2871 MaybeObject* Heap::AllocateBox(Object* value, PretenureFlag pretenure) { | 2871 MaybeObject* Heap::AllocateBox(Object* value, PretenureFlag pretenure) { |
2872 Box* result; | 2872 Box* result; |
2873 MaybeObject* maybe_result = AllocateStruct(BOX_TYPE); | 2873 MaybeObject* maybe_result = AllocateStruct(BOX_TYPE); |
2874 if (!maybe_result->To(&result)) return maybe_result; | 2874 if (!maybe_result->To(&result)) return maybe_result; |
2875 result->set_value(value); | 2875 result->set_value(value); |
2876 return result; | 2876 return result; |
2877 } | 2877 } |
2878 | 2878 |
2879 | 2879 |
2880 MaybeObject* Heap::AllocateAllocationSite() { | |
2881 Object* result; | |
2882 { MaybeObject* maybe_result = Allocate(allocation_site_map(), | |
2883 OLD_POINTER_SPACE); | |
2884 if (!maybe_result->ToObject(&result)) return maybe_result; | |
2885 } | |
Hannes Payer (out of office)
2013/07/03 15:26:45
why do you need that scope?
mvstanton
2013/07/05 07:56:14
No reason! Removed :).
| |
2886 AllocationSite::cast(result)->Initialize(); | |
2887 return result; | |
2888 } | |
2889 | |
2890 | |
2880 MaybeObject* Heap::CreateOddball(const char* to_string, | 2891 MaybeObject* Heap::CreateOddball(const char* to_string, |
2881 Object* to_number, | 2892 Object* to_number, |
2882 byte kind) { | 2893 byte kind) { |
2883 Object* result; | 2894 Object* result; |
2884 { MaybeObject* maybe_result = Allocate(oddball_map(), OLD_POINTER_SPACE); | 2895 { MaybeObject* maybe_result = Allocate(oddball_map(), OLD_POINTER_SPACE); |
2885 if (!maybe_result->ToObject(&result)) return maybe_result; | 2896 if (!maybe_result->ToObject(&result)) return maybe_result; |
2886 } | 2897 } |
2887 return Oddball::cast(result)->Initialize(to_string, to_number, kind); | 2898 return Oddball::cast(result)->Initialize(to_string, to_number, kind); |
2888 } | 2899 } |
2889 | 2900 |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4175 #ifdef VERIFY_HEAP | 4186 #ifdef VERIFY_HEAP |
4176 if (FLAG_verify_heap) { | 4187 if (FLAG_verify_heap) { |
4177 code->Verify(); | 4188 code->Verify(); |
4178 } | 4189 } |
4179 #endif | 4190 #endif |
4180 return new_code; | 4191 return new_code; |
4181 } | 4192 } |
4182 | 4193 |
4183 | 4194 |
4184 MaybeObject* Heap::AllocateWithAllocationSite(Map* map, AllocationSpace space, | 4195 MaybeObject* Heap::AllocateWithAllocationSite(Map* map, AllocationSpace space, |
4185 Handle<Object> allocation_site_info_payload) { | 4196 Handle<AllocationSite> allocation_site) { |
4186 ASSERT(gc_state_ == NOT_IN_GC); | 4197 ASSERT(gc_state_ == NOT_IN_GC); |
4187 ASSERT(map->instance_type() != MAP_TYPE); | 4198 ASSERT(map->instance_type() != MAP_TYPE); |
4188 // If allocation failures are disallowed, we may allocate in a different | 4199 // If allocation failures are disallowed, we may allocate in a different |
4189 // space when new space is full and the object is not a large object. | 4200 // space when new space is full and the object is not a large object. |
4190 AllocationSpace retry_space = | 4201 AllocationSpace retry_space = |
4191 (space != NEW_SPACE) ? space : TargetSpaceId(map->instance_type()); | 4202 (space != NEW_SPACE) ? space : TargetSpaceId(map->instance_type()); |
4192 int size = map->instance_size() + AllocationSiteInfo::kSize; | 4203 int size = map->instance_size() + AllocationSiteInfo::kSize; |
4193 Object* result; | 4204 Object* result; |
4194 MaybeObject* maybe_result = AllocateRaw(size, space, retry_space); | 4205 MaybeObject* maybe_result = AllocateRaw(size, space, retry_space); |
4195 if (!maybe_result->ToObject(&result)) return maybe_result; | 4206 if (!maybe_result->ToObject(&result)) return maybe_result; |
4196 // No need for write barrier since object is white and map is in old space. | 4207 // No need for write barrier since object is white and map is in old space. |
4197 HeapObject::cast(result)->set_map_no_write_barrier(map); | 4208 HeapObject::cast(result)->set_map_no_write_barrier(map); |
4198 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( | 4209 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( |
4199 reinterpret_cast<Address>(result) + map->instance_size()); | 4210 reinterpret_cast<Address>(result) + map->instance_size()); |
4200 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); | 4211 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); |
4201 alloc_info->set_payload(*allocation_site_info_payload, SKIP_WRITE_BARRIER); | 4212 alloc_info->set_allocation_site(*allocation_site, SKIP_WRITE_BARRIER); |
4202 return result; | 4213 return result; |
4203 } | 4214 } |
4204 | 4215 |
4205 | 4216 |
4206 MaybeObject* Heap::Allocate(Map* map, AllocationSpace space) { | 4217 MaybeObject* Heap::Allocate(Map* map, AllocationSpace space) { |
4207 ASSERT(gc_state_ == NOT_IN_GC); | 4218 ASSERT(gc_state_ == NOT_IN_GC); |
4208 ASSERT(map->instance_type() != MAP_TYPE); | 4219 ASSERT(map->instance_type() != MAP_TYPE); |
4209 // If allocation failures are disallowed, we may allocate in a different | 4220 // If allocation failures are disallowed, we may allocate in a different |
4210 // space when new space is full and the object is not a large object. | 4221 // space when new space is full and the object is not a large object. |
4211 AllocationSpace retry_space = | 4222 AllocationSpace retry_space = |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4450 InitializeJSObjectFromMap(JSObject::cast(obj), | 4461 InitializeJSObjectFromMap(JSObject::cast(obj), |
4451 FixedArray::cast(properties), | 4462 FixedArray::cast(properties), |
4452 map); | 4463 map); |
4453 ASSERT(JSObject::cast(obj)->HasFastElements() || | 4464 ASSERT(JSObject::cast(obj)->HasFastElements() || |
4454 JSObject::cast(obj)->HasExternalArrayElements()); | 4465 JSObject::cast(obj)->HasExternalArrayElements()); |
4455 return obj; | 4466 return obj; |
4456 } | 4467 } |
4457 | 4468 |
4458 | 4469 |
4459 MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map, | 4470 MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map, |
4460 Handle<Object> allocation_site_info_payload) { | 4471 Handle<AllocationSite> allocation_site) { |
4461 // JSFunctions should be allocated using AllocateFunction to be | 4472 // JSFunctions should be allocated using AllocateFunction to be |
4462 // properly initialized. | 4473 // properly initialized. |
4463 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); | 4474 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
4464 | 4475 |
4465 // Both types of global objects should be allocated using | 4476 // Both types of global objects should be allocated using |
4466 // AllocateGlobalObject to be properly initialized. | 4477 // AllocateGlobalObject to be properly initialized. |
4467 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 4478 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
4468 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 4479 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
4469 | 4480 |
4470 // Allocate the backing storage for the properties. | 4481 // Allocate the backing storage for the properties. |
4471 int prop_size = | 4482 int prop_size = |
4472 map->pre_allocated_property_fields() + | 4483 map->pre_allocated_property_fields() + |
4473 map->unused_property_fields() - | 4484 map->unused_property_fields() - |
4474 map->inobject_properties(); | 4485 map->inobject_properties(); |
4475 ASSERT(prop_size >= 0); | 4486 ASSERT(prop_size >= 0); |
4476 Object* properties; | 4487 Object* properties; |
4477 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); | 4488 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); |
4478 if (!maybe_properties->ToObject(&properties)) return maybe_properties; | 4489 if (!maybe_properties->ToObject(&properties)) return maybe_properties; |
4479 } | 4490 } |
4480 | 4491 |
4481 // Allocate the JSObject. | 4492 // Allocate the JSObject. |
4482 AllocationSpace space = NEW_SPACE; | 4493 AllocationSpace space = NEW_SPACE; |
4483 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; | 4494 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
4484 Object* obj; | 4495 Object* obj; |
4485 MaybeObject* maybe_obj = AllocateWithAllocationSite(map, space, | 4496 MaybeObject* maybe_obj = AllocateWithAllocationSite(map, space, |
4486 allocation_site_info_payload); | 4497 allocation_site); |
Hannes Payer (out of office)
2013/07/03 15:26:45
Can you move AllocateWithAllocationSite into a new
mvstanton
2013/07/05 07:56:14
I *think* I got what you mean. I changed the inden
| |
4487 if (!maybe_obj->To(&obj)) return maybe_obj; | 4498 if (!maybe_obj->To(&obj)) return maybe_obj; |
4488 | 4499 |
4489 // Initialize the JSObject. | 4500 // Initialize the JSObject. |
4490 InitializeJSObjectFromMap(JSObject::cast(obj), | 4501 InitializeJSObjectFromMap(JSObject::cast(obj), |
4491 FixedArray::cast(properties), | 4502 FixedArray::cast(properties), |
4492 map); | 4503 map); |
4493 ASSERT(JSObject::cast(obj)->HasFastElements()); | 4504 ASSERT(JSObject::cast(obj)->HasFastElements()); |
4494 return obj; | 4505 return obj; |
4495 } | 4506 } |
4496 | 4507 |
(...skipping 15 matching lines...) Expand all Loading... | |
4512 #ifdef DEBUG | 4523 #ifdef DEBUG |
4513 // Make sure result is NOT a global object if valid. | 4524 // Make sure result is NOT a global object if valid. |
4514 Object* non_failure; | 4525 Object* non_failure; |
4515 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); | 4526 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); |
4516 #endif | 4527 #endif |
4517 return result; | 4528 return result; |
4518 } | 4529 } |
4519 | 4530 |
4520 | 4531 |
4521 MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor, | 4532 MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor, |
4522 Handle<Object> allocation_site_info_payload) { | 4533 Handle<AllocationSite> allocation_site) { |
4523 // Allocate the initial map if absent. | 4534 // Allocate the initial map if absent. |
4524 if (!constructor->has_initial_map()) { | 4535 if (!constructor->has_initial_map()) { |
4525 Object* initial_map; | 4536 Object* initial_map; |
4526 { MaybeObject* maybe_initial_map = AllocateInitialMap(constructor); | 4537 { MaybeObject* maybe_initial_map = AllocateInitialMap(constructor); |
4527 if (!maybe_initial_map->ToObject(&initial_map)) return maybe_initial_map; | 4538 if (!maybe_initial_map->ToObject(&initial_map)) return maybe_initial_map; |
4528 } | 4539 } |
4529 constructor->set_initial_map(Map::cast(initial_map)); | 4540 constructor->set_initial_map(Map::cast(initial_map)); |
4530 Map::cast(initial_map)->set_constructor(constructor); | 4541 Map::cast(initial_map)->set_constructor(constructor); |
4531 } | 4542 } |
4532 // Allocate the object based on the constructors initial map, or the payload | 4543 // Allocate the object based on the constructors initial map, or the payload |
4533 // advice | 4544 // advice |
4534 Map* initial_map = constructor->initial_map(); | 4545 Map* initial_map = constructor->initial_map(); |
4535 | 4546 |
4536 Cell* cell = Cell::cast(*allocation_site_info_payload); | 4547 Smi* smi = Smi::cast(allocation_site->payload()); |
4537 Smi* smi = Smi::cast(cell->value()); | |
4538 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); | 4548 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); |
4539 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; | 4549 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; |
4540 if (to_kind != initial_map->elements_kind()) { | 4550 if (to_kind != initial_map->elements_kind()) { |
4541 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); | 4551 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); |
4542 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; | 4552 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; |
4543 // Possibly alter the mode, since we found an updated elements kind | 4553 // Possibly alter the mode, since we found an updated elements kind |
4544 // in the type info cell. | 4554 // in the type info cell. |
4545 mode = AllocationSiteInfo::GetMode(to_kind); | 4555 mode = AllocationSite::GetMode(to_kind); |
4546 } | 4556 } |
4547 | 4557 |
4548 MaybeObject* result; | 4558 MaybeObject* result; |
4549 if (mode == TRACK_ALLOCATION_SITE) { | 4559 if (mode == TRACK_ALLOCATION_SITE) { |
4550 result = AllocateJSObjectFromMapWithAllocationSite(initial_map, | 4560 result = AllocateJSObjectFromMapWithAllocationSite(initial_map, |
4551 allocation_site_info_payload); | 4561 allocation_site); |
4552 } else { | 4562 } else { |
4553 result = AllocateJSObjectFromMap(initial_map, NOT_TENURED); | 4563 result = AllocateJSObjectFromMap(initial_map, NOT_TENURED); |
4554 } | 4564 } |
4555 #ifdef DEBUG | 4565 #ifdef DEBUG |
4556 // Make sure result is NOT a global object if valid. | 4566 // Make sure result is NOT a global object if valid. |
4557 Object* non_failure; | 4567 Object* non_failure; |
4558 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); | 4568 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); |
4559 #endif | 4569 #endif |
4560 return result; | 4570 return result; |
4561 } | 4571 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4636 array->set_elements(elms); | 4646 array->set_elements(elms); |
4637 array->set_length(Smi::FromInt(length)); | 4647 array->set_length(Smi::FromInt(length)); |
4638 return array; | 4648 return array; |
4639 } | 4649 } |
4640 | 4650 |
4641 | 4651 |
4642 MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite( | 4652 MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite( |
4643 ElementsKind elements_kind, | 4653 ElementsKind elements_kind, |
4644 int length, | 4654 int length, |
4645 int capacity, | 4655 int capacity, |
4646 Handle<Object> allocation_site_payload, | 4656 Handle<AllocationSite> allocation_site, |
4647 ArrayStorageAllocationMode mode) { | 4657 ArrayStorageAllocationMode mode) { |
4648 MaybeObject* maybe_array = AllocateJSArrayWithAllocationSite(elements_kind, | 4658 MaybeObject* maybe_array = AllocateJSArrayWithAllocationSite(elements_kind, |
4649 allocation_site_payload); | 4659 allocation_site); |
4650 JSArray* array; | 4660 JSArray* array; |
4651 if (!maybe_array->To(&array)) return maybe_array; | 4661 if (!maybe_array->To(&array)) return maybe_array; |
4652 return AllocateJSArrayStorage(array, length, capacity, mode); | 4662 return AllocateJSArrayStorage(array, length, capacity, mode); |
4653 } | 4663 } |
4654 | 4664 |
4655 | 4665 |
4656 MaybeObject* Heap::AllocateJSArrayStorage( | 4666 MaybeObject* Heap::AllocateJSArrayStorage( |
4657 JSArray* array, | 4667 JSArray* array, |
4658 int length, | 4668 int length, |
4659 int capacity, | 4669 int capacity, |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4888 { MaybeObject* maybe_prop = CopyFixedArray(properties); | 4898 { MaybeObject* maybe_prop = CopyFixedArray(properties); |
4889 if (!maybe_prop->ToObject(&prop)) return maybe_prop; | 4899 if (!maybe_prop->ToObject(&prop)) return maybe_prop; |
4890 } | 4900 } |
4891 JSObject::cast(clone)->set_properties(FixedArray::cast(prop), wb_mode); | 4901 JSObject::cast(clone)->set_properties(FixedArray::cast(prop), wb_mode); |
4892 } | 4902 } |
4893 // Return the new clone. | 4903 // Return the new clone. |
4894 return clone; | 4904 return clone; |
4895 } | 4905 } |
4896 | 4906 |
4897 | 4907 |
4898 MaybeObject* Heap::CopyJSObjectWithAllocationSite(JSObject* source) { | 4908 MaybeObject* Heap::CopyJSObjectWithAllocationSite(JSObject* source, |
4909 AllocationSite* site) { | |
4899 // Never used to copy functions. If functions need to be copied we | 4910 // Never used to copy functions. If functions need to be copied we |
4900 // have to be careful to clear the literals array. | 4911 // have to be careful to clear the literals array. |
4901 SLOW_ASSERT(!source->IsJSFunction()); | 4912 SLOW_ASSERT(!source->IsJSFunction()); |
4902 | 4913 |
4903 // Make the clone. | 4914 // Make the clone. |
4904 Map* map = source->map(); | 4915 Map* map = source->map(); |
4905 int object_size = map->instance_size(); | 4916 int object_size = map->instance_size(); |
4906 Object* clone; | 4917 Object* clone; |
4907 | 4918 |
4908 ASSERT(map->CanTrackAllocationSite()); | 4919 ASSERT(map->CanTrackAllocationSite()); |
(...skipping 29 matching lines...) Expand all Loading... | |
4938 } | 4949 } |
4939 | 4950 |
4940 // Track allocation site information, if we failed to allocate it inline. | 4951 // Track allocation site information, if we failed to allocate it inline. |
4941 if (InNewSpace(clone) && | 4952 if (InNewSpace(clone) && |
4942 adjusted_object_size == object_size) { | 4953 adjusted_object_size == object_size) { |
4943 MaybeObject* maybe_alloc_info = | 4954 MaybeObject* maybe_alloc_info = |
4944 AllocateStruct(ALLOCATION_SITE_INFO_TYPE); | 4955 AllocateStruct(ALLOCATION_SITE_INFO_TYPE); |
4945 AllocationSiteInfo* alloc_info; | 4956 AllocationSiteInfo* alloc_info; |
4946 if (maybe_alloc_info->To(&alloc_info)) { | 4957 if (maybe_alloc_info->To(&alloc_info)) { |
4947 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); | 4958 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); |
4948 alloc_info->set_payload(source, SKIP_WRITE_BARRIER); | 4959 alloc_info->set_allocation_site(site, SKIP_WRITE_BARRIER); |
4949 } | 4960 } |
4950 } | 4961 } |
4951 } else { | 4962 } else { |
4952 wb_mode = SKIP_WRITE_BARRIER; | 4963 wb_mode = SKIP_WRITE_BARRIER; |
4953 adjusted_object_size += AllocationSiteInfo::kSize; | 4964 adjusted_object_size += AllocationSiteInfo::kSize; |
4954 | 4965 |
4955 { MaybeObject* maybe_clone = new_space_.AllocateRaw(adjusted_object_size); | 4966 { MaybeObject* maybe_clone = new_space_.AllocateRaw(adjusted_object_size); |
4956 if (!maybe_clone->ToObject(&clone)) return maybe_clone; | 4967 if (!maybe_clone->ToObject(&clone)) return maybe_clone; |
4957 } | 4968 } |
4958 SLOW_ASSERT(InNewSpace(clone)); | 4969 SLOW_ASSERT(InNewSpace(clone)); |
4959 // Since we know the clone is allocated in new space, we can copy | 4970 // Since we know the clone is allocated in new space, we can copy |
4960 // the contents without worrying about updating the write barrier. | 4971 // the contents without worrying about updating the write barrier. |
4961 CopyBlock(HeapObject::cast(clone)->address(), | 4972 CopyBlock(HeapObject::cast(clone)->address(), |
4962 source->address(), | 4973 source->address(), |
4963 object_size); | 4974 object_size); |
4964 } | 4975 } |
4965 | 4976 |
4966 if (adjusted_object_size > object_size) { | 4977 if (adjusted_object_size > object_size) { |
4967 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( | 4978 AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>( |
4968 reinterpret_cast<Address>(clone) + object_size); | 4979 reinterpret_cast<Address>(clone) + object_size); |
4969 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); | 4980 alloc_info->set_map_no_write_barrier(allocation_site_info_map()); |
4970 alloc_info->set_payload(source, SKIP_WRITE_BARRIER); | 4981 alloc_info->set_allocation_site(site, SKIP_WRITE_BARRIER); |
4971 } | 4982 } |
4972 | 4983 |
4973 SLOW_ASSERT( | 4984 SLOW_ASSERT( |
4974 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); | 4985 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); |
4975 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); | 4986 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); |
4976 FixedArray* properties = FixedArray::cast(source->properties()); | 4987 FixedArray* properties = FixedArray::cast(source->properties()); |
4977 // Update elements if necessary. | 4988 // Update elements if necessary. |
4978 if (elements->length() > 0) { | 4989 if (elements->length() > 0) { |
4979 Object* elem; | 4990 Object* elem; |
4980 { MaybeObject* maybe_elem; | 4991 { MaybeObject* maybe_elem; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5376 JSFunction* array_function = native_context->array_function(); | 5387 JSFunction* array_function = native_context->array_function(); |
5377 Map* map = array_function->initial_map(); | 5388 Map* map = array_function->initial_map(); |
5378 Map* transition_map = isolate()->get_initial_js_array_map(elements_kind); | 5389 Map* transition_map = isolate()->get_initial_js_array_map(elements_kind); |
5379 if (transition_map != NULL) map = transition_map; | 5390 if (transition_map != NULL) map = transition_map; |
5380 return AllocateJSObjectFromMap(map, pretenure); | 5391 return AllocateJSObjectFromMap(map, pretenure); |
5381 } | 5392 } |
5382 | 5393 |
5383 | 5394 |
5384 MaybeObject* Heap::AllocateJSArrayWithAllocationSite( | 5395 MaybeObject* Heap::AllocateJSArrayWithAllocationSite( |
5385 ElementsKind elements_kind, | 5396 ElementsKind elements_kind, |
5386 Handle<Object> allocation_site_info_payload) { | 5397 Handle<AllocationSite> allocation_site) { |
5387 Context* native_context = isolate()->context()->native_context(); | 5398 Context* native_context = isolate()->context()->native_context(); |
5388 JSFunction* array_function = native_context->array_function(); | 5399 JSFunction* array_function = native_context->array_function(); |
5389 Map* map = array_function->initial_map(); | 5400 Map* map = array_function->initial_map(); |
5390 Object* maybe_map_array = native_context->js_array_maps(); | 5401 Object* maybe_map_array = native_context->js_array_maps(); |
5391 if (!maybe_map_array->IsUndefined()) { | 5402 if (!maybe_map_array->IsUndefined()) { |
5392 Object* maybe_transitioned_map = | 5403 Object* maybe_transitioned_map = |
5393 FixedArray::cast(maybe_map_array)->get(elements_kind); | 5404 FixedArray::cast(maybe_map_array)->get(elements_kind); |
5394 if (!maybe_transitioned_map->IsUndefined()) { | 5405 if (!maybe_transitioned_map->IsUndefined()) { |
5395 map = Map::cast(maybe_transitioned_map); | 5406 map = Map::cast(maybe_transitioned_map); |
5396 } | 5407 } |
5397 } | 5408 } |
5398 return AllocateJSObjectFromMapWithAllocationSite(map, | 5409 return AllocateJSObjectFromMapWithAllocationSite(map, allocation_site); |
5399 allocation_site_info_payload); | |
5400 } | 5410 } |
5401 | 5411 |
5402 | 5412 |
5403 MaybeObject* Heap::AllocateEmptyFixedArray() { | 5413 MaybeObject* Heap::AllocateEmptyFixedArray() { |
5404 int size = FixedArray::SizeFor(0); | 5414 int size = FixedArray::SizeFor(0); |
5405 Object* result; | 5415 Object* result; |
5406 { MaybeObject* maybe_result = | 5416 { MaybeObject* maybe_result = |
5407 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); | 5417 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); |
5408 if (!maybe_result->ToObject(&result)) return maybe_result; | 5418 if (!maybe_result->ToObject(&result)) return maybe_result; |
5409 } | 5419 } |
(...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8115 if (FLAG_parallel_recompilation) { | 8125 if (FLAG_parallel_recompilation) { |
8116 heap_->relocation_mutex_->Lock(); | 8126 heap_->relocation_mutex_->Lock(); |
8117 #ifdef DEBUG | 8127 #ifdef DEBUG |
8118 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8128 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
8119 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8129 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
8120 #endif // DEBUG | 8130 #endif // DEBUG |
8121 } | 8131 } |
8122 } | 8132 } |
8123 | 8133 |
8124 } } // namespace v8::internal | 8134 } } // namespace v8::internal |
OLD | NEW |