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

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

Issue 153863005: Just calculate pretenuring ratio when needed. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | no next file » | 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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 ASSERT(FLAG_allocation_site_pretenuring); 1544 ASSERT(FLAG_allocation_site_pretenuring);
1545 int value = memento_create_count(); 1545 int value = memento_create_count();
1546 set_memento_create_count(value + 1); 1546 set_memento_create_count(value + 1);
1547 } 1547 }
1548 1548
1549 1549
1550 inline bool AllocationSite::DigestPretenuringFeedback() { 1550 inline bool AllocationSite::DigestPretenuringFeedback() {
1551 bool decision_changed = false; 1551 bool decision_changed = false;
1552 int create_count = memento_create_count(); 1552 int create_count = memento_create_count();
1553 int found_count = memento_found_count(); 1553 int found_count = memento_found_count();
1554 double ratio = static_cast<double>(found_count) / create_count; 1554 double ratio = 0.0;
1555 PretenureFlag current_mode = GetPretenureMode(); 1555 PretenureFlag current_mode = GetPretenureMode();
1556 1556
1557 if (create_count >= kPretenureMinimumCreated) { 1557 if (create_count >= kPretenureMinimumCreated) {
1558 ratio = static_cast<double>(found_count) / create_count;
mvstanton 2014/02/06 11:23:33 Per our chat, something like: bool minimum_met =
Hannes Payer (out of office) 2014/02/06 11:26:53 Done.
1558 PretenureDecision result = ratio >= kPretenureRatio 1559 PretenureDecision result = ratio >= kPretenureRatio
1559 ? kTenure 1560 ? kTenure
1560 : kDontTenure; 1561 : kDontTenure;
1561 set_pretenure_decision(result); 1562 set_pretenure_decision(result);
1562 if (current_mode != GetPretenureMode()) { 1563 if (current_mode != GetPretenureMode()) {
1563 decision_changed = true; 1564 decision_changed = true;
1564 dependent_code()->MarkCodeForDeoptimization( 1565 dependent_code()->MarkCodeForDeoptimization(
1565 GetIsolate(), 1566 GetIsolate(),
1566 DependentCode::kAllocationSiteTenuringChangedGroup); 1567 DependentCode::kAllocationSiteTenuringChangedGroup);
1567 } 1568 }
1568 } 1569 }
1569 1570
1570 if (FLAG_trace_pretenuring_statistics) { 1571 if (FLAG_trace_pretenuring_statistics) {
1572 ratio = static_cast<double>(found_count) / create_count;
1571 PrintF( 1573 PrintF(
1572 "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n", 1574 "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n",
1573 static_cast<void*>(this), create_count, found_count, ratio, 1575 static_cast<void*>(this), create_count, found_count, ratio,
1574 current_mode == TENURED ? "tenured" : "not tenured", 1576 current_mode == TENURED ? "tenured" : "not tenured",
1575 GetPretenureMode() == TENURED ? "tenured" : "not tenured"); 1577 GetPretenureMode() == TENURED ? "tenured" : "not tenured");
1576 } 1578 }
1577 1579
1578 // Clear feedback calculation fields until the next gc. 1580 // Clear feedback calculation fields until the next gc.
1579 set_memento_found_count(0); 1581 set_memento_found_count(0);
1580 set_memento_create_count(0); 1582 set_memento_create_count(0);
(...skipping 5206 matching lines...) Expand 10 before | Expand all | Expand 10 after
6787 #undef READ_UINT32_FIELD 6789 #undef READ_UINT32_FIELD
6788 #undef WRITE_UINT32_FIELD 6790 #undef WRITE_UINT32_FIELD
6789 #undef READ_SHORT_FIELD 6791 #undef READ_SHORT_FIELD
6790 #undef WRITE_SHORT_FIELD 6792 #undef WRITE_SHORT_FIELD
6791 #undef READ_BYTE_FIELD 6793 #undef READ_BYTE_FIELD
6792 #undef WRITE_BYTE_FIELD 6794 #undef WRITE_BYTE_FIELD
6793 6795
6794 } } // namespace v8::internal 6796 } } // namespace v8::internal
6795 6797
6796 #endif // V8_OBJECTS_INL_H_ 6798 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698