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

Side by Side Diff: src/heap/mark-compact.h

Issue 1418453008: [heap] Separate out optimized code map processing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 1 month 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
« no previous file with comments | « src/heap/gc-tracer.cc ('k') | src/heap/mark-compact.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_MARK_COMPACT_H_ 5 #ifndef V8_HEAP_MARK_COMPACT_H_
6 #define V8_HEAP_MARK_COMPACT_H_ 6 #define V8_HEAP_MARK_COMPACT_H_
7 7
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/heap/spaces.h" 9 #include "src/heap/spaces.h"
10 10
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bool overflowed_; 256 bool overflowed_;
257 bool in_use_; 257 bool in_use_;
258 258
259 DISALLOW_COPY_AND_ASSIGN(MarkingDeque); 259 DISALLOW_COPY_AND_ASSIGN(MarkingDeque);
260 }; 260 };
261 261
262 262
263 // CodeFlusher collects candidates for code flushing during marking and 263 // CodeFlusher collects candidates for code flushing during marking and
264 // processes those candidates after marking has completed in order to 264 // processes those candidates after marking has completed in order to
265 // reset those functions referencing code objects that would otherwise 265 // reset those functions referencing code objects that would otherwise
266 // be unreachable. Code objects can be referenced in three ways: 266 // be unreachable. Code objects can be referenced in two ways:
267 // - SharedFunctionInfo references unoptimized code. 267 // - SharedFunctionInfo references unoptimized code.
268 // - JSFunction references either unoptimized or optimized code. 268 // - JSFunction references either unoptimized or optimized code.
269 // - OptimizedCodeMap references optimized code.
270 // We are not allowed to flush unoptimized code for functions that got 269 // We are not allowed to flush unoptimized code for functions that got
271 // optimized or inlined into optimized code, because we might bailout 270 // optimized or inlined into optimized code, because we might bailout
272 // into the unoptimized code again during deoptimization. 271 // into the unoptimized code again during deoptimization.
273 class CodeFlusher { 272 class CodeFlusher {
274 public: 273 public:
275 explicit CodeFlusher(Isolate* isolate) 274 explicit CodeFlusher(Isolate* isolate)
276 : isolate_(isolate), 275 : isolate_(isolate),
277 jsfunction_candidates_head_(NULL), 276 jsfunction_candidates_head_(nullptr),
278 shared_function_info_candidates_head_(NULL), 277 shared_function_info_candidates_head_(nullptr) {}
279 optimized_code_map_holder_head_(NULL) {}
280 278
281 inline void AddCandidate(SharedFunctionInfo* shared_info); 279 inline void AddCandidate(SharedFunctionInfo* shared_info);
282 inline void AddCandidate(JSFunction* function); 280 inline void AddCandidate(JSFunction* function);
283 inline void AddOptimizedCodeMap(SharedFunctionInfo* code_map_holder);
284 281
285 void EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder);
286 void EvictCandidate(SharedFunctionInfo* shared_info); 282 void EvictCandidate(SharedFunctionInfo* shared_info);
287 void EvictCandidate(JSFunction* function); 283 void EvictCandidate(JSFunction* function);
288 284
289 void ProcessCandidates() { 285 void ProcessCandidates() {
290 ProcessOptimizedCodeMaps();
291 ProcessSharedFunctionInfoCandidates(); 286 ProcessSharedFunctionInfoCandidates();
292 ProcessJSFunctionCandidates(); 287 ProcessJSFunctionCandidates();
293 } 288 }
294 289
295 void EvictAllCandidates() { 290 void EvictAllCandidates() {
296 EvictOptimizedCodeMaps();
297 EvictJSFunctionCandidates(); 291 EvictJSFunctionCandidates();
298 EvictSharedFunctionInfoCandidates(); 292 EvictSharedFunctionInfoCandidates();
299 } 293 }
300 294
301 void IteratePointersToFromSpace(ObjectVisitor* v); 295 void IteratePointersToFromSpace(ObjectVisitor* v);
302 296
303 private: 297 private:
304 void ProcessOptimizedCodeMaps();
305 void ProcessJSFunctionCandidates(); 298 void ProcessJSFunctionCandidates();
306 void ProcessSharedFunctionInfoCandidates(); 299 void ProcessSharedFunctionInfoCandidates();
307 void EvictOptimizedCodeMaps();
308 void EvictJSFunctionCandidates(); 300 void EvictJSFunctionCandidates();
309 void EvictSharedFunctionInfoCandidates(); 301 void EvictSharedFunctionInfoCandidates();
310 302
311 static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate); 303 static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate);
312 static inline JSFunction* GetNextCandidate(JSFunction* candidate); 304 static inline JSFunction* GetNextCandidate(JSFunction* candidate);
313 static inline void SetNextCandidate(JSFunction* candidate, 305 static inline void SetNextCandidate(JSFunction* candidate,
314 JSFunction* next_candidate); 306 JSFunction* next_candidate);
315 static inline void ClearNextCandidate(JSFunction* candidate, 307 static inline void ClearNextCandidate(JSFunction* candidate,
316 Object* undefined); 308 Object* undefined);
317 309
318 static inline SharedFunctionInfo* GetNextCandidate( 310 static inline SharedFunctionInfo* GetNextCandidate(
319 SharedFunctionInfo* candidate); 311 SharedFunctionInfo* candidate);
320 static inline void SetNextCandidate(SharedFunctionInfo* candidate, 312 static inline void SetNextCandidate(SharedFunctionInfo* candidate,
321 SharedFunctionInfo* next_candidate); 313 SharedFunctionInfo* next_candidate);
322 static inline void ClearNextCandidate(SharedFunctionInfo* candidate); 314 static inline void ClearNextCandidate(SharedFunctionInfo* candidate);
323 315
324 static inline SharedFunctionInfo* GetNextCodeMap(SharedFunctionInfo* holder);
325 static inline void SetNextCodeMap(SharedFunctionInfo* holder,
326 SharedFunctionInfo* next_holder);
327 static inline void ClearNextCodeMap(SharedFunctionInfo* holder);
328
329 Isolate* isolate_; 316 Isolate* isolate_;
330 JSFunction* jsfunction_candidates_head_; 317 JSFunction* jsfunction_candidates_head_;
331 SharedFunctionInfo* shared_function_info_candidates_head_; 318 SharedFunctionInfo* shared_function_info_candidates_head_;
332 SharedFunctionInfo* optimized_code_map_holder_head_;
333 319
334 DISALLOW_COPY_AND_ASSIGN(CodeFlusher); 320 DISALLOW_COPY_AND_ASSIGN(CodeFlusher);
335 }; 321 };
336 322
337 323
338 // Defined in isolate.h. 324 // Defined in isolate.h.
339 class ThreadLocalTop; 325 class ThreadLocalTop;
340 326
341 327
342 // ------------------------------------------------------------------------- 328 // -------------------------------------------------------------------------
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 673
688 // After all reachable objects have been marked those weak map entries 674 // After all reachable objects have been marked those weak map entries
689 // with an unreachable key are removed from all encountered weak maps. 675 // with an unreachable key are removed from all encountered weak maps.
690 // The linked list of all encountered weak maps is destroyed. 676 // The linked list of all encountered weak maps is destroyed.
691 void ClearWeakCollections(); 677 void ClearWeakCollections();
692 678
693 // We have to remove all encountered weak maps from the list of weak 679 // We have to remove all encountered weak maps from the list of weak
694 // collections when incremental marking is aborted. 680 // collections when incremental marking is aborted.
695 void AbortWeakCollections(); 681 void AbortWeakCollections();
696 682
697
698 void ProcessAndClearWeakCells(); 683 void ProcessAndClearWeakCells();
699 void AbortWeakCells(); 684 void AbortWeakCells();
700 685
686 // After all reachable objects have been marked, those entries within
687 // optimized code maps that became unreachable are removed, potentially
688 // trimming or clearing out the entire optimized code map.
689 void ProcessAndClearOptimizedCodeMaps();
690
701 // ----------------------------------------------------------------------- 691 // -----------------------------------------------------------------------
702 // Phase 2: Sweeping to clear mark bits and free non-live objects for 692 // Phase 2: Sweeping to clear mark bits and free non-live objects for
703 // a non-compacting collection. 693 // a non-compacting collection.
704 // 694 //
705 // Before: Live objects are marked and non-live objects are unmarked. 695 // Before: Live objects are marked and non-live objects are unmarked.
706 // 696 //
707 // After: Live objects are unmarked, non-live regions have been added to 697 // After: Live objects are unmarked, non-live regions have been added to
708 // their space's free list. Active eden semispace is compacted by 698 // their space's free list. Active eden semispace is compacted by
709 // evacuation. 699 // evacuation.
710 // 700 //
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 private: 862 private:
873 MarkCompactCollector* collector_; 863 MarkCompactCollector* collector_;
874 }; 864 };
875 865
876 866
877 const char* AllocationSpaceName(AllocationSpace space); 867 const char* AllocationSpaceName(AllocationSpace space);
878 } // namespace internal 868 } // namespace internal
879 } // namespace v8 869 } // namespace v8
880 870
881 #endif // V8_HEAP_MARK_COMPACT_H_ 871 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698