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

Side by Side Diff: src/mark-compact.cc

Issue 3226014: Add functionality for finding code objects from a pc that points into... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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/mark-compact.h ('k') | src/memory.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 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 MarkLiveObjects(); 78 MarkLiveObjects();
79 79
80 if (FLAG_collect_maps) ClearNonLiveTransitions(); 80 if (FLAG_collect_maps) ClearNonLiveTransitions();
81 81
82 SweepLargeObjectSpace(); 82 SweepLargeObjectSpace();
83 83
84 if (IsCompacting()) { 84 if (IsCompacting()) {
85 GCTracer::Scope gc_scope(tracer_, GCTracer::Scope::MC_COMPACT); 85 GCTracer::Scope gc_scope(tracer_, GCTracer::Scope::MC_COMPACT);
86 EncodeForwardingAddresses(); 86 EncodeForwardingAddresses();
87 87
88 Heap::MarkMapPointersAsEncoded(true);
88 UpdatePointers(); 89 UpdatePointers();
90 Heap::MarkMapPointersAsEncoded(false);
91 PcToCodeCache::FlushPcToCodeCache();
89 92
90 RelocateObjects(); 93 RelocateObjects();
91 } else { 94 } else {
92 SweepSpaces(); 95 SweepSpaces();
96 PcToCodeCache::FlushPcToCodeCache();
93 } 97 }
94 98
95 Finish(); 99 Finish();
96 100
97 // Save the count of marked objects remaining after the collection and 101 // Save the count of marked objects remaining after the collection and
98 // null out the GC tracer. 102 // null out the GC tracer.
99 previous_marked_count_ = tracer_->marked_count(); 103 previous_marked_count_ = tracer_->marked_count();
100 ASSERT(previous_marked_count_ == 0); 104 ASSERT(previous_marked_count_ == 0);
101 tracer_ = NULL; 105 tracer_ = NULL;
102 } 106 }
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 // of a live object). A second distinguished map-pointer encoding is used 1182 // of a live object). A second distinguished map-pointer encoding is used
1179 // to mark free regions larger than one word, and the size of the free 1183 // to mark free regions larger than one word, and the size of the free
1180 // region (including the first word) is written to the second word of the 1184 // region (including the first word) is written to the second word of the
1181 // region. 1185 // region.
1182 // 1186 //
1183 // Any valid map page offset must lie in the object area of the page, so map 1187 // Any valid map page offset must lie in the object area of the page, so map
1184 // page offsets less than Page::kObjectStartOffset are invalid. We use a 1188 // page offsets less than Page::kObjectStartOffset are invalid. We use a
1185 // pair of distinguished invalid map encodings (for single word and multiple 1189 // pair of distinguished invalid map encodings (for single word and multiple
1186 // words) to indicate free regions in the page found during computation of 1190 // words) to indicate free regions in the page found during computation of
1187 // forwarding addresses and skipped over in subsequent sweeps. 1191 // forwarding addresses and skipped over in subsequent sweeps.
1188 static const uint32_t kSingleFreeEncoding = 0;
1189 static const uint32_t kMultiFreeEncoding = 1;
1190 1192
1191 1193
1192 // Encode a free region, defined by the given start address and size, in the 1194 // Encode a free region, defined by the given start address and size, in the
1193 // first word or two of the region. 1195 // first word or two of the region.
1194 void EncodeFreeRegion(Address free_start, int free_size) { 1196 void EncodeFreeRegion(Address free_start, int free_size) {
1195 ASSERT(free_size >= kIntSize); 1197 ASSERT(free_size >= kIntSize);
1196 if (free_size == kIntSize) { 1198 if (free_size == kIntSize) {
1197 Memory::uint32_at(free_start) = kSingleFreeEncoding; 1199 Memory::uint32_at(free_start) = MarkCompactCollector::kSingleFreeEncoding;
1198 } else { 1200 } else {
1199 ASSERT(free_size >= 2 * kIntSize); 1201 ASSERT(free_size >= 2 * kIntSize);
1200 Memory::uint32_at(free_start) = kMultiFreeEncoding; 1202 Memory::uint32_at(free_start) = MarkCompactCollector::kMultiFreeEncoding;
1201 Memory::int_at(free_start + kIntSize) = free_size; 1203 Memory::int_at(free_start + kIntSize) = free_size;
1202 } 1204 }
1203 1205
1204 #ifdef DEBUG 1206 #ifdef DEBUG
1205 // Zap the body of the free region. 1207 // Zap the body of the free region.
1206 if (FLAG_enable_slow_asserts) { 1208 if (FLAG_enable_slow_asserts) {
1207 for (int offset = 2 * kIntSize; 1209 for (int offset = 2 * kIntSize;
1208 offset < free_size; 1210 offset < free_size;
1209 offset += kPointerSize) { 1211 offset += kPointerSize) {
1210 Memory::Address_at(free_start + offset) = kZapValue; 1212 Memory::Address_at(free_start + offset) = kZapValue;
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 } 2666 }
2665 2667
2666 2668
2667 void MarkCompactCollector::Initialize() { 2669 void MarkCompactCollector::Initialize() {
2668 StaticPointersToNewGenUpdatingVisitor::Initialize(); 2670 StaticPointersToNewGenUpdatingVisitor::Initialize();
2669 StaticMarkingVisitor::Initialize(); 2671 StaticMarkingVisitor::Initialize();
2670 } 2672 }
2671 2673
2672 2674
2673 } } // namespace v8::internal 2675 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698