Chromium Code Reviews| 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 int jsframe_count = it.Next(); | 934 int jsframe_count = it.Next(); |
| 935 | 935 |
| 936 // We create the summary in reverse order because the frames | 936 // We create the summary in reverse order because the frames |
| 937 // in the deoptimization translation are ordered bottom-to-top. | 937 // in the deoptimization translation are ordered bottom-to-top. |
| 938 bool is_constructor = IsConstructor(); | 938 bool is_constructor = IsConstructor(); |
| 939 while (jsframe_count != 0) { | 939 while (jsframe_count != 0) { |
| 940 frame_opcode = static_cast<Translation::Opcode>(it.Next()); | 940 frame_opcode = static_cast<Translation::Opcode>(it.Next()); |
| 941 if (frame_opcode == Translation::JS_FRAME || | 941 if (frame_opcode == Translation::JS_FRAME || |
| 942 frame_opcode == Translation::INTERPRETED_FRAME) { | 942 frame_opcode == Translation::INTERPRETED_FRAME) { |
| 943 jsframe_count--; | 943 jsframe_count--; |
| 944 BailoutId const ast_id = BailoutId(it.Next()); | 944 BailoutId const bailout_id = BailoutId(it.Next()); |
| 945 SharedFunctionInfo* const shared_info = | 945 SharedFunctionInfo* const shared_info = |
| 946 SharedFunctionInfo::cast(literal_array->get(it.Next())); | 946 SharedFunctionInfo::cast(literal_array->get(it.Next())); |
| 947 it.Next(); // Skip height. | 947 it.Next(); // Skip height. |
| 948 | 948 |
| 949 // The translation commands are ordered and the function is always | 949 // The translation commands are ordered and the function is always |
| 950 // at the first position, and the receiver is next. | 950 // at the first position, and the receiver is next. |
| 951 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 951 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
| 952 | 952 |
| 953 // Get the correct function in the optimized frame. | 953 // Get the correct function in the optimized frame. |
| 954 JSFunction* function; | 954 JSFunction* function; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 981 } | 981 } |
| 982 | 982 |
| 983 AbstractCode* abstract_code; | 983 AbstractCode* abstract_code; |
| 984 | 984 |
| 985 unsigned code_offset; | 985 unsigned code_offset; |
| 986 if (frame_opcode == Translation::JS_FRAME) { | 986 if (frame_opcode == Translation::JS_FRAME) { |
| 987 Code* code = shared_info->code(); | 987 Code* code = shared_info->code(); |
| 988 DeoptimizationOutputData* const output_data = | 988 DeoptimizationOutputData* const output_data = |
| 989 DeoptimizationOutputData::cast(code->deoptimization_data()); | 989 DeoptimizationOutputData::cast(code->deoptimization_data()); |
| 990 unsigned const entry = | 990 unsigned const entry = |
| 991 Deoptimizer::GetOutputInfo(output_data, ast_id, shared_info); | 991 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); |
| 992 code_offset = FullCodeGenerator::PcField::decode(entry); | 992 code_offset = FullCodeGenerator::PcField::decode(entry); |
| 993 abstract_code = AbstractCode::cast(code); | 993 abstract_code = AbstractCode::cast(code); |
| 994 } else { | 994 } else { |
| 995 // TODO(rmcilroy): Modify FrameSummary to enable us to summarize | 995 // TODO(rmcilroy): Modify FrameSummary to enable us to summarize |
| 996 // based on the BytecodeArray and bytecode offset. | 996 // based on the BytecodeArray and bytecode offset. |
|
rmcilroy
2016/02/25 16:46:02
Remove this TODO please
mythria
2016/02/26 13:23:39
Done.
| |
| 997 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); | 997 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); |
| 998 code_offset = 0; | 998 code_offset = bailout_id.ToInt(); |
| 999 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); | 999 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); |
| 1000 } | 1000 } |
| 1001 FrameSummary summary(receiver, function, abstract_code, code_offset, | 1001 FrameSummary summary(receiver, function, abstract_code, code_offset, |
| 1002 is_constructor); | 1002 is_constructor); |
| 1003 frames->Add(summary); | 1003 frames->Add(summary); |
| 1004 is_constructor = false; | 1004 is_constructor = false; |
| 1005 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) { | 1005 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) { |
| 1006 // The next encountered JS_FRAME will be marked as a constructor call. | 1006 // The next encountered JS_FRAME will be marked as a constructor call. |
| 1007 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); | 1007 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); |
| 1008 DCHECK(!is_constructor); | 1008 DCHECK(!is_constructor); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1649 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1649 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1650 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1650 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1651 list.Add(frame, zone); | 1651 list.Add(frame, zone); |
| 1652 } | 1652 } |
| 1653 return list.ToVector(); | 1653 return list.ToVector(); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 | 1656 |
| 1657 } // namespace internal | 1657 } // namespace internal |
| 1658 } // namespace v8 | 1658 } // namespace v8 |
| OLD | NEW |