| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 // For all contexts, deoptimize code already marked. | 447 // For all contexts, deoptimize code already marked. |
| 448 Object* context = isolate->heap()->native_contexts_list(); | 448 Object* context = isolate->heap()->native_contexts_list(); |
| 449 while (!context->IsUndefined()) { | 449 while (!context->IsUndefined()) { |
| 450 Context* native_context = Context::cast(context); | 450 Context* native_context = Context::cast(context); |
| 451 DeoptimizeMarkedCodeForContext(native_context); | 451 DeoptimizeMarkedCodeForContext(native_context); |
| 452 context = native_context->get(Context::NEXT_CONTEXT_LINK); | 452 context = native_context->get(Context::NEXT_CONTEXT_LINK); |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 | 455 |
| 456 | 456 |
| 457 void Deoptimizer::DeoptimizeGlobalObject(JSObject* object) { | |
| 458 if (FLAG_trace_deopt) { | |
| 459 CodeTracer::Scope scope(object->GetHeap()->isolate()->GetCodeTracer()); | |
| 460 PrintF(scope.file(), "[deoptimize global object @ 0x%08" V8PRIxPTR "]\n", | |
| 461 reinterpret_cast<intptr_t>(object)); | |
| 462 } | |
| 463 if (object->IsJSGlobalProxy()) { | |
| 464 PrototypeIterator iter(object->GetIsolate(), object); | |
| 465 // TODO(verwaest): This CHECK will be hit if the global proxy is detached. | |
| 466 CHECK(iter.GetCurrent()->IsJSGlobalObject()); | |
| 467 Context* native_context = | |
| 468 GlobalObject::cast(iter.GetCurrent())->native_context(); | |
| 469 MarkAllCodeForContext(native_context); | |
| 470 DeoptimizeMarkedCodeForContext(native_context); | |
| 471 } else if (object->IsGlobalObject()) { | |
| 472 Context* native_context = GlobalObject::cast(object)->native_context(); | |
| 473 MarkAllCodeForContext(native_context); | |
| 474 DeoptimizeMarkedCodeForContext(native_context); | |
| 475 } | |
| 476 } | |
| 477 | |
| 478 | |
| 479 void Deoptimizer::MarkAllCodeForContext(Context* context) { | 457 void Deoptimizer::MarkAllCodeForContext(Context* context) { |
| 480 Object* element = context->OptimizedCodeListHead(); | 458 Object* element = context->OptimizedCodeListHead(); |
| 481 while (!element->IsUndefined()) { | 459 while (!element->IsUndefined()) { |
| 482 Code* code = Code::cast(element); | 460 Code* code = Code::cast(element); |
| 483 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); | 461 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); |
| 484 code->set_marked_for_deoptimization(true); | 462 code->set_marked_for_deoptimization(true); |
| 485 element = code->next_code_link(); | 463 element = code->next_code_link(); |
| 486 } | 464 } |
| 487 } | 465 } |
| 488 | 466 |
| (...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3393 DCHECK(value_info->IsMaterializedObject()); | 3371 DCHECK(value_info->IsMaterializedObject()); |
| 3394 | 3372 |
| 3395 value_info->value_ = | 3373 value_info->value_ = |
| 3396 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 3374 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 3397 } | 3375 } |
| 3398 } | 3376 } |
| 3399 } | 3377 } |
| 3400 | 3378 |
| 3401 } // namespace internal | 3379 } // namespace internal |
| 3402 } // namespace v8 | 3380 } // namespace v8 |
| OLD | NEW |