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

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

Issue 1288413002: Make some foo.h headers usable without foo-inl.h header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 4 months 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/mark-compact.h ('k') | src/heap/objects-visiting.h » ('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_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/isolate.h" 9 #include "src/isolate.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 SlotsBuffer::AdditionMode mode) { 54 SlotsBuffer::AdditionMode mode) {
55 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); 55 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
56 if (target_page->IsEvacuationCandidate() && 56 if (target_page->IsEvacuationCandidate() &&
57 !ShouldSkipEvacuationSlotRecording(object)) { 57 !ShouldSkipEvacuationSlotRecording(object)) {
58 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, 58 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
59 target_page->slots_buffer_address(), slot, mode)) { 59 target_page->slots_buffer_address(), slot, mode)) {
60 EvictPopularEvacuationCandidate(target_page); 60 EvictPopularEvacuationCandidate(target_page);
61 } 61 }
62 } 62 }
63 } 63 }
64
65
66 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) {
67 if (GetNextCandidate(shared_info) == NULL) {
68 SetNextCandidate(shared_info, shared_function_info_candidates_head_);
69 shared_function_info_candidates_head_ = shared_info;
70 }
64 } 71 }
65 } // namespace v8::internal 72
73
74 void CodeFlusher::AddCandidate(JSFunction* function) {
75 DCHECK(function->code() == function->shared()->code());
76 if (GetNextCandidate(function)->IsUndefined()) {
77 SetNextCandidate(function, jsfunction_candidates_head_);
78 jsfunction_candidates_head_ = function;
79 }
80 }
81
82
83 void CodeFlusher::AddOptimizedCodeMap(SharedFunctionInfo* code_map_holder) {
84 if (GetNextCodeMap(code_map_holder)->IsUndefined()) {
85 SetNextCodeMap(code_map_holder, optimized_code_map_holder_head_);
86 optimized_code_map_holder_head_ = code_map_holder;
87 }
88 }
89
90
91 JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) {
92 return reinterpret_cast<JSFunction**>(
93 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset));
94 }
95
96
97 JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) {
98 Object* next_candidate = candidate->next_function_link();
99 return reinterpret_cast<JSFunction*>(next_candidate);
100 }
101
102
103 void CodeFlusher::SetNextCandidate(JSFunction* candidate,
104 JSFunction* next_candidate) {
105 candidate->set_next_function_link(next_candidate, UPDATE_WEAK_WRITE_BARRIER);
106 }
107
108
109 void CodeFlusher::ClearNextCandidate(JSFunction* candidate, Object* undefined) {
110 DCHECK(undefined->IsUndefined());
111 candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER);
112 }
113
114
115 SharedFunctionInfo* CodeFlusher::GetNextCandidate(
116 SharedFunctionInfo* candidate) {
117 Object* next_candidate = candidate->code()->gc_metadata();
118 return reinterpret_cast<SharedFunctionInfo*>(next_candidate);
119 }
120
121
122 void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate,
123 SharedFunctionInfo* next_candidate) {
124 candidate->code()->set_gc_metadata(next_candidate);
125 }
126
127
128 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) {
129 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER);
130 }
131
132
133 SharedFunctionInfo* CodeFlusher::GetNextCodeMap(SharedFunctionInfo* holder) {
134 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
135 Object* next_map = code_map->get(SharedFunctionInfo::kNextMapIndex);
136 return reinterpret_cast<SharedFunctionInfo*>(next_map);
137 }
138
139
140 void CodeFlusher::SetNextCodeMap(SharedFunctionInfo* holder,
141 SharedFunctionInfo* next_holder) {
142 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
143 code_map->set(SharedFunctionInfo::kNextMapIndex, next_holder);
144 }
145
146
147 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) {
148 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
149 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex);
150 }
151
152 } // namespace internal
153 } // namespace v8
66 154
67 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 155 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698