OLD | NEW |
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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 int jsframe_count = it.Next(); | 948 int jsframe_count = it.Next(); |
949 | 949 |
950 // We create the summary in reverse order because the frames | 950 // We create the summary in reverse order because the frames |
951 // in the deoptimization translation are ordered bottom-to-top. | 951 // in the deoptimization translation are ordered bottom-to-top. |
952 bool is_constructor = IsConstructor(); | 952 bool is_constructor = IsConstructor(); |
953 while (jsframe_count != 0) { | 953 while (jsframe_count != 0) { |
954 frame_opcode = static_cast<Translation::Opcode>(it.Next()); | 954 frame_opcode = static_cast<Translation::Opcode>(it.Next()); |
955 if (frame_opcode == Translation::JS_FRAME || | 955 if (frame_opcode == Translation::JS_FRAME || |
956 frame_opcode == Translation::INTERPRETED_FRAME) { | 956 frame_opcode == Translation::INTERPRETED_FRAME) { |
957 jsframe_count--; | 957 jsframe_count--; |
958 BailoutId const ast_id = BailoutId(it.Next()); | 958 BailoutId const bailout_id = BailoutId(it.Next()); |
959 SharedFunctionInfo* const shared_info = | 959 SharedFunctionInfo* const shared_info = |
960 SharedFunctionInfo::cast(literal_array->get(it.Next())); | 960 SharedFunctionInfo::cast(literal_array->get(it.Next())); |
961 it.Next(); // Skip height. | 961 it.Next(); // Skip height. |
962 | 962 |
963 // The translation commands are ordered and the function is always | 963 // The translation commands are ordered and the function is always |
964 // at the first position, and the receiver is next. | 964 // at the first position, and the receiver is next. |
965 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 965 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
966 | 966 |
967 // Get the correct function in the optimized frame. | 967 // Get the correct function in the optimized frame. |
968 JSFunction* function; | 968 JSFunction* function; |
(...skipping 26 matching lines...) Expand all Loading... |
995 } | 995 } |
996 | 996 |
997 AbstractCode* abstract_code; | 997 AbstractCode* abstract_code; |
998 | 998 |
999 unsigned code_offset; | 999 unsigned code_offset; |
1000 if (frame_opcode == Translation::JS_FRAME) { | 1000 if (frame_opcode == Translation::JS_FRAME) { |
1001 Code* code = shared_info->code(); | 1001 Code* code = shared_info->code(); |
1002 DeoptimizationOutputData* const output_data = | 1002 DeoptimizationOutputData* const output_data = |
1003 DeoptimizationOutputData::cast(code->deoptimization_data()); | 1003 DeoptimizationOutputData::cast(code->deoptimization_data()); |
1004 unsigned const entry = | 1004 unsigned const entry = |
1005 Deoptimizer::GetOutputInfo(output_data, ast_id, shared_info); | 1005 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); |
1006 code_offset = FullCodeGenerator::PcField::decode(entry); | 1006 code_offset = FullCodeGenerator::PcField::decode(entry); |
1007 abstract_code = AbstractCode::cast(code); | 1007 abstract_code = AbstractCode::cast(code); |
1008 } else { | 1008 } else { |
1009 // TODO(rmcilroy): Modify FrameSummary to enable us to summarize | |
1010 // based on the BytecodeArray and bytecode offset. | |
1011 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); | 1009 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); |
1012 code_offset = 0; | 1010 code_offset = bailout_id.ToInt(); |
1013 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); | 1011 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); |
1014 } | 1012 } |
1015 FrameSummary summary(receiver, function, abstract_code, code_offset, | 1013 FrameSummary summary(receiver, function, abstract_code, code_offset, |
1016 is_constructor); | 1014 is_constructor); |
1017 frames->Add(summary); | 1015 frames->Add(summary); |
1018 is_constructor = false; | 1016 is_constructor = false; |
1019 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) { | 1017 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) { |
1020 // The next encountered JS_FRAME will be marked as a constructor call. | 1018 // The next encountered JS_FRAME will be marked as a constructor call. |
1021 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); | 1019 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); |
1022 DCHECK(!is_constructor); | 1020 DCHECK(!is_constructor); |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1661 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1664 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1662 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1665 list.Add(frame, zone); | 1663 list.Add(frame, zone); |
1666 } | 1664 } |
1667 return list.ToVector(); | 1665 return list.ToVector(); |
1668 } | 1666 } |
1669 | 1667 |
1670 | 1668 |
1671 } // namespace internal | 1669 } // namespace internal |
1672 } // namespace v8 | 1670 } // namespace v8 |
OLD | NEW |