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 96783002: Allocation site pretenuring. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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') | test/cctest/test-heap.cc » ('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 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 1378
1379 inline void AllocationSite::IncrementMementoCreateCount() { 1379 inline void AllocationSite::IncrementMementoCreateCount() {
1380 ASSERT(FLAG_allocation_site_pretenuring); 1380 ASSERT(FLAG_allocation_site_pretenuring);
1381 int value = memento_create_count()->value(); 1381 int value = memento_create_count()->value();
1382 set_memento_create_count(Smi::FromInt(value + 1)); 1382 set_memento_create_count(Smi::FromInt(value + 1));
1383 } 1383 }
1384 1384
1385 1385
1386 inline bool AllocationSite::DigestPretenuringFeedback() { 1386 inline bool AllocationSite::DigestPretenuringFeedback() {
1387 bool decision_made = false; 1387 bool decision_made = false;
1388 if (!PretenuringDecisionMade()) { 1388 int create_count = memento_create_count()->value();
1389 int create_count = memento_create_count()->value(); 1389 if (create_count >= kPretenureMinimumCreated) {
1390 if (create_count >= kPretenureMinimumCreated) { 1390 int found_count = memento_found_count()->value();
1391 int found_count = memento_found_count()->value(); 1391 double ratio = static_cast<double>(found_count) / create_count;
1392 double ratio = static_cast<double>(found_count) / create_count; 1392 if (FLAG_trace_track_allocation_sites) {
1393 if (FLAG_trace_track_allocation_sites) { 1393 PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n",
1394 PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n", 1394 static_cast<void*>(this), create_count, found_count, ratio);
1395 static_cast<void*>(this), create_count, found_count, ratio); 1395 }
1396 } 1396 int current_mode = GetPretenureMode();
1397 int result = ratio >= kPretenureRatio ? kTenure : kDontTenure; 1397 int result = ratio >= kPretenureRatio ? kTenure : kDontTenure;
1398 set_pretenure_decision(Smi::FromInt(result)); 1398 set_pretenure_decision(Smi::FromInt(result));
1399 decision_made = true; 1399 decision_made = true;
1400 // TODO(mvstanton): if the decision represents a change, any dependent 1400 if (current_mode != GetPretenureMode()) {
1401 // code registered for pretenuring changes should be deopted. 1401 dependent_code()->DeoptimizeDependentCodeGroup(
1402 GetIsolate(),
1403 DependentCode::kAllocationSiteTenuringChangedGroup);
1402 } 1404 }
1403 } 1405 }
1404 1406
1405 // Clear feedback calculation fields until the next gc. 1407 // Clear feedback calculation fields until the next gc.
1406 set_memento_found_count(Smi::FromInt(0)); 1408 set_memento_found_count(Smi::FromInt(0));
1407 set_memento_create_count(Smi::FromInt(0)); 1409 set_memento_create_count(Smi::FromInt(0));
1408 return decision_made; 1410 return decision_made;
1409 } 1411 }
1410 1412
1411 1413
(...skipping 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after
6475 #undef WRITE_UINT32_FIELD 6477 #undef WRITE_UINT32_FIELD
6476 #undef READ_SHORT_FIELD 6478 #undef READ_SHORT_FIELD
6477 #undef WRITE_SHORT_FIELD 6479 #undef WRITE_SHORT_FIELD
6478 #undef READ_BYTE_FIELD 6480 #undef READ_BYTE_FIELD
6479 #undef WRITE_BYTE_FIELD 6481 #undef WRITE_BYTE_FIELD
6480 6482
6481 6483
6482 } } // namespace v8::internal 6484 } } // namespace v8::internal
6483 6485
6484 #endif // V8_OBJECTS_INL_H_ 6486 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698