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/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/assembler-inl.h" | 10 #include "src/assembler-inl.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 const char* Deoptimizer::MessageFor(BailoutType type) { | 438 const char* Deoptimizer::MessageFor(BailoutType type) { |
439 switch (type) { | 439 switch (type) { |
440 case EAGER: return "eager"; | 440 case EAGER: return "eager"; |
441 case SOFT: return "soft"; | 441 case SOFT: return "soft"; |
442 case LAZY: return "lazy"; | 442 case LAZY: return "lazy"; |
443 } | 443 } |
444 FATAL("Unsupported deopt type"); | 444 FATAL("Unsupported deopt type"); |
445 return NULL; | 445 return NULL; |
446 } | 446 } |
447 | 447 |
| 448 namespace { |
| 449 |
| 450 CodeEventListener::DeoptKind DeoptKindOfBailoutType( |
| 451 Deoptimizer::BailoutType bailout_type) { |
| 452 switch (bailout_type) { |
| 453 case Deoptimizer::EAGER: |
| 454 return CodeEventListener::kEager; |
| 455 case Deoptimizer::SOFT: |
| 456 return CodeEventListener::kSoft; |
| 457 case Deoptimizer::LAZY: |
| 458 return CodeEventListener::kLazy; |
| 459 } |
| 460 UNREACHABLE(); |
| 461 return CodeEventListener::kEager; |
| 462 } |
| 463 |
| 464 } // namespace |
| 465 |
448 Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function, | 466 Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function, |
449 BailoutType type, unsigned bailout_id, Address from, | 467 BailoutType type, unsigned bailout_id, Address from, |
450 int fp_to_sp_delta) | 468 int fp_to_sp_delta) |
451 : isolate_(isolate), | 469 : isolate_(isolate), |
452 function_(function), | 470 function_(function), |
453 bailout_id_(bailout_id), | 471 bailout_id_(bailout_id), |
454 bailout_type_(type), | 472 bailout_type_(type), |
455 from_(from), | 473 from_(from), |
456 fp_to_sp_delta_(fp_to_sp_delta), | 474 fp_to_sp_delta_(fp_to_sp_delta), |
457 deoptimizing_throw_(false), | 475 deoptimizing_throw_(false), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 ? StackFrame::STUB | 520 ? StackFrame::STUB |
503 : StackFrame::JAVA_SCRIPT; | 521 : StackFrame::JAVA_SCRIPT; |
504 trace_scope_ = TraceEnabledFor(frame_type) | 522 trace_scope_ = TraceEnabledFor(frame_type) |
505 ? new CodeTracer::Scope(isolate->GetCodeTracer()) | 523 ? new CodeTracer::Scope(isolate->GetCodeTracer()) |
506 : NULL; | 524 : NULL; |
507 #ifdef DEBUG | 525 #ifdef DEBUG |
508 CHECK(AllowHeapAllocation::IsAllowed()); | 526 CHECK(AllowHeapAllocation::IsAllowed()); |
509 disallow_heap_allocation_ = new DisallowHeapAllocation(); | 527 disallow_heap_allocation_ = new DisallowHeapAllocation(); |
510 #endif // DEBUG | 528 #endif // DEBUG |
511 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { | 529 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { |
512 PROFILE(isolate_, CodeDeoptEvent(compiled_code_, from_, fp_to_sp_delta_)); | 530 PROFILE(isolate_, |
| 531 CodeDeoptEvent(compiled_code_, DeoptKindOfBailoutType(type), from_, |
| 532 fp_to_sp_delta_)); |
513 } | 533 } |
514 unsigned size = ComputeInputFrameSize(); | 534 unsigned size = ComputeInputFrameSize(); |
515 int parameter_count = | 535 int parameter_count = |
516 function == nullptr | 536 function == nullptr |
517 ? 0 | 537 ? 0 |
518 : (function->shared()->internal_formal_parameter_count() + 1); | 538 : (function->shared()->internal_formal_parameter_count() + 1); |
519 input_ = new (size) FrameDescription(size, parameter_count); | 539 input_ = new (size) FrameDescription(size, parameter_count); |
520 input_->SetFrameType(frame_type); | 540 input_->SetFrameType(frame_type); |
521 } | 541 } |
522 | 542 |
(...skipping 3901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4424 CHECK(value_info->IsMaterializedObject()); | 4444 CHECK(value_info->IsMaterializedObject()); |
4425 | 4445 |
4426 value_info->value_ = | 4446 value_info->value_ = |
4427 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 4447 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
4428 } | 4448 } |
4429 } | 4449 } |
4430 } | 4450 } |
4431 | 4451 |
4432 } // namespace internal | 4452 } // namespace internal |
4433 } // namespace v8 | 4453 } // namespace v8 |
OLD | NEW |