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

Side by Side Diff: src/objects-inl.h

Issue 12114054: Supporting AllocationSiteInfo for Nested arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing a port compile failure Created 7 years, 9 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/objects.cc ('k') | src/runtime.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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 void JSObject::ValidateElements() { 1289 void JSObject::ValidateElements() {
1290 #if DEBUG 1290 #if DEBUG
1291 if (FLAG_enable_slow_asserts) { 1291 if (FLAG_enable_slow_asserts) {
1292 ElementsAccessor* accessor = GetElementsAccessor(); 1292 ElementsAccessor* accessor = GetElementsAccessor();
1293 accessor->Validate(this); 1293 accessor->Validate(this);
1294 } 1294 }
1295 #endif 1295 #endif
1296 } 1296 }
1297 1297
1298 1298
1299 bool JSObject::ShouldTrackAllocationInfo() {
1300 if (map()->CanTrackAllocationSite()) {
1301 if (!IsJSArray()) {
1302 return true;
1303 }
1304
1305 return AllocationSiteInfo::GetMode(GetElementsKind()) ==
1306 TRACK_ALLOCATION_SITE;
1307 }
1308 return false;
1309 }
1310
1311
1312 // Heuristic: We only need to create allocation site info if the boilerplate
1313 // elements kind is the initial elements kind.
1314 AllocationSiteMode AllocationSiteInfo::GetMode(
1315 ElementsKind boilerplate_elements_kind) {
1316 if (FLAG_track_allocation_sites &&
1317 IsFastSmiElementsKind(boilerplate_elements_kind)) {
1318 return TRACK_ALLOCATION_SITE;
1319 }
1320
1321 return DONT_TRACK_ALLOCATION_SITE;
1322 }
1323
1324
1325 AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from,
1326 ElementsKind to) {
1327 if (FLAG_track_allocation_sites &&
1328 IsFastSmiElementsKind(from) &&
1329 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) {
1330 return TRACK_ALLOCATION_SITE;
1331 }
1332
1333 return DONT_TRACK_ALLOCATION_SITE;
1334 }
1335
1336
1299 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { 1337 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() {
1300 ValidateElements(); 1338 ValidateElements();
1301 ElementsKind elements_kind = map()->elements_kind(); 1339 ElementsKind elements_kind = map()->elements_kind();
1302 if (!IsFastObjectElementsKind(elements_kind)) { 1340 if (!IsFastObjectElementsKind(elements_kind)) {
1303 if (IsFastHoleyElementsKind(elements_kind)) { 1341 if (IsFastHoleyElementsKind(elements_kind)) {
1304 return TransitionElementsKind(FAST_HOLEY_ELEMENTS); 1342 return TransitionElementsKind(FAST_HOLEY_ELEMENTS);
1305 } else { 1343 } else {
1306 return TransitionElementsKind(FAST_ELEMENTS); 1344 return TransitionElementsKind(FAST_ELEMENTS);
1307 } 1345 }
1308 } 1346 }
(...skipping 4701 matching lines...) Expand 10 before | Expand all | Expand 10 after
6010 #undef WRITE_UINT32_FIELD 6048 #undef WRITE_UINT32_FIELD
6011 #undef READ_SHORT_FIELD 6049 #undef READ_SHORT_FIELD
6012 #undef WRITE_SHORT_FIELD 6050 #undef WRITE_SHORT_FIELD
6013 #undef READ_BYTE_FIELD 6051 #undef READ_BYTE_FIELD
6014 #undef WRITE_BYTE_FIELD 6052 #undef WRITE_BYTE_FIELD
6015 6053
6016 6054
6017 } } // namespace v8::internal 6055 } } // namespace v8::internal
6018 6056
6019 #endif // V8_OBJECTS_INL_H_ 6057 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698