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

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: Fix Jaros comment. 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
« no previous file with comments | « src/frames.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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& 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 TranslatedFrame::iterator it = frame.begin();
887
888 // Get the correct function in the optimized frame.
889 JSFunction* function = JSFunction::cast(it->GetRawValue());
890 it++;
897 891
898 // Get the correct receiver in the optimized frame. 892 // Get the correct receiver in the optimized frame.
899 Object* receiver = frame.front().GetRawValue(); 893 Object* receiver = it->GetRawValue();
900 if (receiver == isolate()->heap()->arguments_marker()) { 894 if (receiver == isolate()->heap()->arguments_marker()) {
901 // TODO(jarin): Materializing a captured object (or duplicated 895 // TODO(jarin): Materializing a captured object (or duplicated
902 // object) is hard, we return undefined for now. This breaks the 896 // object) is hard, we return undefined for now. This breaks the
903 // produced stack trace, as constructor frames aren't marked as 897 // produced stack trace, as constructor frames aren't marked as
904 // such anymore. 898 // such anymore.
905 receiver = isolate()->heap()->undefined_value(); 899 receiver = isolate()->heap()->undefined_value();
906 } 900 }
907 901
908 Code* code = function->shared()->code(); 902 Code* code = function->shared()->code();
909 DeoptimizationOutputData* output_data = 903 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. 979 // TODO(turbofan): Revisit once we support deoptimization across the board.
986 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() && 980 if (LookupCode()->is_turbofanned() && function()->shared()->asm_function() &&
987 !FLAG_turbo_asm_deoptimization) { 981 !FLAG_turbo_asm_deoptimization) {
988 return JavaScriptFrame::GetFunctions(functions); 982 return JavaScriptFrame::GetFunctions(functions);
989 } 983 }
990 984
991 DisallowHeapAllocation no_gc; 985 DisallowHeapAllocation no_gc;
992 TranslatedState state(this); 986 TranslatedState state(this);
993 for (TranslatedFrame const& frame : state) { 987 for (TranslatedFrame const& frame : state) {
994 if (frame.kind() == TranslatedFrame::kFunction) { 988 if (frame.kind() == TranslatedFrame::kFunction) {
995 functions->Add(frame.raw_function()); 989 functions->Add(JSFunction::cast(frame.front().GetRawValue()));
996 } 990 }
997 } 991 }
998 } 992 }
999 993
1000 994
1001 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { 995 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
1002 return Smi::cast(GetExpression(0))->value(); 996 return Smi::cast(GetExpression(0))->value();
1003 } 997 }
1004 998
1005 999
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1434 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1441 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1435 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1442 list.Add(frame, zone); 1436 list.Add(frame, zone);
1443 } 1437 }
1444 return list.ToVector(); 1438 return list.ToVector();
1445 } 1439 }
1446 1440
1447 1441
1448 } // namespace internal 1442 } // namespace internal
1449 } // namespace v8 1443 } // namespace v8
OLDNEW
« no previous file with comments | « 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