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

Side by Side Diff: src/spaces.cc

Issue 3186: Refactor the enum RelocMode changing the naming scheme from lower case to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 3 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/scopes.cc ('k') | src/stub-cache-arm.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 // Update entry for 'comment' 1699 // Update entry for 'comment'
1700 cs->size += delta; 1700 cs->size += delta;
1701 cs->count += 1; 1701 cs->count += 1;
1702 } 1702 }
1703 1703
1704 1704
1705 // Call for each nested comment start (start marked with '[ xxx', end marked 1705 // Call for each nested comment start (start marked with '[ xxx', end marked
1706 // with ']'. RelocIterator 'it' must point to a comment reloc info. 1706 // with ']'. RelocIterator 'it' must point to a comment reloc info.
1707 static void CollectCommentStatistics(RelocIterator* it) { 1707 static void CollectCommentStatistics(RelocIterator* it) {
1708 ASSERT(!it->done()); 1708 ASSERT(!it->done());
1709 ASSERT(it->rinfo()->rmode() == comment); 1709 ASSERT(it->rinfo()->rmode() == RelocInfo::COMMENT);
1710 const char* tmp = reinterpret_cast<const char*>(it->rinfo()->data()); 1710 const char* tmp = reinterpret_cast<const char*>(it->rinfo()->data());
1711 if (tmp[0] != '[') { 1711 if (tmp[0] != '[') {
1712 // Not a nested comment; skip 1712 // Not a nested comment; skip
1713 return; 1713 return;
1714 } 1714 }
1715 1715
1716 // Search for end of nested comment or a new nested comment 1716 // Search for end of nested comment or a new nested comment
1717 const char* const comment_txt = 1717 const char* const comment_txt =
1718 reinterpret_cast<const char*>(it->rinfo()->data()); 1718 reinterpret_cast<const char*>(it->rinfo()->data());
1719 const byte* prev_pc = it->rinfo()->pc(); 1719 const byte* prev_pc = it->rinfo()->pc();
1720 int flat_delta = 0; 1720 int flat_delta = 0;
1721 it->next(); 1721 it->next();
1722 while (true) { 1722 while (true) {
1723 // All nested comments must be terminated properly, and therefore exit 1723 // All nested comments must be terminated properly, and therefore exit
1724 // from loop. 1724 // from loop.
1725 ASSERT(!it->done()); 1725 ASSERT(!it->done());
1726 if (it->rinfo()->rmode() == comment) { 1726 if (it->rinfo()->rmode() == RelocInfo::COMMENT) {
1727 const char* const txt = 1727 const char* const txt =
1728 reinterpret_cast<const char*>(it->rinfo()->data()); 1728 reinterpret_cast<const char*>(it->rinfo()->data());
1729 flat_delta += it->rinfo()->pc() - prev_pc; 1729 flat_delta += it->rinfo()->pc() - prev_pc;
1730 if (txt[0] == ']') break; // End of nested comment 1730 if (txt[0] == ']') break; // End of nested comment
1731 // A new comment 1731 // A new comment
1732 CollectCommentStatistics(it); 1732 CollectCommentStatistics(it);
1733 // Skip code that was covered with previous comment 1733 // Skip code that was covered with previous comment
1734 prev_pc = it->rinfo()->pc(); 1734 prev_pc = it->rinfo()->pc();
1735 } 1735 }
1736 it->next(); 1736 it->next();
1737 } 1737 }
1738 EnterComment(comment_txt, flat_delta); 1738 EnterComment(comment_txt, flat_delta);
1739 } 1739 }
1740 1740
1741 1741
1742 // Collects code size statistics: 1742 // Collects code size statistics:
1743 // - by code kind 1743 // - by code kind
1744 // - by code comment 1744 // - by code comment
1745 void PagedSpace::CollectCodeStatistics() { 1745 void PagedSpace::CollectCodeStatistics() {
1746 HeapObjectIterator obj_it(this); 1746 HeapObjectIterator obj_it(this);
1747 while (obj_it.has_next()) { 1747 while (obj_it.has_next()) {
1748 HeapObject* obj = obj_it.next(); 1748 HeapObject* obj = obj_it.next();
1749 if (obj->IsCode()) { 1749 if (obj->IsCode()) {
1750 Code* code = Code::cast(obj); 1750 Code* code = Code::cast(obj);
1751 code_kind_statistics[code->kind()] += code->Size(); 1751 code_kind_statistics[code->kind()] += code->Size();
1752 RelocIterator it(code); 1752 RelocIterator it(code);
1753 int delta = 0; 1753 int delta = 0;
1754 const byte* prev_pc = code->instruction_start(); 1754 const byte* prev_pc = code->instruction_start();
1755 while (!it.done()) { 1755 while (!it.done()) {
1756 if (it.rinfo()->rmode() == comment) { 1756 if (it.rinfo()->rmode() == RelocInfo::COMMENT) {
1757 delta += it.rinfo()->pc() - prev_pc; 1757 delta += it.rinfo()->pc() - prev_pc;
1758 CollectCommentStatistics(&it); 1758 CollectCommentStatistics(&it);
1759 prev_pc = it.rinfo()->pc(); 1759 prev_pc = it.rinfo()->pc();
1760 } 1760 }
1761 it.next(); 1761 it.next();
1762 } 1762 }
1763 1763
1764 ASSERT(code->instruction_start() <= prev_pc && 1764 ASSERT(code->instruction_start() <= prev_pc &&
1765 prev_pc <= code->relocation_start()); 1765 prev_pc <= code->relocation_start());
1766 delta += code->relocation_start() - prev_pc; 1766 delta += code->relocation_start() - prev_pc;
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 reinterpret_cast<Object**>(object->address() 2525 reinterpret_cast<Object**>(object->address()
2526 + Page::kObjectAreaSize), 2526 + Page::kObjectAreaSize),
2527 allocation_top); 2527 allocation_top);
2528 PrintF("\n"); 2528 PrintF("\n");
2529 } 2529 }
2530 } 2530 }
2531 } 2531 }
2532 #endif // DEBUG 2532 #endif // DEBUG
2533 2533
2534 } } // namespace v8::internal 2534 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698