| 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/slots-buffer.h" | 9 #include "src/heap/slots-buffer.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 void CodeFlusher::AddCandidate(JSFunction* function) { | 93 void CodeFlusher::AddCandidate(JSFunction* function) { |
| 94 DCHECK(function->code() == function->shared()->code()); | 94 DCHECK(function->code() == function->shared()->code()); |
| 95 if (GetNextCandidate(function)->IsUndefined()) { | 95 if (GetNextCandidate(function)->IsUndefined()) { |
| 96 SetNextCandidate(function, jsfunction_candidates_head_); | 96 SetNextCandidate(function, jsfunction_candidates_head_); |
| 97 jsfunction_candidates_head_ = function; | 97 jsfunction_candidates_head_ = function; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 void CodeFlusher::AddOptimizedCodeMap(SharedFunctionInfo* code_map_holder) { | |
| 103 if (GetNextCodeMap(code_map_holder)->IsUndefined()) { | |
| 104 SetNextCodeMap(code_map_holder, optimized_code_map_holder_head_); | |
| 105 optimized_code_map_holder_head_ = code_map_holder; | |
| 106 } | |
| 107 } | |
| 108 | |
| 109 | |
| 110 JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) { | 102 JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) { |
| 111 return reinterpret_cast<JSFunction**>( | 103 return reinterpret_cast<JSFunction**>( |
| 112 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); | 104 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); |
| 113 } | 105 } |
| 114 | 106 |
| 115 | 107 |
| 116 JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) { | 108 JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) { |
| 117 Object* next_candidate = candidate->next_function_link(); | 109 Object* next_candidate = candidate->next_function_link(); |
| 118 return reinterpret_cast<JSFunction*>(next_candidate); | 110 return reinterpret_cast<JSFunction*>(next_candidate); |
| 119 } | 111 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 141 void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate, | 133 void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate, |
| 142 SharedFunctionInfo* next_candidate) { | 134 SharedFunctionInfo* next_candidate) { |
| 143 candidate->code()->set_gc_metadata(next_candidate); | 135 candidate->code()->set_gc_metadata(next_candidate); |
| 144 } | 136 } |
| 145 | 137 |
| 146 | 138 |
| 147 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { | 139 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { |
| 148 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); | 140 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); |
| 149 } | 141 } |
| 150 | 142 |
| 151 | |
| 152 SharedFunctionInfo* CodeFlusher::GetNextCodeMap(SharedFunctionInfo* holder) { | |
| 153 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); | |
| 154 Object* next_map = code_map->get(SharedFunctionInfo::kNextMapIndex); | |
| 155 return reinterpret_cast<SharedFunctionInfo*>(next_map); | |
| 156 } | |
| 157 | |
| 158 | |
| 159 void CodeFlusher::SetNextCodeMap(SharedFunctionInfo* holder, | |
| 160 SharedFunctionInfo* next_holder) { | |
| 161 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); | |
| 162 code_map->set(SharedFunctionInfo::kNextMapIndex, next_holder); | |
| 163 } | |
| 164 | |
| 165 | |
| 166 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { | |
| 167 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); | |
| 168 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); | |
| 169 } | |
| 170 | |
| 171 } // namespace internal | 143 } // namespace internal |
| 172 } // namespace v8 | 144 } // namespace v8 |
| 173 | 145 |
| 174 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 146 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |