Chromium Code Reviews| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 ZoneList<Code*> codes(10, &zone); | 372 ZoneList<Code*> codes(10, &zone); |
| 373 | 373 |
| 374 // Walk over all optimized code objects in this native context. | 374 // Walk over all optimized code objects in this native context. |
| 375 Code* prev = NULL; | 375 Code* prev = NULL; |
| 376 Object* element = context->OptimizedCodeListHead(); | 376 Object* element = context->OptimizedCodeListHead(); |
| 377 while (!element->IsUndefined()) { | 377 while (!element->IsUndefined()) { |
| 378 Code* code = Code::cast(element); | 378 Code* code = Code::cast(element); |
| 379 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); | 379 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); |
| 380 Object* next = code->next_code_link(); | 380 Object* next = code->next_code_link(); |
| 381 | 381 |
| 382 if (code->marked_for_deoptimization() && | 382 if (code->marked_for_deoptimization()) { |
| 383 (!code->is_turbofanned() || FLAG_turbo_deoptimization)) { | 383 DCHECK(!code->is_turbofanned() || FLAG_turbo_deoptimization); |
| 384 // Put the code into the list for later patching. | 384 // Put the code into the list for later patching. |
| 385 codes.Add(code, &zone); | 385 codes.Add(code, &zone); |
| 386 | 386 |
| 387 if (prev != NULL) { | 387 if (prev != NULL) { |
| 388 // Skip this code in the optimized code list. | 388 // Skip this code in the optimized code list. |
| 389 prev->set_next_code_link(next); | 389 prev->set_next_code_link(next); |
| 390 } else { | 390 } else { |
| 391 // There was no previous node, the next node is the new head. | 391 // There was no previous node, the next node is the new head. |
| 392 context->SetOptimizedCodeListHead(next); | 392 context->SetOptimizedCodeListHead(next); |
| 393 } | 393 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 | 491 |
| 492 | 492 |
| 493 void Deoptimizer::MarkAllCodeForContext(Context* context) { | 493 void Deoptimizer::MarkAllCodeForContext(Context* context) { |
| 494 Object* element = context->OptimizedCodeListHead(); | 494 Object* element = context->OptimizedCodeListHead(); |
| 495 while (!element->IsUndefined()) { | 495 while (!element->IsUndefined()) { |
| 496 Code* code = Code::cast(element); | 496 Code* code = Code::cast(element); |
| 497 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); | 497 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); |
| 498 code->set_marked_for_deoptimization(true); | 498 code->set_marked_for_deoptimization(true); |
| 499 PrintF("%d: MarkAllCodeForContext: Set %p for deoptimization\n", | |
| 500 ThreadId::Current().ToInteger(), reinterpret_cast<void*>(code)); | |
|
Jarin
2015/05/08 08:34:15
This PrintF should be removed, no?
| |
| 499 element = code->next_code_link(); | 501 element = code->next_code_link(); |
| 500 } | 502 } |
| 501 } | 503 } |
| 502 | 504 |
| 503 | 505 |
| 504 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { | 506 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { |
| 505 Code* code = function->code(); | 507 Code* code = function->code(); |
| 506 if (code->kind() == Code::OPTIMIZED_FUNCTION) { | 508 if (code->kind() == Code::OPTIMIZED_FUNCTION) { |
| 507 // Mark the code for deoptimization and unlink any functions that also | 509 // Mark the code for deoptimization and unlink any functions that also |
| 508 // refer to that code. The code cannot be shared across native contexts, | 510 // refer to that code. The code cannot be shared across native contexts, |
| (...skipping 3291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3800 int raw_position = static_cast<int>(info->data()); | 3802 int raw_position = static_cast<int>(info->data()); |
| 3801 last_position = raw_position ? SourcePosition::FromRaw(raw_position) | 3803 last_position = raw_position ? SourcePosition::FromRaw(raw_position) |
| 3802 : SourcePosition::Unknown(); | 3804 : SourcePosition::Unknown(); |
| 3803 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { | 3805 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { |
| 3804 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); | 3806 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); |
| 3805 } | 3807 } |
| 3806 } | 3808 } |
| 3807 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); | 3809 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); |
| 3808 } | 3810 } |
| 3809 } } // namespace v8::internal | 3811 } } // namespace v8::internal |
| OLD | NEW |