| 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/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
| 9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
| 10 #include "src/full-codegen.h" | 10 #include "src/full-codegen.h" |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 } | 924 } |
| 925 | 925 |
| 926 return JSFunction::cast(literal_array->get(literal_id)); | 926 return JSFunction::cast(literal_array->get(literal_id)); |
| 927 } | 927 } |
| 928 | 928 |
| 929 | 929 |
| 930 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { | 930 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { |
| 931 ASSERT(frames->length() == 0); | 931 ASSERT(frames->length() == 0); |
| 932 ASSERT(is_optimized()); | 932 ASSERT(is_optimized()); |
| 933 | 933 |
| 934 // Delegate to JS frame in absence of inlining. |
| 935 // TODO(turbofan): Revisit once we support inlining. |
| 936 if (LookupCode()->is_turbofanned()) { |
| 937 return JavaScriptFrame::Summarize(frames); |
| 938 } |
| 939 |
| 934 int deopt_index = Safepoint::kNoDeoptimizationIndex; | 940 int deopt_index = Safepoint::kNoDeoptimizationIndex; |
| 935 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); | 941 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); |
| 936 FixedArray* literal_array = data->LiteralArray(); | 942 FixedArray* literal_array = data->LiteralArray(); |
| 937 | 943 |
| 938 // BUG(3243555): Since we don't have a lazy-deopt registered at | 944 // BUG(3243555): Since we don't have a lazy-deopt registered at |
| 939 // throw-statements, we can't use the translation at the call-site of | 945 // throw-statements, we can't use the translation at the call-site of |
| 940 // throw. An entry with no deoptimization index indicates a call-site | 946 // throw. An entry with no deoptimization index indicates a call-site |
| 941 // without a lazy-deopt. As a consequence we are not allowed to inline | 947 // without a lazy-deopt. As a consequence we are not allowed to inline |
| 942 // functions containing throw. | 948 // functions containing throw. |
| 943 if (deopt_index == Safepoint::kNoDeoptimizationIndex) { | 949 ASSERT(deopt_index != Safepoint::kNoDeoptimizationIndex); |
| 944 JavaScriptFrame::Summarize(frames); | |
| 945 return; | |
| 946 } | |
| 947 | 950 |
| 948 TranslationIterator it(data->TranslationByteArray(), | 951 TranslationIterator it(data->TranslationByteArray(), |
| 949 data->TranslationIndex(deopt_index)->value()); | 952 data->TranslationIndex(deopt_index)->value()); |
| 950 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 953 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
| 951 ASSERT(opcode == Translation::BEGIN); | 954 ASSERT(opcode == Translation::BEGIN); |
| 952 it.Next(); // Drop frame count. | 955 it.Next(); // Drop frame count. |
| 953 int jsframe_count = it.Next(); | 956 int jsframe_count = it.Next(); |
| 954 | 957 |
| 955 // We create the summary in reverse order because the frames | 958 // We create the summary in reverse order because the frames |
| 956 // in the deoptimization translation are ordered bottom-to-top. | 959 // in the deoptimization translation are ordered bottom-to-top. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 *deopt_index = safepoint_entry.deoptimization_index(); | 1051 *deopt_index = safepoint_entry.deoptimization_index(); |
| 1049 ASSERT(*deopt_index != Safepoint::kNoDeoptimizationIndex); | 1052 ASSERT(*deopt_index != Safepoint::kNoDeoptimizationIndex); |
| 1050 | 1053 |
| 1051 return DeoptimizationInputData::cast(code->deoptimization_data()); | 1054 return DeoptimizationInputData::cast(code->deoptimization_data()); |
| 1052 } | 1055 } |
| 1053 | 1056 |
| 1054 | 1057 |
| 1055 int OptimizedFrame::GetInlineCount() { | 1058 int OptimizedFrame::GetInlineCount() { |
| 1056 ASSERT(is_optimized()); | 1059 ASSERT(is_optimized()); |
| 1057 | 1060 |
| 1061 // Delegate to JS frame in absence of inlining. |
| 1062 // TODO(turbofan): Revisit once we support inlining. |
| 1063 if (LookupCode()->is_turbofanned()) { |
| 1064 return JavaScriptFrame::GetInlineCount(); |
| 1065 } |
| 1066 |
| 1058 int deopt_index = Safepoint::kNoDeoptimizationIndex; | 1067 int deopt_index = Safepoint::kNoDeoptimizationIndex; |
| 1059 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); | 1068 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); |
| 1060 | 1069 |
| 1061 TranslationIterator it(data->TranslationByteArray(), | 1070 TranslationIterator it(data->TranslationByteArray(), |
| 1062 data->TranslationIndex(deopt_index)->value()); | 1071 data->TranslationIndex(deopt_index)->value()); |
| 1063 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 1072 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
| 1064 ASSERT(opcode == Translation::BEGIN); | 1073 ASSERT(opcode == Translation::BEGIN); |
| 1065 USE(opcode); | 1074 USE(opcode); |
| 1066 it.Next(); // Drop frame count. | 1075 it.Next(); // Drop frame count. |
| 1067 int jsframe_count = it.Next(); | 1076 int jsframe_count = it.Next(); |
| 1068 return jsframe_count; | 1077 return jsframe_count; |
| 1069 } | 1078 } |
| 1070 | 1079 |
| 1071 | 1080 |
| 1072 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { | 1081 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { |
| 1073 ASSERT(functions->length() == 0); | 1082 ASSERT(functions->length() == 0); |
| 1074 ASSERT(is_optimized()); | 1083 ASSERT(is_optimized()); |
| 1075 | 1084 |
| 1085 // Delegate to JS frame in absence of inlining. |
| 1086 // TODO(turbofan): Revisit once we support inlining. |
| 1087 if (LookupCode()->is_turbofanned()) { |
| 1088 return JavaScriptFrame::GetFunctions(functions); |
| 1089 } |
| 1090 |
| 1076 int deopt_index = Safepoint::kNoDeoptimizationIndex; | 1091 int deopt_index = Safepoint::kNoDeoptimizationIndex; |
| 1077 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); | 1092 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); |
| 1078 FixedArray* literal_array = data->LiteralArray(); | 1093 FixedArray* literal_array = data->LiteralArray(); |
| 1079 | 1094 |
| 1080 TranslationIterator it(data->TranslationByteArray(), | 1095 TranslationIterator it(data->TranslationByteArray(), |
| 1081 data->TranslationIndex(deopt_index)->value()); | 1096 data->TranslationIndex(deopt_index)->value()); |
| 1082 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 1097 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
| 1083 ASSERT(opcode == Translation::BEGIN); | 1098 ASSERT(opcode == Translation::BEGIN); |
| 1084 it.Next(); // Drop frame count. | 1099 it.Next(); // Drop frame count. |
| 1085 int jsframe_count = it.Next(); | 1100 int jsframe_count = it.Next(); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 ZoneList<StackFrame*> list(10, zone); | 1636 ZoneList<StackFrame*> list(10, zone); |
| 1622 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1637 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1623 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1638 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1624 list.Add(frame, zone); | 1639 list.Add(frame, zone); |
| 1625 } | 1640 } |
| 1626 return list.ToVector(); | 1641 return list.ToVector(); |
| 1627 } | 1642 } |
| 1628 | 1643 |
| 1629 | 1644 |
| 1630 } } // namespace v8::internal | 1645 } } // namespace v8::internal |
| OLD | NEW |