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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 } | 1145 } |
1146 | 1146 |
1147 void InterpretedFrame::PatchBytecodeOffset(int new_offset) { | 1147 void InterpretedFrame::PatchBytecodeOffset(int new_offset) { |
1148 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; | 1148 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; |
1149 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp, | 1149 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp, |
1150 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); | 1150 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); |
1151 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag; | 1151 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag; |
1152 SetExpression(index, Smi::FromInt(raw_offset)); | 1152 SetExpression(index, Smi::FromInt(raw_offset)); |
1153 } | 1153 } |
1154 | 1154 |
| 1155 Object* InterpretedFrame::GetBytecodeArray() const { |
| 1156 const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex; |
| 1157 DCHECK_EQ(InterpreterFrameConstants::kBytecodeArrayFromFp, |
| 1158 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); |
| 1159 return GetExpression(index); |
| 1160 } |
| 1161 |
| 1162 void InterpretedFrame::PatchBytecodeArray(Object* bytecode_array) { |
| 1163 const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex; |
| 1164 DCHECK_EQ(InterpreterFrameConstants::kBytecodeArrayFromFp, |
| 1165 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); |
| 1166 SetExpression(index, bytecode_array); |
| 1167 } |
| 1168 |
1155 Object* InterpretedFrame::GetInterpreterRegister(int register_index) const { | 1169 Object* InterpretedFrame::GetInterpreterRegister(int register_index) const { |
1156 const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex; | 1170 const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex; |
1157 DCHECK_EQ(InterpreterFrameConstants::kRegisterFilePointerFromFp, | 1171 DCHECK_EQ(InterpreterFrameConstants::kRegisterFilePointerFromFp, |
1158 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); | 1172 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); |
1159 return GetExpression(index + register_index); | 1173 return GetExpression(index + register_index); |
1160 } | 1174 } |
1161 | 1175 |
1162 Address InterpretedFrame::GetDispatchTable() const { | |
1163 return Memory::Address_at( | |
1164 fp() + InterpreterFrameConstants::kDispatchTableFromFp); | |
1165 } | |
1166 | |
1167 void InterpretedFrame::PatchDispatchTable(Address dispatch_table) { | |
1168 Address* dispatch_table_address = reinterpret_cast<Address*>( | |
1169 fp() + InterpreterFrameConstants::kDispatchTableFromFp); | |
1170 *dispatch_table_address = dispatch_table; | |
1171 } | |
1172 | |
1173 void InterpretedFrame::Summarize(List<FrameSummary>* functions) { | 1176 void InterpretedFrame::Summarize(List<FrameSummary>* functions) { |
1174 DCHECK(functions->length() == 0); | 1177 DCHECK(functions->length() == 0); |
1175 AbstractCode* abstract_code = | 1178 AbstractCode* abstract_code = |
1176 AbstractCode::cast(function()->shared()->bytecode_array()); | 1179 AbstractCode::cast(function()->shared()->bytecode_array()); |
1177 FrameSummary summary(receiver(), function(), abstract_code, | 1180 FrameSummary summary(receiver(), function(), abstract_code, |
1178 GetBytecodeOffset(), IsConstructor()); | 1181 GetBytecodeOffset(), IsConstructor()); |
1179 functions->Add(summary); | 1182 functions->Add(summary); |
1180 } | 1183 } |
1181 | 1184 |
1182 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 1185 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 Object** limit = &Memory::Object_at(fp() + offset) + 1; | 1417 Object** limit = &Memory::Object_at(fp() + offset) + 1; |
1415 v->VisitPointers(base, limit); | 1418 v->VisitPointers(base, limit); |
1416 } | 1419 } |
1417 | 1420 |
1418 | 1421 |
1419 void JavaScriptFrame::Iterate(ObjectVisitor* v) const { | 1422 void JavaScriptFrame::Iterate(ObjectVisitor* v) const { |
1420 IterateExpressions(v); | 1423 IterateExpressions(v); |
1421 IteratePc(v, pc_address(), constant_pool_address(), LookupCode()); | 1424 IteratePc(v, pc_address(), constant_pool_address(), LookupCode()); |
1422 } | 1425 } |
1423 | 1426 |
1424 void InterpretedFrame::Iterate(ObjectVisitor* v) const { | |
1425 // Visit tagged pointers in the fixed frame. | |
1426 Object** fixed_frame_base = | |
1427 &Memory::Object_at(fp() + InterpreterFrameConstants::kNewTargetFromFp); | |
1428 Object** fixed_frame_limit = | |
1429 &Memory::Object_at(fp() + StandardFrameConstants::kLastObjectOffset) + 1; | |
1430 v->VisitPointers(fixed_frame_base, fixed_frame_limit); | |
1431 | |
1432 // Visit the expressions. | |
1433 Object** expression_base = &Memory::Object_at(sp()); | |
1434 Object** expression_limit = &Memory::Object_at( | |
1435 fp() + InterpreterFrameConstants::kBytecodeOffsetFromFp) + 1; | |
1436 v->VisitPointers(expression_base, expression_limit); | |
1437 | |
1438 IteratePc(v, pc_address(), constant_pool_address(), LookupCode()); | |
1439 } | |
1440 | |
1441 void InternalFrame::Iterate(ObjectVisitor* v) const { | 1427 void InternalFrame::Iterate(ObjectVisitor* v) const { |
1442 // Internal frames only have object pointers on the expression stack | 1428 // Internal frames only have object pointers on the expression stack |
1443 // as they never have any arguments. | 1429 // as they never have any arguments. |
1444 IterateExpressions(v); | 1430 IterateExpressions(v); |
1445 IteratePc(v, pc_address(), constant_pool_address(), LookupCode()); | 1431 IteratePc(v, pc_address(), constant_pool_address(), LookupCode()); |
1446 } | 1432 } |
1447 | 1433 |
1448 | 1434 |
1449 void StubFailureTrampolineFrame::Iterate(ObjectVisitor* v) const { | 1435 void StubFailureTrampolineFrame::Iterate(ObjectVisitor* v) const { |
1450 Object** base = &Memory::Object_at(sp()); | 1436 Object** base = &Memory::Object_at(sp()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1643 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1658 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1644 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1659 list.Add(frame, zone); | 1645 list.Add(frame, zone); |
1660 } | 1646 } |
1661 return list.ToVector(); | 1647 return list.ToVector(); |
1662 } | 1648 } |
1663 | 1649 |
1664 | 1650 |
1665 } // namespace internal | 1651 } // namespace internal |
1666 } // namespace v8 | 1652 } // namespace v8 |
OLD | NEW |