OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/frames.h" | 5 #include "src/frames.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 1006 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
1007 | 1007 |
1008 SafepointEntry safepoint_entry = code->GetSafepointEntry(pc()); | 1008 SafepointEntry safepoint_entry = code->GetSafepointEntry(pc()); |
1009 *deopt_index = safepoint_entry.deoptimization_index(); | 1009 *deopt_index = safepoint_entry.deoptimization_index(); |
1010 DCHECK(*deopt_index != Safepoint::kNoDeoptimizationIndex); | 1010 DCHECK(*deopt_index != Safepoint::kNoDeoptimizationIndex); |
1011 | 1011 |
1012 return DeoptimizationInputData::cast(code->deoptimization_data()); | 1012 return DeoptimizationInputData::cast(code->deoptimization_data()); |
1013 } | 1013 } |
1014 | 1014 |
1015 | 1015 |
1016 int OptimizedFrame::GetInlineCount() { | |
1017 DCHECK(is_optimized()); | |
1018 | |
1019 // Delegate to JS frame in absence of turbofan deoptimization. | |
1020 // TODO(turbofan): Revisit once we support deoptimization across the board. | |
1021 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() && | |
1022 !FLAG_turbo_asm_deoptimization) { | |
1023 return JavaScriptFrame::GetInlineCount(); | |
1024 } | |
1025 | |
1026 int deopt_index = Safepoint::kNoDeoptimizationIndex; | |
1027 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); | |
1028 | |
1029 TranslationIterator it(data->TranslationByteArray(), | |
1030 data->TranslationIndex(deopt_index)->value()); | |
1031 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | |
1032 DCHECK(opcode == Translation::BEGIN); | |
1033 USE(opcode); | |
1034 it.Next(); // Drop frame count. | |
1035 int jsframe_count = it.Next(); | |
1036 return jsframe_count; | |
1037 } | |
1038 | |
1039 | |
1040 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { | 1016 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { |
1041 DCHECK(functions->length() == 0); | 1017 DCHECK(functions->length() == 0); |
1042 DCHECK(is_optimized()); | 1018 DCHECK(is_optimized()); |
1043 | 1019 |
1044 // Delegate to JS frame in absence of turbofan deoptimization. | 1020 // Delegate to JS frame in absence of turbofan deoptimization. |
1045 // TODO(turbofan): Revisit once we support deoptimization across the board. | 1021 // TODO(turbofan): Revisit once we support deoptimization across the board. |
1046 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() && | 1022 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() && |
1047 !FLAG_turbo_asm_deoptimization) { | 1023 !FLAG_turbo_asm_deoptimization) { |
1048 return JavaScriptFrame::GetFunctions(functions); | 1024 return JavaScriptFrame::GetFunctions(functions); |
1049 } | 1025 } |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1495 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1520 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1496 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1521 list.Add(frame, zone); | 1497 list.Add(frame, zone); |
1522 } | 1498 } |
1523 return list.ToVector(); | 1499 return list.ToVector(); |
1524 } | 1500 } |
1525 | 1501 |
1526 | 1502 |
1527 } // namespace internal | 1503 } // namespace internal |
1528 } // namespace v8 | 1504 } // namespace v8 |
OLD | NEW |