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

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

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