Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: src/frames.cc

Issue 1169103004: [deoptimizer] Basic support inlining based on SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 PrintF("\nfunction: "); 856 PrintF("\nfunction: ");
857 function_->shared()->DebugName()->ShortPrint(); 857 function_->shared()->DebugName()->ShortPrint();
858 PrintF("\ncode: "); 858 PrintF("\ncode: ");
859 code_->ShortPrint(); 859 code_->ShortPrint();
860 if (code_->kind() == Code::FUNCTION) PrintF(" NON-OPT"); 860 if (code_->kind() == Code::FUNCTION) PrintF(" NON-OPT");
861 if (code_->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT"); 861 if (code_->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT");
862 PrintF("\npc: %d\n", offset_); 862 PrintF("\npc: %d\n", offset_);
863 } 863 }
864 864
865 865
866 JSFunction* OptimizedFrame::LiteralAt(FixedArray* literal_array,
867 int literal_id) {
868 if (literal_id == Translation::kSelfLiteralId) {
869 return function();
870 }
871
872 return JSFunction::cast(literal_array->get(literal_id));
873 }
874
875
876 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { 866 void OptimizedFrame::Summarize(List<FrameSummary>* frames) {
877 DCHECK(frames->length() == 0); 867 DCHECK(frames->length() == 0);
878 DCHECK(is_optimized()); 868 DCHECK(is_optimized());
879 869
880 // Delegate to JS frame in absence of turbofan deoptimization. 870 // Delegate to JS frame in absence of turbofan deoptimization.
881 // TODO(turbofan): Revisit once we support deoptimization across the board. 871 // TODO(turbofan): Revisit once we support deoptimization across the board.
882 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() && 872 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() &&
883 !FLAG_turbo_asm_deoptimization) { 873 !FLAG_turbo_asm_deoptimization) {
884 return JavaScriptFrame::Summarize(frames); 874 return JavaScriptFrame::Summarize(frames);
885 } 875 }
886 876
887 // We create the summary in reverse order because the frames 877 // We create the summary in reverse order because the frames
888 // in the deoptimization translation are ordered bottom-to-top. 878 // in the deoptimization translation are ordered bottom-to-top.
889 DisallowHeapAllocation no_gc; 879 DisallowHeapAllocation no_gc;
890 TranslatedState state(this); 880 TranslatedState state(this);
891 bool is_constructor = IsConstructor(); 881 bool is_constructor = IsConstructor();
892 for (TranslatedFrame const& frame : state) { 882 for (TranslatedFrame const& frame : state) {
893 switch (frame.kind()) { 883 switch (frame.kind()) {
894 case TranslatedFrame::kFunction: { 884 case TranslatedFrame::kFunction: {
895 BailoutId const ast_id = frame.node_id(); 885 BailoutId const ast_id = frame.node_id();
896 JSFunction* const function = frame.raw_function(); 886
887 // Get the correct function in the optimized frame.
888 JSFunction* function = JSFunction::cast(frame[0].GetRawValue());
897 889
898 // Get the correct receiver in the optimized frame. 890 // Get the correct receiver in the optimized frame.
899 Object* receiver = frame.front().GetRawValue(); 891 Object* receiver = frame[1].GetRawValue();
900 if (receiver == isolate()->heap()->arguments_marker()) { 892 if (receiver == isolate()->heap()->arguments_marker()) {
901 // TODO(jarin): Materializing a captured object (or duplicated 893 // TODO(jarin): Materializing a captured object (or duplicated
902 // object) is hard, we return undefined for now. This breaks the 894 // object) is hard, we return undefined for now. This breaks the
903 // produced stack trace, as constructor frames aren't marked as 895 // produced stack trace, as constructor frames aren't marked as
904 // such anymore. 896 // such anymore.
905 receiver = isolate()->heap()->undefined_value(); 897 receiver = isolate()->heap()->undefined_value();
906 } 898 }
907 899
908 Code* code = function->shared()->code(); 900 Code* code = function->shared()->code();
909 DeoptimizationOutputData* output_data = 901 DeoptimizationOutputData* output_data =
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 // TODO(turbofan): Revisit once we support deoptimization across the board. 977 // TODO(turbofan): Revisit once we support deoptimization across the board.
986 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() && 978 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() &&
987 !FLAG_turbo_asm_deoptimization) { 979 !FLAG_turbo_asm_deoptimization) {
988 return JavaScriptFrame::GetFunctions(functions); 980 return JavaScriptFrame::GetFunctions(functions);
989 } 981 }
990 982
991 DisallowHeapAllocation no_gc; 983 DisallowHeapAllocation no_gc;
992 TranslatedState state(this); 984 TranslatedState state(this);
993 for (TranslatedFrame const& frame : state) { 985 for (TranslatedFrame const& frame : state) {
994 if (frame.kind() == TranslatedFrame::kFunction) { 986 if (frame.kind() == TranslatedFrame::kFunction) {
995 functions->Add(frame.raw_function()); 987 functions->Add(JSFunction::cast(frame[0].GetRawValue()));
996 } 988 }
997 } 989 }
998 } 990 }
999 991
1000 992
1001 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { 993 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
1002 return Smi::cast(GetExpression(0))->value(); 994 return Smi::cast(GetExpression(0))->value();
1003 } 995 }
1004 996
1005 997
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1432 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1441 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1433 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1442 list.Add(frame, zone); 1434 list.Add(frame, zone);
1443 } 1435 }
1444 return list.ToVector(); 1436 return list.ToVector();
1445 } 1437 }
1446 1438
1447 1439
1448 } // namespace internal 1440 } // namespace internal
1449 } // namespace v8 1441 } // namespace v8
OLDNEW
« src/deoptimizer.h ('K') | « src/frames.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698