| OLD | NEW |
| 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_INL_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ |
| 6 #define V8_HEAP_MARK_COMPACT_INL_H_ | 6 #define V8_HEAP_MARK_COMPACT_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap/mark-compact.h" | 8 #include "src/heap/mark-compact.h" |
| 9 #include "src/heap/remembered-set.h" | 9 #include "src/heap/remembered-set.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { | 72 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { |
| 73 if (GetNextCandidate(shared_info) == nullptr) { | 73 if (GetNextCandidate(shared_info) == nullptr) { |
| 74 SetNextCandidate(shared_info, shared_function_info_candidates_head_); | 74 SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
| 75 shared_function_info_candidates_head_ = shared_info; | 75 shared_function_info_candidates_head_ = shared_info; |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 void CodeFlusher::AddCandidate(JSFunction* function) { | 80 void CodeFlusher::AddCandidate(JSFunction* function) { |
| 81 DCHECK(function->code() == function->shared()->code()); | 81 DCHECK(function->code() == function->shared()->code()); |
| 82 if (function->next_function_link()->IsUndefined()) { | 82 if (function->next_function_link()->IsUndefined(isolate_)) { |
| 83 SetNextCandidate(function, jsfunction_candidates_head_); | 83 SetNextCandidate(function, jsfunction_candidates_head_); |
| 84 jsfunction_candidates_head_ = function; | 84 jsfunction_candidates_head_ = function; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) { | 89 JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) { |
| 90 return reinterpret_cast<JSFunction**>( | 90 return reinterpret_cast<JSFunction**>( |
| 91 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); | 91 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) { | 95 JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) { |
| 96 Object* next_candidate = candidate->next_function_link(); | 96 Object* next_candidate = candidate->next_function_link(); |
| 97 return reinterpret_cast<JSFunction*>(next_candidate); | 97 return reinterpret_cast<JSFunction*>(next_candidate); |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 void CodeFlusher::SetNextCandidate(JSFunction* candidate, | 101 void CodeFlusher::SetNextCandidate(JSFunction* candidate, |
| 102 JSFunction* next_candidate) { | 102 JSFunction* next_candidate) { |
| 103 candidate->set_next_function_link(next_candidate, UPDATE_WEAK_WRITE_BARRIER); | 103 candidate->set_next_function_link(next_candidate, UPDATE_WEAK_WRITE_BARRIER); |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 void CodeFlusher::ClearNextCandidate(JSFunction* candidate, Object* undefined) { | 107 void CodeFlusher::ClearNextCandidate(JSFunction* candidate, Object* undefined) { |
| 108 DCHECK(undefined->IsUndefined()); | 108 DCHECK(undefined->IsUndefined(candidate->GetIsolate())); |
| 109 candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER); | 109 candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER); |
| 110 } | 110 } |
| 111 | 111 |
| 112 | 112 |
| 113 SharedFunctionInfo* CodeFlusher::GetNextCandidate( | 113 SharedFunctionInfo* CodeFlusher::GetNextCandidate( |
| 114 SharedFunctionInfo* candidate) { | 114 SharedFunctionInfo* candidate) { |
| 115 Object* next_candidate = candidate->code()->gc_metadata(); | 115 Object* next_candidate = candidate->code()->gc_metadata(); |
| 116 return reinterpret_cast<SharedFunctionInfo*>(next_candidate); | 116 return reinterpret_cast<SharedFunctionInfo*>(next_candidate); |
| 117 } | 117 } |
| 118 | 118 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 if (object != nullptr) return object; | 175 if (object != nullptr) return object; |
| 176 } | 176 } |
| 177 return nullptr; | 177 return nullptr; |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace internal | 180 } // namespace internal |
| 181 } // namespace v8 | 181 } // namespace v8 |
| 182 | 182 |
| 183 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 183 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |