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