Chromium Code Reviews| Index: src/heap/mark-compact.h |
| diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h |
| index 8db7f45c2629bd4322dd737ec98b8bbc19cf1b1f..923d69281cab66ef06e09bf68a5d620ad7675da3 100644 |
| --- a/src/heap/mark-compact.h |
| +++ b/src/heap/mark-compact.h |
| @@ -205,6 +205,8 @@ class MarkingDeque { |
| void SetOverflowed() { overflowed_ = true; } |
| + void DecrementLiveBytes(HeapObject* object); |
|
Hannes Payer (out of office)
2015/08/14 05:05:48
This method does not really belong to MarkingDeque
Michael Starzinger
2015/08/14 07:56:23
Acknowledged. Yes, you are right. As per offline d
|
| + |
| // Push the (marked) object on the marking stack if there is room, |
| // otherwise mark the object as overflowed and wait for a rescan of the |
| // heap. |
| @@ -212,7 +214,7 @@ class MarkingDeque { |
| DCHECK(object->IsHeapObject()); |
| if (IsFull()) { |
| Marking::BlackToGrey(object); |
| - MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size()); |
| + DecrementLiveBytes(object); |
| SetOverflowed(); |
| } else { |
| array_[top_] = object; |
| @@ -253,7 +255,7 @@ class MarkingDeque { |
| DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); |
| if (IsFull()) { |
| Marking::BlackToGrey(object); |
| - MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size()); |
| + DecrementLiveBytes(object); |
| SetOverflowed(); |
| } else { |
| bottom_ = ((bottom_ - 1) & mask_); |
| @@ -459,27 +461,9 @@ class CodeFlusher { |
| shared_function_info_candidates_head_(NULL), |
| optimized_code_map_holder_head_(NULL) {} |
| - void AddCandidate(SharedFunctionInfo* shared_info) { |
| - if (GetNextCandidate(shared_info) == NULL) { |
| - SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
| - shared_function_info_candidates_head_ = shared_info; |
| - } |
| - } |
| - |
| - void AddCandidate(JSFunction* function) { |
| - DCHECK(function->code() == function->shared()->code()); |
| - if (GetNextCandidate(function)->IsUndefined()) { |
| - SetNextCandidate(function, jsfunction_candidates_head_); |
| - jsfunction_candidates_head_ = function; |
| - } |
| - } |
| - |
| - void AddOptimizedCodeMap(SharedFunctionInfo* code_map_holder) { |
| - if (GetNextCodeMap(code_map_holder)->IsUndefined()) { |
| - SetNextCodeMap(code_map_holder, optimized_code_map_holder_head_); |
| - optimized_code_map_holder_head_ = code_map_holder; |
| - } |
| - } |
| + inline void AddCandidate(SharedFunctionInfo* shared_info); |
| + inline void AddCandidate(JSFunction* function); |
| + inline void AddOptimizedCodeMap(SharedFunctionInfo* code_map_holder); |
| void EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder); |
| void EvictCandidate(SharedFunctionInfo* shared_info); |
| @@ -507,57 +491,23 @@ class CodeFlusher { |
| void EvictJSFunctionCandidates(); |
| void EvictSharedFunctionInfoCandidates(); |
| - static JSFunction** GetNextCandidateSlot(JSFunction* candidate) { |
| - return reinterpret_cast<JSFunction**>( |
| - HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); |
| - } |
| - |
| - static JSFunction* GetNextCandidate(JSFunction* candidate) { |
| - Object* next_candidate = candidate->next_function_link(); |
| - return reinterpret_cast<JSFunction*>(next_candidate); |
| - } |
| - |
| - static void SetNextCandidate(JSFunction* candidate, |
| - JSFunction* next_candidate) { |
| - candidate->set_next_function_link(next_candidate, |
| - UPDATE_WEAK_WRITE_BARRIER); |
| - } |
| - |
| - static void ClearNextCandidate(JSFunction* candidate, Object* undefined) { |
| - DCHECK(undefined->IsUndefined()); |
| - candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER); |
| - } |
| - |
| - static SharedFunctionInfo* GetNextCandidate(SharedFunctionInfo* candidate) { |
| - Object* next_candidate = candidate->code()->gc_metadata(); |
| - return reinterpret_cast<SharedFunctionInfo*>(next_candidate); |
| - } |
| - |
| - static void SetNextCandidate(SharedFunctionInfo* candidate, |
| - SharedFunctionInfo* next_candidate) { |
| - candidate->code()->set_gc_metadata(next_candidate); |
| - } |
| - |
| - static void ClearNextCandidate(SharedFunctionInfo* candidate) { |
| - candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); |
| - } |
| - |
| - static SharedFunctionInfo* GetNextCodeMap(SharedFunctionInfo* holder) { |
| - FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); |
| - Object* next_map = code_map->get(SharedFunctionInfo::kNextMapIndex); |
| - return reinterpret_cast<SharedFunctionInfo*>(next_map); |
| - } |
| - |
| - static void SetNextCodeMap(SharedFunctionInfo* holder, |
| - SharedFunctionInfo* next_holder) { |
| - FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); |
| - code_map->set(SharedFunctionInfo::kNextMapIndex, next_holder); |
| - } |
| - |
| - static void ClearNextCodeMap(SharedFunctionInfo* holder) { |
| - FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); |
| - code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); |
| - } |
| + static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate); |
| + static inline JSFunction* GetNextCandidate(JSFunction* candidate); |
| + static inline void SetNextCandidate(JSFunction* candidate, |
| + JSFunction* next_candidate); |
| + static inline void ClearNextCandidate(JSFunction* candidate, |
| + Object* undefined); |
| + |
| + static inline SharedFunctionInfo* GetNextCandidate( |
| + SharedFunctionInfo* candidate); |
| + static inline void SetNextCandidate(SharedFunctionInfo* candidate, |
| + SharedFunctionInfo* next_candidate); |
| + static inline void ClearNextCandidate(SharedFunctionInfo* candidate); |
| + |
| + static inline SharedFunctionInfo* GetNextCodeMap(SharedFunctionInfo* holder); |
| + static inline void SetNextCodeMap(SharedFunctionInfo* holder, |
| + SharedFunctionInfo* next_holder); |
| + static inline void ClearNextCodeMap(SharedFunctionInfo* holder); |
| Isolate* isolate_; |
| JSFunction* jsfunction_candidates_head_; |