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

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

Issue 1426953006: [heap] Separate out optimized code map processing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 269 // - OptimizedCodeMap references optimized code.
270 // We are not allowed to flush unoptimized code for functions that got 270 // We are not allowed to flush unoptimized code for functions that got
271 // optimized or inlined into optimized code, because we might bailout 271 // optimized or inlined into optimized code, because we might bailout
272 // into the unoptimized code again during deoptimization. 272 // into the unoptimized code again during deoptimization.
273 class CodeFlusher { 273 class CodeFlusher {
274 public: 274 public:
275 explicit CodeFlusher(Isolate* isolate) 275 explicit CodeFlusher(Isolate* isolate)
276 : isolate_(isolate), 276 : isolate_(isolate),
277 jsfunction_candidates_head_(NULL), 277 jsfunction_candidates_head_(nullptr),
278 shared_function_info_candidates_head_(NULL), 278 shared_function_info_candidates_head_(nullptr) {}
279 optimized_code_map_holder_head_(NULL) {}
280 279
281 inline void AddCandidate(SharedFunctionInfo* shared_info); 280 inline void AddCandidate(SharedFunctionInfo* shared_info);
282 inline void AddCandidate(JSFunction* function); 281 inline void AddCandidate(JSFunction* function);
283 inline void AddOptimizedCodeMap(SharedFunctionInfo* code_map_holder);
284 282
285 void EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder);
286 void EvictCandidate(SharedFunctionInfo* shared_info); 283 void EvictCandidate(SharedFunctionInfo* shared_info);
287 void EvictCandidate(JSFunction* function); 284 void EvictCandidate(JSFunction* function);
288 285
289 void ProcessCandidates() { 286 void ProcessCandidates() {
290 ProcessOptimizedCodeMaps();
291 ProcessSharedFunctionInfoCandidates(); 287 ProcessSharedFunctionInfoCandidates();
292 ProcessJSFunctionCandidates(); 288 ProcessJSFunctionCandidates();
293 } 289 }
294 290
295 void EvictAllCandidates() { 291 void EvictAllCandidates() {
296 EvictOptimizedCodeMaps();
297 EvictJSFunctionCandidates(); 292 EvictJSFunctionCandidates();
298 EvictSharedFunctionInfoCandidates(); 293 EvictSharedFunctionInfoCandidates();
299 } 294 }
300 295
301 void IteratePointersToFromSpace(ObjectVisitor* v); 296 void IteratePointersToFromSpace(ObjectVisitor* v);
302 297
303 private: 298 private:
304 void ProcessOptimizedCodeMaps();
305 void ProcessJSFunctionCandidates(); 299 void ProcessJSFunctionCandidates();
306 void ProcessSharedFunctionInfoCandidates(); 300 void ProcessSharedFunctionInfoCandidates();
307 void EvictOptimizedCodeMaps();
308 void EvictJSFunctionCandidates(); 301 void EvictJSFunctionCandidates();
309 void EvictSharedFunctionInfoCandidates(); 302 void EvictSharedFunctionInfoCandidates();
310 303
311 static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate); 304 static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate);
312 static inline JSFunction* GetNextCandidate(JSFunction* candidate); 305 static inline JSFunction* GetNextCandidate(JSFunction* candidate);
313 static inline void SetNextCandidate(JSFunction* candidate, 306 static inline void SetNextCandidate(JSFunction* candidate,
314 JSFunction* next_candidate); 307 JSFunction* next_candidate);
315 static inline void ClearNextCandidate(JSFunction* candidate, 308 static inline void ClearNextCandidate(JSFunction* candidate,
316 Object* undefined); 309 Object* undefined);
317 310
318 static inline SharedFunctionInfo* GetNextCandidate( 311 static inline SharedFunctionInfo* GetNextCandidate(
319 SharedFunctionInfo* candidate); 312 SharedFunctionInfo* candidate);
320 static inline void SetNextCandidate(SharedFunctionInfo* candidate, 313 static inline void SetNextCandidate(SharedFunctionInfo* candidate,
321 SharedFunctionInfo* next_candidate); 314 SharedFunctionInfo* next_candidate);
322 static inline void ClearNextCandidate(SharedFunctionInfo* candidate); 315 static inline void ClearNextCandidate(SharedFunctionInfo* candidate);
323 316
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_; 317 Isolate* isolate_;
330 JSFunction* jsfunction_candidates_head_; 318 JSFunction* jsfunction_candidates_head_;
331 SharedFunctionInfo* shared_function_info_candidates_head_; 319 SharedFunctionInfo* shared_function_info_candidates_head_;
332 SharedFunctionInfo* optimized_code_map_holder_head_;
333 320
334 DISALLOW_COPY_AND_ASSIGN(CodeFlusher); 321 DISALLOW_COPY_AND_ASSIGN(CodeFlusher);
335 }; 322 };
336 323
337 324
338 // Defined in isolate.h. 325 // Defined in isolate.h.
339 class ThreadLocalTop; 326 class ThreadLocalTop;
340 327
341 328
342 // ------------------------------------------------------------------------- 329 // -------------------------------------------------------------------------
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 674
688 // After all reachable objects have been marked those weak map entries 675 // After all reachable objects have been marked those weak map entries
689 // with an unreachable key are removed from all encountered weak maps. 676 // with an unreachable key are removed from all encountered weak maps.
690 // The linked list of all encountered weak maps is destroyed. 677 // The linked list of all encountered weak maps is destroyed.
691 void ClearWeakCollections(); 678 void ClearWeakCollections();
692 679
693 // We have to remove all encountered weak maps from the list of weak 680 // We have to remove all encountered weak maps from the list of weak
694 // collections when incremental marking is aborted. 681 // collections when incremental marking is aborted.
695 void AbortWeakCollections(); 682 void AbortWeakCollections();
696 683
697
698 void ProcessAndClearWeakCells(); 684 void ProcessAndClearWeakCells();
699 void AbortWeakCells(); 685 void AbortWeakCells();
700 686
687 // After all reachable objects have been marked, those entries within
688 // optimized code maps that became unreachable are removed, potentially
689 // trimming or clearing out the entire optimized code map.
690 void ProcessAndClearOptimizedCodeMaps();
691
701 // ----------------------------------------------------------------------- 692 // -----------------------------------------------------------------------
702 // Phase 2: Sweeping to clear mark bits and free non-live objects for 693 // Phase 2: Sweeping to clear mark bits and free non-live objects for
703 // a non-compacting collection. 694 // a non-compacting collection.
704 // 695 //
705 // Before: Live objects are marked and non-live objects are unmarked. 696 // Before: Live objects are marked and non-live objects are unmarked.
706 // 697 //
707 // After: Live objects are unmarked, non-live regions have been added to 698 // After: Live objects are unmarked, non-live regions have been added to
708 // their space's free list. Active eden semispace is compacted by 699 // their space's free list. Active eden semispace is compacted by
709 // evacuation. 700 // evacuation.
710 // 701 //
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 private: 863 private:
873 MarkCompactCollector* collector_; 864 MarkCompactCollector* collector_;
874 }; 865 };
875 866
876 867
877 const char* AllocationSpaceName(AllocationSpace space); 868 const char* AllocationSpaceName(AllocationSpace space);
878 } // namespace internal 869 } // namespace internal
879 } // namespace v8 870 } // namespace v8
880 871
881 #endif // V8_HEAP_MARK_COMPACT_H_ 872 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698