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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 } | 925 } |
926 | 926 |
927 return JSFunction::cast(literal_array->get(literal_id)); | 927 return JSFunction::cast(literal_array->get(literal_id)); |
928 } | 928 } |
929 | 929 |
930 | 930 |
931 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { | 931 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { |
932 DCHECK(frames->length() == 0); | 932 DCHECK(frames->length() == 0); |
933 DCHECK(is_optimized()); | 933 DCHECK(is_optimized()); |
934 | 934 |
935 // Delegate to JS frame in absence of turbofan deoptimization. | 935 // Delegate to JS frame in absence of inlining. |
936 // TODO(turbofan): Revisit once we support deoptimization across the board. | 936 // TODO(turbofan): Revisit once we support inlining. |
937 if (LookupCode()->is_turbofanned() && !FLAG_turbo_deoptimization) { | 937 if (LookupCode()->is_turbofanned()) { |
938 return JavaScriptFrame::Summarize(frames); | 938 return JavaScriptFrame::Summarize(frames); |
939 } | 939 } |
940 | 940 |
941 int deopt_index = Safepoint::kNoDeoptimizationIndex; | 941 int deopt_index = Safepoint::kNoDeoptimizationIndex; |
942 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); | 942 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); |
943 FixedArray* literal_array = data->LiteralArray(); | 943 FixedArray* literal_array = data->LiteralArray(); |
944 | 944 |
945 // BUG(3243555): Since we don't have a lazy-deopt registered at | 945 // BUG(3243555): Since we don't have a lazy-deopt registered at |
946 // throw-statements, we can't use the translation at the call-site of | 946 // throw-statements, we can't use the translation at the call-site of |
947 // throw. An entry with no deoptimization index indicates a call-site | 947 // throw. An entry with no deoptimization index indicates a call-site |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 *deopt_index = safepoint_entry.deoptimization_index(); | 1052 *deopt_index = safepoint_entry.deoptimization_index(); |
1053 DCHECK(*deopt_index != Safepoint::kNoDeoptimizationIndex); | 1053 DCHECK(*deopt_index != Safepoint::kNoDeoptimizationIndex); |
1054 | 1054 |
1055 return DeoptimizationInputData::cast(code->deoptimization_data()); | 1055 return DeoptimizationInputData::cast(code->deoptimization_data()); |
1056 } | 1056 } |
1057 | 1057 |
1058 | 1058 |
1059 int OptimizedFrame::GetInlineCount() { | 1059 int OptimizedFrame::GetInlineCount() { |
1060 DCHECK(is_optimized()); | 1060 DCHECK(is_optimized()); |
1061 | 1061 |
1062 // Delegate to JS frame in absence of turbofan deoptimization. | 1062 // Delegate to JS frame in absence of inlining. |
1063 // TODO(turbofan): Revisit once we support deoptimization across the board. | 1063 // TODO(turbofan): Revisit once we support inlining. |
1064 if (LookupCode()->is_turbofanned() && !FLAG_turbo_deoptimization) { | 1064 if (LookupCode()->is_turbofanned()) { |
1065 return JavaScriptFrame::GetInlineCount(); | 1065 return JavaScriptFrame::GetInlineCount(); |
1066 } | 1066 } |
1067 | 1067 |
1068 int deopt_index = Safepoint::kNoDeoptimizationIndex; | 1068 int deopt_index = Safepoint::kNoDeoptimizationIndex; |
1069 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); | 1069 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); |
1070 | 1070 |
1071 TranslationIterator it(data->TranslationByteArray(), | 1071 TranslationIterator it(data->TranslationByteArray(), |
1072 data->TranslationIndex(deopt_index)->value()); | 1072 data->TranslationIndex(deopt_index)->value()); |
1073 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 1073 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
1074 DCHECK(opcode == Translation::BEGIN); | 1074 DCHECK(opcode == Translation::BEGIN); |
1075 USE(opcode); | 1075 USE(opcode); |
1076 it.Next(); // Drop frame count. | 1076 it.Next(); // Drop frame count. |
1077 int jsframe_count = it.Next(); | 1077 int jsframe_count = it.Next(); |
1078 return jsframe_count; | 1078 return jsframe_count; |
1079 } | 1079 } |
1080 | 1080 |
1081 | 1081 |
1082 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { | 1082 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { |
1083 DCHECK(functions->length() == 0); | 1083 DCHECK(functions->length() == 0); |
1084 DCHECK(is_optimized()); | 1084 DCHECK(is_optimized()); |
1085 | 1085 |
1086 // Delegate to JS frame in absence of turbofan deoptimization. | 1086 // Delegate to JS frame in absence of inlining. |
1087 // TODO(turbofan): Revisit once we support deoptimization across the board. | 1087 // TODO(turbofan): Revisit once we support inlining. |
1088 if (LookupCode()->is_turbofanned() && !FLAG_turbo_deoptimization) { | 1088 if (LookupCode()->is_turbofanned()) { |
1089 return JavaScriptFrame::GetFunctions(functions); | 1089 return JavaScriptFrame::GetFunctions(functions); |
1090 } | 1090 } |
1091 | 1091 |
1092 int deopt_index = Safepoint::kNoDeoptimizationIndex; | 1092 int deopt_index = Safepoint::kNoDeoptimizationIndex; |
1093 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); | 1093 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); |
1094 FixedArray* literal_array = data->LiteralArray(); | 1094 FixedArray* literal_array = data->LiteralArray(); |
1095 | 1095 |
1096 TranslationIterator it(data->TranslationByteArray(), | 1096 TranslationIterator it(data->TranslationByteArray(), |
1097 data->TranslationIndex(deopt_index)->value()); | 1097 data->TranslationIndex(deopt_index)->value()); |
1098 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 1098 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 ZoneList<StackFrame*> list(10, zone); | 1635 ZoneList<StackFrame*> list(10, zone); |
1636 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1636 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1637 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1637 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1638 list.Add(frame, zone); | 1638 list.Add(frame, zone); |
1639 } | 1639 } |
1640 return list.ToVector(); | 1640 return list.ToVector(); |
1641 } | 1641 } |
1642 | 1642 |
1643 | 1643 |
1644 } } // namespace v8::internal | 1644 } } // namespace v8::internal |
OLD | NEW |