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

Side by Side Diff: src/deoptimizer.cc

Issue 2274273003: [deoptimizer] Remove obsolete BailoutType switches. (Closed)
Patch Set: Created 4 years, 3 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/deoptimizer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/deoptimizer.h" 5 #include "src/deoptimizer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 code->set_marked_for_deoptimization(true); 427 code->set_marked_for_deoptimization(true);
428 DeoptimizeMarkedCodeForContext(function->context()->native_context()); 428 DeoptimizeMarkedCodeForContext(function->context()->native_context());
429 } 429 }
430 } 430 }
431 431
432 432
433 void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer) { 433 void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer) {
434 deoptimizer->DoComputeOutputFrames(); 434 deoptimizer->DoComputeOutputFrames();
435 } 435 }
436 436
437 437 bool Deoptimizer::TraceEnabledFor(StackFrame::Type frame_type) {
438 bool Deoptimizer::TraceEnabledFor(BailoutType deopt_type, 438 return (frame_type == StackFrame::STUB) ? FLAG_trace_stub_failures
439 StackFrame::Type frame_type) { 439 : FLAG_trace_deopt;
440 switch (deopt_type) {
441 case EAGER:
442 case SOFT:
443 case LAZY:
444 return (frame_type == StackFrame::STUB)
445 ? FLAG_trace_stub_failures
446 : FLAG_trace_deopt;
447 }
448 FATAL("Unsupported deopt type");
449 return false;
450 } 440 }
451 441
452 442
453 const char* Deoptimizer::MessageFor(BailoutType type) { 443 const char* Deoptimizer::MessageFor(BailoutType type) {
454 switch (type) { 444 switch (type) {
455 case EAGER: return "eager"; 445 case EAGER: return "eager";
456 case SOFT: return "soft"; 446 case SOFT: return "soft";
457 case LAZY: return "lazy"; 447 case LAZY: return "lazy";
458 } 448 }
459 FATAL("Unsupported deopt type"); 449 FATAL("Unsupported deopt type");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 #if DEBUG 499 #if DEBUG
510 DCHECK(compiled_code_ != NULL); 500 DCHECK(compiled_code_ != NULL);
511 if (type == EAGER || type == SOFT || type == LAZY) { 501 if (type == EAGER || type == SOFT || type == LAZY) {
512 DCHECK(compiled_code_->kind() != Code::FUNCTION); 502 DCHECK(compiled_code_->kind() != Code::FUNCTION);
513 } 503 }
514 #endif 504 #endif
515 505
516 StackFrame::Type frame_type = function == NULL 506 StackFrame::Type frame_type = function == NULL
517 ? StackFrame::STUB 507 ? StackFrame::STUB
518 : StackFrame::JAVA_SCRIPT; 508 : StackFrame::JAVA_SCRIPT;
519 trace_scope_ = TraceEnabledFor(type, frame_type) ? 509 trace_scope_ = TraceEnabledFor(frame_type)
520 new CodeTracer::Scope(isolate->GetCodeTracer()) : NULL; 510 ? new CodeTracer::Scope(isolate->GetCodeTracer())
511 : NULL;
521 #ifdef DEBUG 512 #ifdef DEBUG
522 CHECK(AllowHeapAllocation::IsAllowed()); 513 CHECK(AllowHeapAllocation::IsAllowed());
523 disallow_heap_allocation_ = new DisallowHeapAllocation(); 514 disallow_heap_allocation_ = new DisallowHeapAllocation();
524 #endif // DEBUG 515 #endif // DEBUG
525 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { 516 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
526 PROFILE(isolate_, CodeDeoptEvent(compiled_code_, from_, fp_to_sp_delta_)); 517 PROFILE(isolate_, CodeDeoptEvent(compiled_code_, from_, fp_to_sp_delta_));
527 } 518 }
528 unsigned size = ComputeInputFrameSize(); 519 unsigned size = ComputeInputFrameSize();
529 int parameter_count = 520 int parameter_count =
530 function == nullptr 521 function == nullptr
531 ? 0 522 ? 0
532 : (function->shared()->internal_formal_parameter_count() + 1); 523 : (function->shared()->internal_formal_parameter_count() + 1);
533 input_ = new (size) FrameDescription(size, parameter_count); 524 input_ = new (size) FrameDescription(size, parameter_count);
534 input_->SetFrameType(frame_type); 525 input_->SetFrameType(frame_type);
535 } 526 }
536 527
537 Code* Deoptimizer::FindOptimizedCode(JSFunction* function) { 528 Code* Deoptimizer::FindOptimizedCode(JSFunction* function) {
538 switch (bailout_type_) { 529 Code* compiled_code = FindDeoptimizingCode(from_);
539 case Deoptimizer::SOFT: 530 return (compiled_code == NULL)
540 case Deoptimizer::EAGER: 531 ? static_cast<Code*>(isolate_->FindCodeObject(from_))
541 case Deoptimizer::LAZY: { 532 : compiled_code;
542 Code* compiled_code = FindDeoptimizingCode(from_);
543 return (compiled_code == NULL)
544 ? static_cast<Code*>(isolate_->FindCodeObject(from_))
545 : compiled_code;
546 }
547 }
548 FATAL("Could not find code for optimized function");
549 return NULL;
550 } 533 }
551 534
552 535
553 void Deoptimizer::PrintFunctionName() { 536 void Deoptimizer::PrintFunctionName() {
554 if (function_ != nullptr && function_->IsJSFunction()) { 537 if (function_ != nullptr && function_->IsJSFunction()) {
555 function_->ShortPrint(trace_scope_->file()); 538 function_->ShortPrint(trace_scope_->file());
556 } else { 539 } else {
557 PrintF(trace_scope_->file(), 540 PrintF(trace_scope_->file(),
558 "%s", Code::Kind2String(compiled_code_->kind())); 541 "%s", Code::Kind2String(compiled_code_->kind()));
559 } 542 }
(...skipping 3441 matching lines...) Expand 10 before | Expand all | Expand 10 after
4001 CHECK(value_info->IsMaterializedObject()); 3984 CHECK(value_info->IsMaterializedObject());
4002 3985
4003 value_info->value_ = 3986 value_info->value_ =
4004 Handle<Object>(previously_materialized_objects->get(i), isolate_); 3987 Handle<Object>(previously_materialized_objects->get(i), isolate_);
4005 } 3988 }
4006 } 3989 }
4007 } 3990 }
4008 3991
4009 } // namespace internal 3992 } // namespace internal
4010 } // namespace v8 3993 } // namespace v8
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698