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

Side by Side Diff: src/frames.cc

Issue 9304001: Implement inlining of constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Vyacheslav Egorov. Created 8 years, 10 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
« no previous file with comments | « src/flag-definitions.h ('k') | src/frames-inl.h » ('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 // 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
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 it.Next(); // Drop frame count. 816 it.Next(); // Drop frame count.
817 int jsframe_count = it.Next(); 817 int jsframe_count = it.Next();
818 818
819 // We create the summary in reverse order because the frames 819 // We create the summary in reverse order because the frames
820 // in the deoptimization translation are ordered bottom-to-top. 820 // in the deoptimization translation are ordered bottom-to-top.
821 bool is_constructor = IsConstructor();
821 int i = jsframe_count; 822 int i = jsframe_count;
822 while (i > 0) { 823 while (i > 0) {
823 opcode = static_cast<Translation::Opcode>(it.Next()); 824 opcode = static_cast<Translation::Opcode>(it.Next());
824 if (opcode == Translation::JS_FRAME) { 825 if (opcode == Translation::JS_FRAME) {
825 // We don't inline constructor calls, so only the first, outermost
826 // frame can be a constructor frame in case of inlining.
827 bool is_constructor = (i == jsframe_count) && IsConstructor();
828
829 i--; 826 i--;
830 int ast_id = it.Next(); 827 int ast_id = it.Next();
831 int function_id = it.Next(); 828 int function_id = it.Next();
832 it.Next(); // Skip height. 829 it.Next(); // Skip height.
833 JSFunction* function = 830 JSFunction* function =
834 JSFunction::cast(data->LiteralArray()->get(function_id)); 831 JSFunction::cast(data->LiteralArray()->get(function_id));
835 832
836 // The translation commands are ordered and the receiver is always 833 // The translation commands are ordered and the receiver is always
837 // at the first position. Since we are always at a call when we need 834 // at the first position. Since we are always at a call when we need
838 // to construct a stack trace, the receiver is always in a stack slot. 835 // to construct a stack trace, the receiver is always in a stack slot.
(...skipping 29 matching lines...) Expand all
868 DeoptimizationOutputData::cast(code->deoptimization_data()); 865 DeoptimizationOutputData::cast(code->deoptimization_data());
869 unsigned entry = Deoptimizer::GetOutputInfo(output_data, 866 unsigned entry = Deoptimizer::GetOutputInfo(output_data,
870 ast_id, 867 ast_id,
871 function->shared()); 868 function->shared());
872 unsigned pc_offset = 869 unsigned pc_offset =
873 FullCodeGenerator::PcField::decode(entry) + Code::kHeaderSize; 870 FullCodeGenerator::PcField::decode(entry) + Code::kHeaderSize;
874 ASSERT(pc_offset > 0); 871 ASSERT(pc_offset > 0);
875 872
876 FrameSummary summary(receiver, function, code, pc_offset, is_constructor); 873 FrameSummary summary(receiver, function, code, pc_offset, is_constructor);
877 frames->Add(summary); 874 frames->Add(summary);
875 is_constructor = false;
876 } else if (opcode == Translation::CONSTRUCT_STUB_FRAME) {
877 // The next encountered JS_FRAME will be marked as a constructor call.
878 it.Skip(Translation::NumberOfOperandsFor(opcode));
879 ASSERT(!is_constructor);
880 is_constructor = true;
878 } else { 881 } else {
879 // Skip over operands to advance to the next opcode. 882 // Skip over operands to advance to the next opcode.
880 it.Skip(Translation::NumberOfOperandsFor(opcode)); 883 it.Skip(Translation::NumberOfOperandsFor(opcode));
881 } 884 }
882 } 885 }
886 ASSERT(!is_constructor);
883 } 887 }
884 888
885 889
886 DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData( 890 DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData(
887 int* deopt_index) { 891 int* deopt_index) {
888 ASSERT(is_optimized()); 892 ASSERT(is_optimized());
889 893
890 JSFunction* opt_function = JSFunction::cast(function()); 894 JSFunction* opt_function = JSFunction::cast(function());
891 Code* code = opt_function->code(); 895 Code* code = opt_function->code();
892 896
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 ZoneList<StackFrame*> list(10); 1394 ZoneList<StackFrame*> list(10);
1391 for (StackFrameIterator it; !it.done(); it.Advance()) { 1395 for (StackFrameIterator it; !it.done(); it.Advance()) {
1392 StackFrame* frame = AllocateFrameCopy(it.frame()); 1396 StackFrame* frame = AllocateFrameCopy(it.frame());
1393 list.Add(frame); 1397 list.Add(frame);
1394 } 1398 }
1395 return list.ToVector(); 1399 return list.ToVector();
1396 } 1400 }
1397 1401
1398 1402
1399 } } // namespace v8::internal 1403 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698