| 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 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3643 DCHECK(deopt_reason < kLastDeoptReason); | 3643 DCHECK(deopt_reason < kLastDeoptReason); |
| 3644 #define DEOPT_MESSAGES_TEXTS(C, T) T, | 3644 #define DEOPT_MESSAGES_TEXTS(C, T) T, |
| 3645 static const char* deopt_messages_[] = { | 3645 static const char* deopt_messages_[] = { |
| 3646 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)}; | 3646 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)}; |
| 3647 #undef DEOPT_MESSAGES_TEXTS | 3647 #undef DEOPT_MESSAGES_TEXTS |
| 3648 return deopt_messages_[deopt_reason]; | 3648 return deopt_messages_[deopt_reason]; |
| 3649 } | 3649 } |
| 3650 | 3650 |
| 3651 | 3651 |
| 3652 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, int bailout_id) { | 3652 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, int bailout_id) { |
| 3653 int last_position = 0; | 3653 SourcePosition last_position = SourcePosition::Unknown(); |
| 3654 Isolate* isolate = code->GetIsolate(); | 3654 Isolate* isolate = code->GetIsolate(); |
| 3655 Deoptimizer::DeoptReason last_reason = Deoptimizer::kNoReason; | 3655 Deoptimizer::DeoptReason last_reason = Deoptimizer::kNoReason; |
| 3656 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) | | 3656 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) | |
| 3657 RelocInfo::ModeMask(RelocInfo::POSITION) | | 3657 RelocInfo::ModeMask(RelocInfo::POSITION) | |
| 3658 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 3658 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 3659 for (RelocIterator it(code, mask); !it.done(); it.next()) { | 3659 for (RelocIterator it(code, mask); !it.done(); it.next()) { |
| 3660 RelocInfo* info = it.rinfo(); | 3660 RelocInfo* info = it.rinfo(); |
| 3661 if (info->rmode() == RelocInfo::POSITION) { | 3661 if (info->rmode() == RelocInfo::POSITION) { |
| 3662 last_position = static_cast<int>(info->data()); | 3662 int raw_position = static_cast<int>(info->data()); |
| 3663 last_position = raw_position ? SourcePosition::FromRaw(raw_position) |
| 3664 : SourcePosition::Unknown(); |
| 3663 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { | 3665 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { |
| 3664 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); | 3666 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); |
| 3665 } else if (last_reason != Deoptimizer::kNoReason) { | 3667 } else if (last_reason != Deoptimizer::kNoReason) { |
| 3666 if ((bailout_id == | 3668 if ((bailout_id == |
| 3667 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), | 3669 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), |
| 3668 Deoptimizer::EAGER)) || | 3670 Deoptimizer::EAGER)) || |
| 3669 (bailout_id == | 3671 (bailout_id == |
| 3670 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), | 3672 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), |
| 3671 Deoptimizer::SOFT)) || | 3673 Deoptimizer::SOFT)) || |
| 3672 (bailout_id == | 3674 (bailout_id == |
| 3673 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), | 3675 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), |
| 3674 Deoptimizer::LAZY))) { | 3676 Deoptimizer::LAZY))) { |
| 3675 CHECK(RelocInfo::IsRuntimeEntry(info->rmode())); | 3677 CHECK(RelocInfo::IsRuntimeEntry(info->rmode())); |
| 3676 return DeoptInfo(last_position, NULL, last_reason); | 3678 return DeoptInfo(last_position, NULL, last_reason); |
| 3677 } | 3679 } |
| 3678 } | 3680 } |
| 3679 } | 3681 } |
| 3680 return DeoptInfo(0, NULL, Deoptimizer::kNoReason); | 3682 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); |
| 3681 } | 3683 } |
| 3682 } } // namespace v8::internal | 3684 } } // namespace v8::internal |
| OLD | NEW |