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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 : receiver_(receiver, function->GetIsolate()), | 970 : receiver_(receiver, function->GetIsolate()), |
971 function_(function), | 971 function_(function), |
972 abstract_code_(abstract_code), | 972 abstract_code_(abstract_code), |
973 code_offset_(code_offset), | 973 code_offset_(code_offset), |
974 is_constructor_(is_constructor) { | 974 is_constructor_(is_constructor) { |
975 DCHECK(abstract_code->IsBytecodeArray() || | 975 DCHECK(abstract_code->IsBytecodeArray() || |
976 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION || | 976 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION || |
977 CannotDeoptFromAsmCode(Code::cast(abstract_code), function)); | 977 CannotDeoptFromAsmCode(Code::cast(abstract_code), function)); |
978 } | 978 } |
979 | 979 |
| 980 FrameSummary FrameSummary::GetFirst(JavaScriptFrame* frame) { |
| 981 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 982 frame->Summarize(&frames); |
| 983 return frames.first(); |
| 984 } |
| 985 |
980 void FrameSummary::Print() { | 986 void FrameSummary::Print() { |
981 PrintF("receiver: "); | 987 PrintF("receiver: "); |
982 receiver_->ShortPrint(); | 988 receiver_->ShortPrint(); |
983 PrintF("\nfunction: "); | 989 PrintF("\nfunction: "); |
984 function_->shared()->DebugName()->ShortPrint(); | 990 function_->shared()->DebugName()->ShortPrint(); |
985 PrintF("\ncode: "); | 991 PrintF("\ncode: "); |
986 abstract_code_->ShortPrint(); | 992 abstract_code_->ShortPrint(); |
987 if (abstract_code_->IsCode()) { | 993 if (abstract_code_->IsCode()) { |
988 Code* code = abstract_code_->GetCode(); | 994 Code* code = abstract_code_->GetCode(); |
989 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT "); | 995 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT "); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 | 1227 |
1222 void InterpretedFrame::PatchBytecodeOffset(int new_offset) { | 1228 void InterpretedFrame::PatchBytecodeOffset(int new_offset) { |
1223 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; | 1229 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; |
1224 DCHECK_EQ( | 1230 DCHECK_EQ( |
1225 InterpreterFrameConstants::kBytecodeOffsetFromFp, | 1231 InterpreterFrameConstants::kBytecodeOffsetFromFp, |
1226 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize); | 1232 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize); |
1227 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag; | 1233 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag; |
1228 SetExpression(index, Smi::FromInt(raw_offset)); | 1234 SetExpression(index, Smi::FromInt(raw_offset)); |
1229 } | 1235 } |
1230 | 1236 |
1231 Object* InterpretedFrame::GetBytecodeArray() const { | 1237 BytecodeArray* InterpretedFrame::GetBytecodeArray() const { |
1232 const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex; | 1238 const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex; |
1233 DCHECK_EQ( | 1239 DCHECK_EQ( |
1234 InterpreterFrameConstants::kBytecodeArrayFromFp, | 1240 InterpreterFrameConstants::kBytecodeArrayFromFp, |
1235 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize); | 1241 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize); |
1236 return GetExpression(index); | 1242 return BytecodeArray::cast(GetExpression(index)); |
1237 } | 1243 } |
1238 | 1244 |
1239 void InterpretedFrame::PatchBytecodeArray(Object* bytecode_array) { | 1245 void InterpretedFrame::PatchBytecodeArray(BytecodeArray* bytecode_array) { |
1240 const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex; | 1246 const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex; |
1241 DCHECK_EQ( | 1247 DCHECK_EQ( |
1242 InterpreterFrameConstants::kBytecodeArrayFromFp, | 1248 InterpreterFrameConstants::kBytecodeArrayFromFp, |
1243 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize); | 1249 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize); |
1244 SetExpression(index, bytecode_array); | 1250 SetExpression(index, bytecode_array); |
1245 } | 1251 } |
1246 | 1252 |
1247 Object* InterpretedFrame::GetInterpreterRegister(int register_index) const { | 1253 Object* InterpretedFrame::GetInterpreterRegister(int register_index) const { |
1248 const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex; | 1254 const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex; |
1249 DCHECK_EQ( | 1255 DCHECK_EQ( |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1754 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1749 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1755 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1750 list.Add(frame, zone); | 1756 list.Add(frame, zone); |
1751 } | 1757 } |
1752 return list.ToVector(); | 1758 return list.ToVector(); |
1753 } | 1759 } |
1754 | 1760 |
1755 | 1761 |
1756 } // namespace internal | 1762 } // namespace internal |
1757 } // namespace v8 | 1763 } // namespace v8 |
OLD | NEW |