| 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 | |
| 985 void FrameSummary::Print() { | 979 void FrameSummary::Print() { |
| 986 PrintF("receiver: "); | 980 PrintF("receiver: "); |
| 987 receiver_->ShortPrint(); | 981 receiver_->ShortPrint(); |
| 988 PrintF("\nfunction: "); | 982 PrintF("\nfunction: "); |
| 989 function_->shared()->DebugName()->ShortPrint(); | 983 function_->shared()->DebugName()->ShortPrint(); |
| 990 PrintF("\ncode: "); | 984 PrintF("\ncode: "); |
| 991 abstract_code_->ShortPrint(); | 985 abstract_code_->ShortPrint(); |
| 992 if (abstract_code_->IsCode()) { | 986 if (abstract_code_->IsCode()) { |
| 993 Code* code = abstract_code_->GetCode(); | 987 Code* code = abstract_code_->GetCode(); |
| 994 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT "); | 988 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT "); |
| (...skipping 232 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1738 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1745 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1739 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1746 list.Add(frame, zone); | 1740 list.Add(frame, zone); |
| 1747 } | 1741 } |
| 1748 return list.ToVector(); | 1742 return list.ToVector(); |
| 1749 } | 1743 } |
| 1750 | 1744 |
| 1751 | 1745 |
| 1752 } // namespace internal | 1746 } // namespace internal |
| 1753 } // namespace v8 | 1747 } // namespace v8 |
| OLD | NEW |