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

Side by Side Diff: src/frames.cc

Issue 9265004: Support inlining at call-sites with mismatched number of arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: finished implementation, extended tests, ported to x64&arm Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 // functions containing throw. 806 // functions containing throw.
807 if (deopt_index == Safepoint::kNoDeoptimizationIndex) { 807 if (deopt_index == Safepoint::kNoDeoptimizationIndex) {
808 JavaScriptFrame::Summarize(frames); 808 JavaScriptFrame::Summarize(frames);
809 return; 809 return;
810 } 810 }
811 811
812 TranslationIterator it(data->TranslationByteArray(), 812 TranslationIterator it(data->TranslationByteArray(),
813 data->TranslationIndex(deopt_index)->value()); 813 data->TranslationIndex(deopt_index)->value());
814 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); 814 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next());
815 ASSERT(opcode == Translation::BEGIN); 815 ASSERT(opcode == Translation::BEGIN);
816 int frame_count = it.Next(); 816 it.Next(); // Drop frame count.
817 int jsframe_count = it.Next();
817 818
818 // We create the summary in reverse order because the frames 819 // We create the summary in reverse order because the frames
819 // in the deoptimization translation are ordered bottom-to-top. 820 // in the deoptimization translation are ordered bottom-to-top.
820 int i = frame_count; 821 int i = jsframe_count;
821 while (i > 0) { 822 while (i > 0) {
822 opcode = static_cast<Translation::Opcode>(it.Next()); 823 opcode = static_cast<Translation::Opcode>(it.Next());
823 if (opcode == Translation::FRAME) { 824 if (opcode == Translation::JS_FRAME) {
824 // We don't inline constructor calls, so only the first, outermost 825 // We don't inline constructor calls, so only the first, outermost
825 // frame can be a constructor frame in case of inlining. 826 // frame can be a constructor frame in case of inlining.
826 bool is_constructor = (i == frame_count) && IsConstructor(); 827 bool is_constructor = (i == jsframe_count) && IsConstructor();
827 828
828 i--; 829 i--;
829 int ast_id = it.Next(); 830 int ast_id = it.Next();
830 int function_id = it.Next(); 831 int function_id = it.Next();
831 it.Next(); // Skip height. 832 it.Next(); // Skip height.
832 JSFunction* function = 833 JSFunction* function =
833 JSFunction::cast(data->LiteralArray()->get(function_id)); 834 JSFunction::cast(data->LiteralArray()->get(function_id));
834 835
835 // The translation commands are ordered and the receiver is always 836 // The translation commands are ordered and the receiver is always
836 // at the first position. Since we are always at a call when we need 837 // at the first position. Since we are always at a call when we need
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 ASSERT(is_optimized()); 912 ASSERT(is_optimized());
912 913
913 int deopt_index = Safepoint::kNoDeoptimizationIndex; 914 int deopt_index = Safepoint::kNoDeoptimizationIndex;
914 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); 915 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index);
915 916
916 TranslationIterator it(data->TranslationByteArray(), 917 TranslationIterator it(data->TranslationByteArray(),
917 data->TranslationIndex(deopt_index)->value()); 918 data->TranslationIndex(deopt_index)->value());
918 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); 919 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next());
919 ASSERT(opcode == Translation::BEGIN); 920 ASSERT(opcode == Translation::BEGIN);
920 USE(opcode); 921 USE(opcode);
921 int frame_count = it.Next(); 922 it.Next(); // Drop frame count.
922 return frame_count; 923 int jsframe_count = it.Next();
924 return jsframe_count;
923 } 925 }
924 926
925 927
926 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { 928 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) {
927 ASSERT(functions->length() == 0); 929 ASSERT(functions->length() == 0);
928 ASSERT(is_optimized()); 930 ASSERT(is_optimized());
929 931
930 int deopt_index = Safepoint::kNoDeoptimizationIndex; 932 int deopt_index = Safepoint::kNoDeoptimizationIndex;
931 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); 933 DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index);
932 934
933 TranslationIterator it(data->TranslationByteArray(), 935 TranslationIterator it(data->TranslationByteArray(),
934 data->TranslationIndex(deopt_index)->value()); 936 data->TranslationIndex(deopt_index)->value());
935 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); 937 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next());
936 ASSERT(opcode == Translation::BEGIN); 938 ASSERT(opcode == Translation::BEGIN);
937 int frame_count = it.Next(); 939 it.Next(); // Drop frame count.
940 int jsframe_count = it.Next();
938 941
939 // We insert the frames in reverse order because the frames 942 // We insert the frames in reverse order because the frames
940 // in the deoptimization translation are ordered bottom-to-top. 943 // in the deoptimization translation are ordered bottom-to-top.
941 while (frame_count > 0) { 944 while (jsframe_count > 0) {
942 opcode = static_cast<Translation::Opcode>(it.Next()); 945 opcode = static_cast<Translation::Opcode>(it.Next());
943 if (opcode == Translation::FRAME) { 946 if (opcode == Translation::JS_FRAME) {
944 frame_count--; 947 jsframe_count--;
945 it.Next(); // Skip ast id. 948 it.Next(); // Skip ast id.
946 int function_id = it.Next(); 949 int function_id = it.Next();
947 it.Next(); // Skip height. 950 it.Next(); // Skip height.
948 JSFunction* function = 951 JSFunction* function =
949 JSFunction::cast(data->LiteralArray()->get(function_id)); 952 JSFunction::cast(data->LiteralArray()->get(function_id));
950 functions->Add(function); 953 functions->Add(function);
951 } else { 954 } else {
952 // Skip over operands to advance to the next opcode. 955 // Skip over operands to advance to the next opcode.
953 it.Skip(Translation::NumberOfOperandsFor(opcode)); 956 it.Skip(Translation::NumberOfOperandsFor(opcode));
954 } 957 }
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 ZoneList<StackFrame*> list(10); 1390 ZoneList<StackFrame*> list(10);
1388 for (StackFrameIterator it; !it.done(); it.Advance()) { 1391 for (StackFrameIterator it; !it.done(); it.Advance()) {
1389 StackFrame* frame = AllocateFrameCopy(it.frame()); 1392 StackFrame* frame = AllocateFrameCopy(it.frame());
1390 list.Add(frame); 1393 list.Add(frame);
1391 } 1394 }
1392 return list.ToVector(); 1395 return list.ToVector();
1393 } 1396 }
1394 1397
1395 1398
1396 } } // namespace v8::internal 1399 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698