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

Side by Side Diff: src/objects.cc

Issue 18531007: AllocationSites: when updating allocation site transition information, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments 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 | « no previous file | test/mjsunit/allocation-site-info.js » ('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 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 12299 matching lines...) Expand 10 before | Expand all | Expand 10 after
12310 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(this); 12310 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(this);
12311 if (info == NULL || !info->IsValid()) { 12311 if (info == NULL || !info->IsValid()) {
12312 return this; 12312 return this;
12313 } 12313 }
12314 12314
12315 // Walk through to the Allocation Site 12315 // Walk through to the Allocation Site
12316 AllocationSite* site = info->GetAllocationSite(); 12316 AllocationSite* site = info->GetAllocationSite();
12317 if (site->IsLiteralSite()) { 12317 if (site->IsLiteralSite()) {
12318 JSArray* transition_info = JSArray::cast(site->transition_info()); 12318 JSArray* transition_info = JSArray::cast(site->transition_info());
12319 ElementsKind kind = transition_info->GetElementsKind(); 12319 ElementsKind kind = transition_info->GetElementsKind();
12320 // if kind is holey ensure that to_kind is as well.
12321 if (IsHoleyElementsKind(kind)) {
12322 to_kind = GetHoleyElementsKind(to_kind);
12323 }
12320 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { 12324 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) {
12321 // If the array is huge, it's not likely to be defined in a local 12325 // If the array is huge, it's not likely to be defined in a local
12322 // function, so we shouldn't make new instances of it very often. 12326 // function, so we shouldn't make new instances of it very often.
12323 uint32_t length = 0; 12327 uint32_t length = 0;
12324 CHECK(transition_info->length()->ToArrayIndex(&length)); 12328 CHECK(transition_info->length()->ToArrayIndex(&length));
12325 if (length <= AllocationSite::kMaximumArrayBytesToPretransition) { 12329 if (length <= AllocationSite::kMaximumArrayBytesToPretransition) {
12326 if (FLAG_trace_track_allocation_sites) { 12330 if (FLAG_trace_track_allocation_sites) {
12327 PrintF( 12331 PrintF(
12328 "AllocationSite: JSArray %p boilerplate updated %s->%s\n", 12332 "AllocationSite: JSArray %p boilerplate updated %s->%s\n",
12329 reinterpret_cast<void*>(this), 12333 reinterpret_cast<void*>(this),
12330 ElementsKindToString(kind), 12334 ElementsKindToString(kind),
12331 ElementsKindToString(to_kind)); 12335 ElementsKindToString(to_kind));
12332 } 12336 }
12333 return transition_info->TransitionElementsKind(to_kind); 12337 return transition_info->TransitionElementsKind(to_kind);
12334 } 12338 }
12335 } 12339 }
12336 } else { 12340 } else {
12337 ElementsKind kind = site->GetElementsKind(); 12341 ElementsKind kind = site->GetElementsKind();
12342 // if kind is holey ensure that to_kind is as well.
12343 if (IsHoleyElementsKind(kind)) {
12344 to_kind = GetHoleyElementsKind(to_kind);
12345 }
12338 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { 12346 if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) {
12339 if (FLAG_trace_track_allocation_sites) { 12347 if (FLAG_trace_track_allocation_sites) {
12340 PrintF("AllocationSite: JSArray %p site updated %s->%s\n", 12348 PrintF("AllocationSite: JSArray %p site updated %s->%s\n",
12341 reinterpret_cast<void*>(this), 12349 reinterpret_cast<void*>(this),
12342 ElementsKindToString(kind), 12350 ElementsKindToString(kind),
12343 ElementsKindToString(to_kind)); 12351 ElementsKindToString(to_kind));
12344 } 12352 }
12345 site->set_transition_info(Smi::FromInt(to_kind)); 12353 site->set_transition_info(Smi::FromInt(to_kind));
12346 } 12354 }
12347 } 12355 }
(...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after
15876 15884
15877 void PropertyCell::AddDependentCode(Handle<Code> code) { 15885 void PropertyCell::AddDependentCode(Handle<Code> code) {
15878 Handle<DependentCode> codes = DependentCode::Insert( 15886 Handle<DependentCode> codes = DependentCode::Insert(
15879 Handle<DependentCode>(dependent_code()), 15887 Handle<DependentCode>(dependent_code()),
15880 DependentCode::kPropertyCellChangedGroup, code); 15888 DependentCode::kPropertyCellChangedGroup, code);
15881 if (*codes != dependent_code()) set_dependent_code(*codes); 15889 if (*codes != dependent_code()) set_dependent_code(*codes);
15882 } 15890 }
15883 15891
15884 15892
15885 } } // namespace v8::internal 15893 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/allocation-site-info.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698