OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 12298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12309 } | 12309 } |
12310 | 12310 |
12311 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(this); | 12311 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(this); |
12312 if (info == NULL || !info->IsValid()) { | 12312 if (info == NULL || !info->IsValid()) { |
12313 return this; | 12313 return this; |
12314 } | 12314 } |
12315 | 12315 |
12316 // Walk through to the Allocation Site | 12316 // Walk through to the Allocation Site |
12317 AllocationSite* site = info->GetAllocationSite(); | 12317 AllocationSite* site = info->GetAllocationSite(); |
12318 if (site->IsLiteralSite()) { | 12318 if (site->IsLiteralSite()) { |
12319 JSArray* payload = JSArray::cast(site->payload()); | 12319 JSArray* transition_info = JSArray::cast(site->transition_info()); |
12320 ElementsKind kind = payload->GetElementsKind(); | 12320 ElementsKind kind = transition_info->GetElementsKind(); |
12321 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { | 12321 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { |
12322 // If the array is huge, it's not likely to be defined in a local | 12322 // If the array is huge, it's not likely to be defined in a local |
12323 // function, so we shouldn't make new instances of it very often. | 12323 // function, so we shouldn't make new instances of it very often. |
12324 uint32_t length = 0; | 12324 uint32_t length = 0; |
12325 CHECK(payload->length()->ToArrayIndex(&length)); | 12325 CHECK(transition_info->length()->ToArrayIndex(&length)); |
12326 if (length <= AllocationSite::kMaximumArrayBytesToPretransition) { | 12326 if (length <= AllocationSite::kMaximumArrayBytesToPretransition) { |
12327 if (FLAG_trace_track_allocation_sites) { | 12327 if (FLAG_trace_track_allocation_sites) { |
12328 PrintF( | 12328 PrintF( |
12329 "AllocationSite: JSArray %p boilerplate updated %s->%s\n", | 12329 "AllocationSite: JSArray %p boilerplate updated %s->%s\n", |
12330 reinterpret_cast<void*>(this), | 12330 reinterpret_cast<void*>(this), |
12331 ElementsKindToString(kind), | 12331 ElementsKindToString(kind), |
12332 ElementsKindToString(to_kind)); | 12332 ElementsKindToString(to_kind)); |
12333 } | 12333 } |
12334 return payload->TransitionElementsKind(to_kind); | 12334 return transition_info->TransitionElementsKind(to_kind); |
12335 } | 12335 } |
12336 } | 12336 } |
12337 } else { | 12337 } else { |
12338 ElementsKind kind = site->GetElementsKindPayload(); | 12338 ElementsKind kind = site->GetElementsKind(); |
12339 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { | 12339 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { |
12340 if (FLAG_trace_track_allocation_sites) { | 12340 if (FLAG_trace_track_allocation_sites) { |
12341 PrintF("AllocationSite: JSArray %p site updated %s->%s\n", | 12341 PrintF("AllocationSite: JSArray %p site updated %s->%s\n", |
12342 reinterpret_cast<void*>(this), | 12342 reinterpret_cast<void*>(this), |
12343 ElementsKindToString(kind), | 12343 ElementsKindToString(kind), |
12344 ElementsKindToString(to_kind)); | 12344 ElementsKindToString(to_kind)); |
12345 } | 12345 } |
12346 site->set_payload(Smi::FromInt(to_kind)); | 12346 site->set_transition_info(Smi::FromInt(to_kind)); |
12347 } | 12347 } |
12348 } | 12348 } |
12349 return this; | 12349 return this; |
12350 } | 12350 } |
12351 | 12351 |
12352 | 12352 |
12353 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { | 12353 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { |
12354 ASSERT(!map()->is_observed()); | 12354 ASSERT(!map()->is_observed()); |
12355 ElementsKind from_kind = map()->elements_kind(); | 12355 ElementsKind from_kind = map()->elements_kind(); |
12356 | 12356 |
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15871 | 15871 |
15872 void PropertyCell::AddDependentCode(Handle<Code> code) { | 15872 void PropertyCell::AddDependentCode(Handle<Code> code) { |
15873 Handle<DependentCode> codes = DependentCode::Insert( | 15873 Handle<DependentCode> codes = DependentCode::Insert( |
15874 Handle<DependentCode>(dependent_code()), | 15874 Handle<DependentCode>(dependent_code()), |
15875 DependentCode::kPropertyCellChangedGroup, code); | 15875 DependentCode::kPropertyCellChangedGroup, code); |
15876 if (*codes != dependent_code()) set_dependent_code(*codes); | 15876 if (*codes != dependent_code()) set_dependent_code(*codes); |
15877 } | 15877 } |
15878 | 15878 |
15879 | 15879 |
15880 } } // namespace v8::internal | 15880 } } // namespace v8::internal |
OLD | NEW |