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

Side by Side Diff: src/heap.cc

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