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