| OLD | NEW |
| 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 Loading... |
| 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), |
| 398 UPDATE_WEAK_WRITE_BARRIER); |
| 398 set(OPTIMIZED_FUNCTIONS_LIST, function, UPDATE_WEAK_WRITE_BARRIER); | 399 set(OPTIMIZED_FUNCTIONS_LIST, function, UPDATE_WEAK_WRITE_BARRIER); |
| 399 } | 400 } |
| 400 | 401 |
| 401 | 402 |
| 402 void Context::RemoveOptimizedFunction(JSFunction* function) { | 403 void Context::RemoveOptimizedFunction(JSFunction* function) { |
| 403 DCHECK(IsNativeContext()); | 404 DCHECK(IsNativeContext()); |
| 404 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); | 405 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); |
| 405 JSFunction* prev = NULL; | 406 JSFunction* prev = NULL; |
| 406 while (!element->IsUndefined()) { | 407 while (!element->IsUndefined()) { |
| 407 JSFunction* element_function = JSFunction::cast(element); | 408 JSFunction* element_function = JSFunction::cast(element); |
| 408 DCHECK(element_function->next_function_link()->IsUndefined() || | 409 DCHECK(element_function->next_function_link()->IsUndefined() || |
| 409 element_function->next_function_link()->IsJSFunction()); | 410 element_function->next_function_link()->IsJSFunction()); |
| 410 if (element_function == function) { | 411 if (element_function == function) { |
| 411 if (prev == NULL) { | 412 if (prev == NULL) { |
| 412 set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link(), | 413 set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link(), |
| 413 UPDATE_WEAK_WRITE_BARRIER); | 414 UPDATE_WEAK_WRITE_BARRIER); |
| 414 } else { | 415 } else { |
| 415 prev->set_next_function_link(element_function->next_function_link()); | 416 prev->set_next_function_link(element_function->next_function_link(), |
| 417 UPDATE_WEAK_WRITE_BARRIER); |
| 416 } | 418 } |
| 417 element_function->set_next_function_link(GetHeap()->undefined_value()); | 419 element_function->set_next_function_link(GetHeap()->undefined_value(), |
| 420 UPDATE_WEAK_WRITE_BARRIER); |
| 418 return; | 421 return; |
| 419 } | 422 } |
| 420 prev = element_function; | 423 prev = element_function; |
| 421 element = element_function->next_function_link(); | 424 element = element_function->next_function_link(); |
| 422 } | 425 } |
| 423 UNREACHABLE(); | 426 UNREACHABLE(); |
| 424 } | 427 } |
| 425 | 428 |
| 426 | 429 |
| 427 void Context::SetOptimizedFunctionsListHead(Object* head) { | 430 void Context::SetOptimizedFunctionsListHead(Object* head) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 497 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { |
| 495 // During bootstrapping we allow all objects to pass as global | 498 // During bootstrapping we allow all objects to pass as global |
| 496 // objects. This is necessary to fix circular dependencies. | 499 // objects. This is necessary to fix circular dependencies. |
| 497 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 500 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 498 isolate->bootstrapper()->IsActive() || | 501 isolate->bootstrapper()->IsActive() || |
| 499 object->IsGlobalObject(); | 502 object->IsGlobalObject(); |
| 500 } | 503 } |
| 501 #endif | 504 #endif |
| 502 | 505 |
| 503 } } // namespace v8::internal | 506 } } // namespace v8::internal |
| OLD | NEW |