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

Side by Side Diff: src/heap/objects-visiting.cc

Issue 1158423002: Treat links that organize weak objects weakly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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-inl.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap/objects-visiting.h" 7 #include "src/heap/objects-visiting.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 T* candidate = reinterpret_cast<T*>(list); 246 T* candidate = reinterpret_cast<T*>(list);
247 list = WeakListVisitor<T>::WeakNext(candidate); 247 list = WeakListVisitor<T>::WeakNext(candidate);
248 WeakListVisitor<T>::SetWeakNext(candidate, undefined); 248 WeakListVisitor<T>::SetWeakNext(candidate, undefined);
249 } 249 }
250 } 250 }
251 251
252 252
253 template <> 253 template <>
254 struct WeakListVisitor<JSFunction> { 254 struct WeakListVisitor<JSFunction> {
255 static void SetWeakNext(JSFunction* function, Object* next) { 255 static void SetWeakNext(JSFunction* function, Object* next) {
256 function->set_next_function_link(next); 256 function->set_next_function_link(next, UPDATE_WEAK_WRITE_BARRIER);
257 } 257 }
258 258
259 static Object* WeakNext(JSFunction* function) { 259 static Object* WeakNext(JSFunction* function) {
260 return function->next_function_link(); 260 return function->next_function_link();
261 } 261 }
262 262
263 static int WeakNextOffset() { return JSFunction::kNextFunctionLinkOffset; } 263 static int WeakNextOffset() { return JSFunction::kNextFunctionLinkOffset; }
264 264
265 static void VisitLiveObject(Heap*, JSFunction*, WeakObjectRetainer*) {} 265 static void VisitLiveObject(Heap*, JSFunction*, WeakObjectRetainer*) {}
266 266
267 static void VisitPhantomObject(Heap*, JSFunction*) {} 267 static void VisitPhantomObject(Heap*, JSFunction*) {}
268 }; 268 };
269 269
270 270
271 template <> 271 template <>
272 struct WeakListVisitor<Code> { 272 struct WeakListVisitor<Code> {
273 static void SetWeakNext(Code* code, Object* next) { 273 static void SetWeakNext(Code* code, Object* next) {
274 code->set_next_code_link(next); 274 code->set_next_code_link(next, UPDATE_WEAK_WRITE_BARRIER);
275 } 275 }
276 276
277 static Object* WeakNext(Code* code) { return code->next_code_link(); } 277 static Object* WeakNext(Code* code) { return code->next_code_link(); }
278 278
279 static int WeakNextOffset() { return Code::kNextCodeLinkOffset; } 279 static int WeakNextOffset() { return Code::kNextCodeLinkOffset; }
280 280
281 static void VisitLiveObject(Heap*, Code*, WeakObjectRetainer*) {} 281 static void VisitLiveObject(Heap*, Code*, WeakObjectRetainer*) {}
282 282
283 static void VisitPhantomObject(Heap*, Code*) {} 283 static void VisitPhantomObject(Heap*, Code*) {}
284 }; 284 };
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 context->get(Context::OPTIMIZED_FUNCTIONS_LIST)); 335 context->get(Context::OPTIMIZED_FUNCTIONS_LIST));
336 ClearWeakList<Code>(heap, context->get(Context::OPTIMIZED_CODE_LIST)); 336 ClearWeakList<Code>(heap, context->get(Context::OPTIMIZED_CODE_LIST));
337 ClearWeakList<Code>(heap, context->get(Context::DEOPTIMIZED_CODE_LIST)); 337 ClearWeakList<Code>(heap, context->get(Context::DEOPTIMIZED_CODE_LIST));
338 } 338 }
339 }; 339 };
340 340
341 341
342 template <> 342 template <>
343 struct WeakListVisitor<AllocationSite> { 343 struct WeakListVisitor<AllocationSite> {
344 static void SetWeakNext(AllocationSite* obj, Object* next) { 344 static void SetWeakNext(AllocationSite* obj, Object* next) {
345 obj->set_weak_next(next); 345 obj->set_weak_next(next, UPDATE_WEAK_WRITE_BARRIER);
346 } 346 }
347 347
348 static Object* WeakNext(AllocationSite* obj) { return obj->weak_next(); } 348 static Object* WeakNext(AllocationSite* obj) { return obj->weak_next(); }
349 349
350 static int WeakNextOffset() { return AllocationSite::kWeakNextOffset; } 350 static int WeakNextOffset() { return AllocationSite::kWeakNextOffset; }
351 351
352 static void VisitLiveObject(Heap*, AllocationSite*, WeakObjectRetainer*) {} 352 static void VisitLiveObject(Heap*, AllocationSite*, WeakObjectRetainer*) {}
353 353
354 static void VisitPhantomObject(Heap*, AllocationSite*) {} 354 static void VisitPhantomObject(Heap*, AllocationSite*) {}
355 }; 355 };
356 356
357 357
358 template Object* VisitWeakList<Context>(Heap* heap, Object* list, 358 template Object* VisitWeakList<Context>(Heap* heap, Object* list,
359 WeakObjectRetainer* retainer); 359 WeakObjectRetainer* retainer);
360 360
361 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, 361 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list,
362 WeakObjectRetainer* retainer); 362 WeakObjectRetainer* retainer);
363 } 363 }
364 } // namespace v8::internal 364 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698