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

Side by Side Diff: src/frames.cc

Issue 1528913003: [Interpreter] Add basic deoptimization support from TurboFan to Ignition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_deopt_1
Patch Set: Add basic support to OptimizedFrame::Summarize() for interpreted_frame deopt data. Created 5 years 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/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopeinfo.h" 10 #include "src/ast/scopeinfo.h"
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); 940 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next());
941 DCHECK_EQ(Translation::BEGIN, opcode); 941 DCHECK_EQ(Translation::BEGIN, opcode);
942 it.Next(); // Drop frame count. 942 it.Next(); // Drop frame count.
943 int jsframe_count = it.Next(); 943 int jsframe_count = it.Next();
944 944
945 // We create the summary in reverse order because the frames 945 // We create the summary in reverse order because the frames
946 // in the deoptimization translation are ordered bottom-to-top. 946 // in the deoptimization translation are ordered bottom-to-top.
947 bool is_constructor = IsConstructor(); 947 bool is_constructor = IsConstructor();
948 while (jsframe_count != 0) { 948 while (jsframe_count != 0) {
949 opcode = static_cast<Translation::Opcode>(it.Next()); 949 opcode = static_cast<Translation::Opcode>(it.Next());
950 if (opcode == Translation::JS_FRAME) { 950 if (opcode == Translation::JS_FRAME ||
951 opcode == Translation::INTERPRETED_FRAME) {
951 jsframe_count--; 952 jsframe_count--;
952 BailoutId const ast_id = BailoutId(it.Next()); 953 BailoutId const ast_id = BailoutId(it.Next());
953 SharedFunctionInfo* const shared_info = 954 SharedFunctionInfo* const shared_info =
954 SharedFunctionInfo::cast(literal_array->get(it.Next())); 955 SharedFunctionInfo::cast(literal_array->get(it.Next()));
955 it.Next(); // Skip height. 956 it.Next(); // Skip height.
956 957
957 // The translation commands are ordered and the function is always 958 // The translation commands are ordered and the function is always
958 // at the first position, and the receiver is next. 959 // at the first position, and the receiver is next.
959 opcode = static_cast<Translation::Opcode>(it.Next()); 960 opcode = static_cast<Translation::Opcode>(it.Next());
960 961
(...skipping 25 matching lines...) Expand all
986 // The receiver is not in a stack slot nor in a literal. We give up. 987 // The receiver is not in a stack slot nor in a literal. We give up.
987 it.Skip(Translation::NumberOfOperandsFor(opcode)); 988 it.Skip(Translation::NumberOfOperandsFor(opcode));
988 // TODO(3029): Materializing a captured object (or duplicated 989 // TODO(3029): Materializing a captured object (or duplicated
989 // object) is hard, we return undefined for now. This breaks the 990 // object) is hard, we return undefined for now. This breaks the
990 // produced stack trace, as constructor frames aren't marked as 991 // produced stack trace, as constructor frames aren't marked as
991 // such anymore. 992 // such anymore.
992 receiver = isolate()->heap()->undefined_value(); 993 receiver = isolate()->heap()->undefined_value();
993 } 994 }
994 995
995 Code* const code = shared_info->code(); 996 Code* const code = shared_info->code();
996 DeoptimizationOutputData* const output_data =
997 DeoptimizationOutputData::cast(code->deoptimization_data());
998 unsigned const entry =
999 Deoptimizer::GetOutputInfo(output_data, ast_id, shared_info);
1000 unsigned const pc_offset =
1001 FullCodeGenerator::PcField::decode(entry) + Code::kHeaderSize;
1002 DCHECK_NE(0U, pc_offset);
1003 997
998 unsigned pc_offset;
999 if (opcode == Translation::JS_FRAME) {
1000 DeoptimizationOutputData* const output_data =
1001 DeoptimizationOutputData::cast(code->deoptimization_data());
1002 unsigned const entry =
1003 Deoptimizer::GetOutputInfo(output_data, ast_id, shared_info);
1004 pc_offset =
1005 FullCodeGenerator::PcField::decode(entry) + Code::kHeaderSize;
1006 DCHECK_NE(0U, pc_offset);
1007 } else {
1008 // TODO(rmcilroy): Modify FrameSummary to enable us to summarize
1009 // based on the BytecodeArray and bytecode offset.
Jarin 2015/12/17 13:35:09 How about DCHECK_EQ(opcode, Translation::INTERPRET
rmcilroy 2015/12/17 23:49:54 I had this originally, but opcode gets changed in
Jarin 2015/12/18 08:58:21 Thanks (I am actually surprised that your previous
rmcilroy 2015/12/18 15:18:10 Yeah, I think it was broken and must have always h
1010 pc_offset = 0;
1011 }
1004 FrameSummary summary(receiver, function, code, pc_offset, is_constructor); 1012 FrameSummary summary(receiver, function, code, pc_offset, is_constructor);
1005 frames->Add(summary); 1013 frames->Add(summary);
1006 is_constructor = false; 1014 is_constructor = false;
1007 } else if (opcode == Translation::CONSTRUCT_STUB_FRAME) { 1015 } else if (opcode == Translation::CONSTRUCT_STUB_FRAME) {
1008 // The next encountered JS_FRAME will be marked as a constructor call. 1016 // The next encountered JS_FRAME will be marked as a constructor call.
1009 it.Skip(Translation::NumberOfOperandsFor(opcode)); 1017 it.Skip(Translation::NumberOfOperandsFor(opcode));
1010 DCHECK(!is_constructor); 1018 DCHECK(!is_constructor);
1011 is_constructor = true; 1019 is_constructor = true;
1012 } else { 1020 } else {
1013 // Skip over operands to advance to the next opcode. 1021 // Skip over operands to advance to the next opcode.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 DCHECK_EQ(Translation::BEGIN, opcode); 1084 DCHECK_EQ(Translation::BEGIN, opcode);
1077 it.Next(); // Skip frame count. 1085 it.Next(); // Skip frame count.
1078 int jsframe_count = it.Next(); 1086 int jsframe_count = it.Next();
1079 1087
1080 // We insert the frames in reverse order because the frames 1088 // We insert the frames in reverse order because the frames
1081 // in the deoptimization translation are ordered bottom-to-top. 1089 // in the deoptimization translation are ordered bottom-to-top.
1082 while (jsframe_count != 0) { 1090 while (jsframe_count != 0) {
1083 opcode = static_cast<Translation::Opcode>(it.Next()); 1091 opcode = static_cast<Translation::Opcode>(it.Next());
1084 // Skip over operands to advance to the next opcode. 1092 // Skip over operands to advance to the next opcode.
1085 it.Skip(Translation::NumberOfOperandsFor(opcode)); 1093 it.Skip(Translation::NumberOfOperandsFor(opcode));
1086 if (opcode == Translation::JS_FRAME) { 1094 if (opcode == Translation::JS_FRAME) {
Jarin 2015/12/17 13:35:09 I think you also have to handle the interpreter fr
rmcilroy 2015/12/17 23:49:54 Done.
1087 jsframe_count--; 1095 jsframe_count--;
1088 1096
1089 // The translation commands are ordered and the function is always at the 1097 // The translation commands are ordered and the function is always at the
1090 // first position. 1098 // first position.
1091 opcode = static_cast<Translation::Opcode>(it.Next()); 1099 opcode = static_cast<Translation::Opcode>(it.Next());
1092 1100
1093 // Get the correct function in the optimized frame. 1101 // Get the correct function in the optimized frame.
1094 Object* function; 1102 Object* function;
1095 if (opcode == Translation::LITERAL) { 1103 if (opcode == Translation::LITERAL) {
1096 function = literal_array->get(it.Next()); 1104 function = literal_array->get(it.Next());
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1587 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1580 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1588 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1581 list.Add(frame, zone); 1589 list.Add(frame, zone);
1582 } 1590 }
1583 return list.ToVector(); 1591 return list.ToVector();
1584 } 1592 }
1585 1593
1586 1594
1587 } // namespace internal 1595 } // namespace internal
1588 } // namespace v8 1596 } // namespace v8
OLDNEW
« src/deoptimizer.cc ('K') | « src/frames.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698