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

Side by Side Diff: src/contexts.cc

Issue 1152153004: Treat weak references in context weakly in write barrier. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/bootstrapper.cc ('k') | src/heap/objects-visiting.cc » ('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/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/debug.h" 8 #include "src/debug.h"
9 #include "src/scopeinfo.h" 9 #include "src/scopeinfo.h"
10 10
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // If the function link field is already used then the function was 388 // If the function link field is already used then the function was
389 // enqueued as a code flushing candidate and we remove it now. 389 // enqueued as a code flushing candidate and we remove it now.
390 if (!function->next_function_link()->IsUndefined()) { 390 if (!function->next_function_link()->IsUndefined()) {
391 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); 391 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher();
392 flusher->EvictCandidate(function); 392 flusher->EvictCandidate(function);
393 } 393 }
394 394
395 DCHECK(function->next_function_link()->IsUndefined()); 395 DCHECK(function->next_function_link()->IsUndefined());
396 396
397 function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST)); 397 function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST));
ulan 2015/05/27 13:35:51 set_next_function_link should be weak too. Is this
Hannes Payer (out of office) 2015/05/27 13:48:59 Next CL together with the other weak next function
398 set(OPTIMIZED_FUNCTIONS_LIST, function); 398 set(OPTIMIZED_FUNCTIONS_LIST, function, UPDATE_WEAK_WRITE_BARRIER);
399 } 399 }
400 400
401 401
402 void Context::RemoveOptimizedFunction(JSFunction* function) { 402 void Context::RemoveOptimizedFunction(JSFunction* function) {
403 DCHECK(IsNativeContext()); 403 DCHECK(IsNativeContext());
404 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); 404 Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
405 JSFunction* prev = NULL; 405 JSFunction* prev = NULL;
406 while (!element->IsUndefined()) { 406 while (!element->IsUndefined()) {
407 JSFunction* element_function = JSFunction::cast(element); 407 JSFunction* element_function = JSFunction::cast(element);
408 DCHECK(element_function->next_function_link()->IsUndefined() || 408 DCHECK(element_function->next_function_link()->IsUndefined() ||
409 element_function->next_function_link()->IsJSFunction()); 409 element_function->next_function_link()->IsJSFunction());
410 if (element_function == function) { 410 if (element_function == function) {
411 if (prev == NULL) { 411 if (prev == NULL) {
412 set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link()); 412 set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link(),
413 UPDATE_WEAK_WRITE_BARRIER);
413 } else { 414 } else {
414 prev->set_next_function_link(element_function->next_function_link()); 415 prev->set_next_function_link(element_function->next_function_link());
415 } 416 }
416 element_function->set_next_function_link(GetHeap()->undefined_value()); 417 element_function->set_next_function_link(GetHeap()->undefined_value());
417 return; 418 return;
418 } 419 }
419 prev = element_function; 420 prev = element_function;
420 element = element_function->next_function_link(); 421 element = element_function->next_function_link();
421 } 422 }
422 UNREACHABLE(); 423 UNREACHABLE();
423 } 424 }
424 425
425 426
426 void Context::SetOptimizedFunctionsListHead(Object* head) { 427 void Context::SetOptimizedFunctionsListHead(Object* head) {
427 DCHECK(IsNativeContext()); 428 DCHECK(IsNativeContext());
428 set(OPTIMIZED_FUNCTIONS_LIST, head); 429 set(OPTIMIZED_FUNCTIONS_LIST, head, UPDATE_WEAK_WRITE_BARRIER);
429 } 430 }
430 431
431 432
432 Object* Context::OptimizedFunctionsListHead() { 433 Object* Context::OptimizedFunctionsListHead() {
433 DCHECK(IsNativeContext()); 434 DCHECK(IsNativeContext());
434 return get(OPTIMIZED_FUNCTIONS_LIST); 435 return get(OPTIMIZED_FUNCTIONS_LIST);
435 } 436 }
436 437
437 438
438 void Context::AddOptimizedCode(Code* code) { 439 void Context::AddOptimizedCode(Code* code) {
439 DCHECK(IsNativeContext()); 440 DCHECK(IsNativeContext());
440 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); 441 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
441 DCHECK(code->next_code_link()->IsUndefined()); 442 DCHECK(code->next_code_link()->IsUndefined());
442 code->set_next_code_link(get(OPTIMIZED_CODE_LIST)); 443 code->set_next_code_link(get(OPTIMIZED_CODE_LIST));
443 set(OPTIMIZED_CODE_LIST, code); 444 set(OPTIMIZED_CODE_LIST, code, UPDATE_WEAK_WRITE_BARRIER);
444 } 445 }
445 446
446 447
447 void Context::SetOptimizedCodeListHead(Object* head) { 448 void Context::SetOptimizedCodeListHead(Object* head) {
448 DCHECK(IsNativeContext()); 449 DCHECK(IsNativeContext());
449 set(OPTIMIZED_CODE_LIST, head); 450 set(OPTIMIZED_CODE_LIST, head, UPDATE_WEAK_WRITE_BARRIER);
450 } 451 }
451 452
452 453
453 Object* Context::OptimizedCodeListHead() { 454 Object* Context::OptimizedCodeListHead() {
454 DCHECK(IsNativeContext()); 455 DCHECK(IsNativeContext());
455 return get(OPTIMIZED_CODE_LIST); 456 return get(OPTIMIZED_CODE_LIST);
456 } 457 }
457 458
458 459
459 void Context::SetDeoptimizedCodeListHead(Object* head) { 460 void Context::SetDeoptimizedCodeListHead(Object* head) {
460 DCHECK(IsNativeContext()); 461 DCHECK(IsNativeContext());
461 set(DEOPTIMIZED_CODE_LIST, head); 462 set(DEOPTIMIZED_CODE_LIST, head, UPDATE_WEAK_WRITE_BARRIER);
462 } 463 }
463 464
464 465
465 Object* Context::DeoptimizedCodeListHead() { 466 Object* Context::DeoptimizedCodeListHead() {
466 DCHECK(IsNativeContext()); 467 DCHECK(IsNativeContext());
467 return get(DEOPTIMIZED_CODE_LIST); 468 return get(DEOPTIMIZED_CODE_LIST);
468 } 469 }
469 470
470 471
471 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { 472 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() {
(...skipping 21 matching lines...) Expand all
493 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 494 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
494 // During bootstrapping we allow all objects to pass as global 495 // During bootstrapping we allow all objects to pass as global
495 // objects. This is necessary to fix circular dependencies. 496 // objects. This is necessary to fix circular dependencies.
496 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 497 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
497 isolate->bootstrapper()->IsActive() || 498 isolate->bootstrapper()->IsActive() ||
498 object->IsGlobalObject(); 499 object->IsGlobalObject();
499 } 500 }
500 #endif 501 #endif
501 502
502 } } // namespace v8::internal 503 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698