| 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 4385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4396 return result; | 4396 return result; |
| 4397 } | 4397 } |
| 4398 | 4398 |
| 4399 | 4399 |
| 4400 MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor, | 4400 MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor, |
| 4401 Handle<AllocationSite> allocation_site) { | 4401 Handle<AllocationSite> allocation_site) { |
| 4402 ASSERT(constructor->has_initial_map()); | 4402 ASSERT(constructor->has_initial_map()); |
| 4403 // Allocate the object based on the constructors initial map, or the payload | 4403 // Allocate the object based on the constructors initial map, or the payload |
| 4404 // advice | 4404 // advice |
| 4405 Map* initial_map = constructor->initial_map(); | 4405 Map* initial_map = constructor->initial_map(); |
| 4406 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; |
| 4406 | 4407 |
| 4407 ElementsKind to_kind = allocation_site->GetElementsKind(); | 4408 if (initial_map->instance_type() == JS_ARRAY_TYPE) { |
| 4408 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; | 4409 ElementsKind to_kind = allocation_site->GetElementsKind(); |
| 4409 if (to_kind != initial_map->elements_kind()) { | 4410 if (to_kind != initial_map->elements_kind()) { |
| 4410 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); | 4411 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); |
| 4411 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; | 4412 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; |
| 4412 // Possibly alter the mode, since we found an updated elements kind | 4413 // Possibly alter the mode, since we found an updated elements kind |
| 4413 // in the type info cell. | 4414 // in the type info cell. |
| 4414 mode = AllocationSite::GetMode(to_kind); | 4415 mode = AllocationSite::GetMode(to_kind); |
| 4416 } |
| 4415 } | 4417 } |
| 4416 | 4418 |
| 4417 MaybeObject* result; | 4419 MaybeObject* result; |
| 4418 if (mode == TRACK_ALLOCATION_SITE) { | 4420 if (mode == TRACK_ALLOCATION_SITE) { |
| 4419 result = AllocateJSObjectFromMapWithAllocationSite(initial_map, | 4421 result = AllocateJSObjectFromMapWithAllocationSite(initial_map, |
| 4420 allocation_site); | 4422 allocation_site); |
| 4421 } else { | 4423 } else { |
| 4422 result = AllocateJSObjectFromMap(initial_map, NOT_TENURED); | 4424 result = AllocateJSObjectFromMap(initial_map, NOT_TENURED); |
| 4423 } | 4425 } |
| 4424 #ifdef DEBUG | 4426 #ifdef DEBUG |
| (...skipping 3276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7701 static_cast<int>(object_sizes_last_time_[index])); | 7703 static_cast<int>(object_sizes_last_time_[index])); |
| 7702 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7704 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7703 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7705 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7704 | 7706 |
| 7705 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7707 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7706 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7708 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7707 ClearObjectStats(); | 7709 ClearObjectStats(); |
| 7708 } | 7710 } |
| 7709 | 7711 |
| 7710 } } // namespace v8::internal | 7712 } } // namespace v8::internal |
| OLD | NEW |