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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 return StandardFrameConstants::kCallerSPOffset - | 1121 return StandardFrameConstants::kCallerSPOffset - |
1122 ((slot_index + 1) * kPointerSize); | 1122 ((slot_index + 1) * kPointerSize); |
1123 } | 1123 } |
1124 | 1124 |
1125 | 1125 |
1126 Object* OptimizedFrame::StackSlotAt(int index) const { | 1126 Object* OptimizedFrame::StackSlotAt(int index) const { |
1127 return Memory::Object_at(fp() + StackSlotOffsetRelativeToFp(index)); | 1127 return Memory::Object_at(fp() + StackSlotOffsetRelativeToFp(index)); |
1128 } | 1128 } |
1129 | 1129 |
1130 | 1130 |
| 1131 int InterpretedFrame::LookupExceptionHandlerInTable( |
| 1132 int* stack_slots, HandlerTable::CatchPrediction* prediction) { |
| 1133 BytecodeArray* bytecode = function()->shared()->bytecode_array(); |
| 1134 HandlerTable* table = HandlerTable::cast(bytecode->handler_table()); |
| 1135 int pc_offset = GetBytecodeOffset() + 1; // Point after current bytecode. |
| 1136 return table->LookupRange(pc_offset, stack_slots, prediction); |
| 1137 } |
| 1138 |
| 1139 |
| 1140 int InterpretedFrame::GetBytecodeOffset() const { |
| 1141 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; |
| 1142 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp, |
| 1143 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); |
| 1144 int raw_offset = Smi::cast(GetExpression(index))->value(); |
| 1145 return raw_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; |
| 1146 } |
| 1147 |
| 1148 |
| 1149 void InterpretedFrame::PatchBytecodeOffset(int new_offset) { |
| 1150 const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex; |
| 1151 DCHECK_EQ(InterpreterFrameConstants::kBytecodeOffsetFromFp, |
| 1152 StandardFrameConstants::kExpressionsOffset - index * kPointerSize); |
| 1153 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag; |
| 1154 SetExpression(index, Smi::FromInt(raw_offset)); |
| 1155 } |
| 1156 |
| 1157 |
1131 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 1158 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { |
1132 return Smi::cast(GetExpression(0))->value(); | 1159 return Smi::cast(GetExpression(0))->value(); |
1133 } | 1160 } |
1134 | 1161 |
1135 | 1162 |
1136 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { | 1163 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { |
1137 return fp() + StandardFrameConstants::kCallerSPOffset; | 1164 return fp() + StandardFrameConstants::kCallerSPOffset; |
1138 } | 1165 } |
1139 | 1166 |
1140 | 1167 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1616 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1590 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1617 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1591 list.Add(frame, zone); | 1618 list.Add(frame, zone); |
1592 } | 1619 } |
1593 return list.ToVector(); | 1620 return list.ToVector(); |
1594 } | 1621 } |
1595 | 1622 |
1596 | 1623 |
1597 } // namespace internal | 1624 } // namespace internal |
1598 } // namespace v8 | 1625 } // namespace v8 |
OLD | NEW |