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

Side by Side Diff: src/deoptimizer.cc

Issue 2272653002: [deoptimizer] Remove obsolete constructor argument. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 67
68 // We rely on this function not causing a GC. It is called from generated code 68 // We rely on this function not causing a GC. It is called from generated code
69 // without having a real stack frame in place. 69 // without having a real stack frame in place.
70 Deoptimizer* Deoptimizer::New(JSFunction* function, 70 Deoptimizer* Deoptimizer::New(JSFunction* function,
71 BailoutType type, 71 BailoutType type,
72 unsigned bailout_id, 72 unsigned bailout_id,
73 Address from, 73 Address from,
74 int fp_to_sp_delta, 74 int fp_to_sp_delta,
75 Isolate* isolate) { 75 Isolate* isolate) {
76 Deoptimizer* deoptimizer = new Deoptimizer(isolate, 76 Deoptimizer* deoptimizer = new Deoptimizer(isolate, function, type,
77 function, 77 bailout_id, from, fp_to_sp_delta);
78 type,
79 bailout_id,
80 from,
81 fp_to_sp_delta,
82 NULL);
83 CHECK(isolate->deoptimizer_data()->current_ == NULL); 78 CHECK(isolate->deoptimizer_data()->current_ == NULL);
84 isolate->deoptimizer_data()->current_ = deoptimizer; 79 isolate->deoptimizer_data()->current_ = deoptimizer;
85 return deoptimizer; 80 return deoptimizer;
86 } 81 }
87 82
88 83
89 // No larger than 2K on all platforms 84 // No larger than 2K on all platforms
90 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB; 85 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB;
91 86
92 87
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 case EAGER: return "eager"; 455 case EAGER: return "eager";
461 case SOFT: return "soft"; 456 case SOFT: return "soft";
462 case LAZY: return "lazy"; 457 case LAZY: return "lazy";
463 } 458 }
464 FATAL("Unsupported deopt type"); 459 FATAL("Unsupported deopt type");
465 return NULL; 460 return NULL;
466 } 461 }
467 462
468 Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function, 463 Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function,
469 BailoutType type, unsigned bailout_id, Address from, 464 BailoutType type, unsigned bailout_id, Address from,
470 int fp_to_sp_delta, Code* optimized_code) 465 int fp_to_sp_delta)
471 : isolate_(isolate), 466 : isolate_(isolate),
472 function_(function), 467 function_(function),
473 bailout_id_(bailout_id), 468 bailout_id_(bailout_id),
474 bailout_type_(type), 469 bailout_type_(type),
475 from_(from), 470 from_(from),
476 fp_to_sp_delta_(fp_to_sp_delta), 471 fp_to_sp_delta_(fp_to_sp_delta),
477 deoptimizing_throw_(false), 472 deoptimizing_throw_(false),
478 catch_handler_data_(-1), 473 catch_handler_data_(-1),
479 catch_handler_pc_offset_(-1), 474 catch_handler_pc_offset_(-1),
480 input_(nullptr), 475 input_(nullptr),
(...skipping 22 matching lines...) Expand all
503 function->shared()->increment_deopt_count(); 498 function->shared()->increment_deopt_count();
504 if (bailout_type_ == Deoptimizer::SOFT) { 499 if (bailout_type_ == Deoptimizer::SOFT) {
505 isolate->counters()->soft_deopts_executed()->Increment(); 500 isolate->counters()->soft_deopts_executed()->Increment();
506 // Soft deopts shouldn't count against the overall re-optimization count 501 // Soft deopts shouldn't count against the overall re-optimization count
507 // that can eventually lead to disabling optimization for a function. 502 // that can eventually lead to disabling optimization for a function.
508 int opt_count = function->shared()->opt_count(); 503 int opt_count = function->shared()->opt_count();
509 if (opt_count > 0) opt_count--; 504 if (opt_count > 0) opt_count--;
510 function->shared()->set_opt_count(opt_count); 505 function->shared()->set_opt_count(opt_count);
511 } 506 }
512 } 507 }
513 compiled_code_ = FindOptimizedCode(function, optimized_code); 508 compiled_code_ = FindOptimizedCode(function);
514 #if DEBUG 509 #if DEBUG
515 DCHECK(compiled_code_ != NULL); 510 DCHECK(compiled_code_ != NULL);
516 if (type == EAGER || type == SOFT || type == LAZY) { 511 if (type == EAGER || type == SOFT || type == LAZY) {
517 DCHECK(compiled_code_->kind() != Code::FUNCTION); 512 DCHECK(compiled_code_->kind() != Code::FUNCTION);
518 } 513 }
519 #endif 514 #endif
520 515
521 StackFrame::Type frame_type = function == NULL 516 StackFrame::Type frame_type = function == NULL
522 ? StackFrame::STUB 517 ? StackFrame::STUB
523 : StackFrame::JAVA_SCRIPT; 518 : StackFrame::JAVA_SCRIPT;
524 trace_scope_ = TraceEnabledFor(type, frame_type) ? 519 trace_scope_ = TraceEnabledFor(type, frame_type) ?
525 new CodeTracer::Scope(isolate->GetCodeTracer()) : NULL; 520 new CodeTracer::Scope(isolate->GetCodeTracer()) : NULL;
526 #ifdef DEBUG 521 #ifdef DEBUG
527 CHECK(AllowHeapAllocation::IsAllowed()); 522 CHECK(AllowHeapAllocation::IsAllowed());
528 disallow_heap_allocation_ = new DisallowHeapAllocation(); 523 disallow_heap_allocation_ = new DisallowHeapAllocation();
529 #endif // DEBUG 524 #endif // DEBUG
530 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { 525 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
531 PROFILE(isolate_, CodeDeoptEvent(compiled_code_, from_, fp_to_sp_delta_)); 526 PROFILE(isolate_, CodeDeoptEvent(compiled_code_, from_, fp_to_sp_delta_));
532 } 527 }
533 unsigned size = ComputeInputFrameSize(); 528 unsigned size = ComputeInputFrameSize();
534 int parameter_count = 529 int parameter_count =
535 function == nullptr 530 function == nullptr
536 ? 0 531 ? 0
537 : (function->shared()->internal_formal_parameter_count() + 1); 532 : (function->shared()->internal_formal_parameter_count() + 1);
538 input_ = new (size) FrameDescription(size, parameter_count); 533 input_ = new (size) FrameDescription(size, parameter_count);
539 input_->SetFrameType(frame_type); 534 input_->SetFrameType(frame_type);
540 } 535 }
541 536
542 537 Code* Deoptimizer::FindOptimizedCode(JSFunction* function) {
543 Code* Deoptimizer::FindOptimizedCode(JSFunction* function,
544 Code* optimized_code) {
545 switch (bailout_type_) { 538 switch (bailout_type_) {
546 case Deoptimizer::SOFT: 539 case Deoptimizer::SOFT:
547 case Deoptimizer::EAGER: 540 case Deoptimizer::EAGER:
548 case Deoptimizer::LAZY: { 541 case Deoptimizer::LAZY: {
549 Code* compiled_code = FindDeoptimizingCode(from_); 542 Code* compiled_code = FindDeoptimizingCode(from_);
550 return (compiled_code == NULL) 543 return (compiled_code == NULL)
551 ? static_cast<Code*>(isolate_->FindCodeObject(from_)) 544 ? static_cast<Code*>(isolate_->FindCodeObject(from_))
552 : compiled_code; 545 : compiled_code;
553 } 546 }
554 } 547 }
(...skipping 3451 matching lines...) Expand 10 before | Expand all | Expand 10 after
4006 CHECK(value_info->IsMaterializedObject()); 3999 CHECK(value_info->IsMaterializedObject());
4007 4000
4008 value_info->value_ = 4001 value_info->value_ =
4009 Handle<Object>(previously_materialized_objects->get(i), isolate_); 4002 Handle<Object>(previously_materialized_objects->get(i), isolate_);
4010 } 4003 }
4011 } 4004 }
4012 } 4005 }
4013 4006
4014 } // namespace internal 4007 } // namespace internal
4015 } // namespace v8 4008 } // 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