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 |
102 JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) { | 110 JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) { |
103 return reinterpret_cast<JSFunction**>( | 111 return reinterpret_cast<JSFunction**>( |
104 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); | 112 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); |
105 } | 113 } |
106 | 114 |
107 | 115 |
108 JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) { | 116 JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) { |
109 Object* next_candidate = candidate->next_function_link(); | 117 Object* next_candidate = candidate->next_function_link(); |
110 return reinterpret_cast<JSFunction*>(next_candidate); | 118 return reinterpret_cast<JSFunction*>(next_candidate); |
111 } | 119 } |
(...skipping 21 matching lines...) Expand all Loading... |
133 void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate, | 141 void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate, |
134 SharedFunctionInfo* next_candidate) { | 142 SharedFunctionInfo* next_candidate) { |
135 candidate->code()->set_gc_metadata(next_candidate); | 143 candidate->code()->set_gc_metadata(next_candidate); |
136 } | 144 } |
137 | 145 |
138 | 146 |
139 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { | 147 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { |
140 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); | 148 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); |
141 } | 149 } |
142 | 150 |
| 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 |
143 } // namespace internal | 171 } // namespace internal |
144 } // namespace v8 | 172 } // namespace v8 |
145 | 173 |
146 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 174 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |