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 STATIC_ASSERT(InterpreterFrameConstants::kBytecodeOffsetFromFp == | |
1142 StandardFrameConstants::kExpressionsOffset - kPointerSize); | |
1143 int raw_offset = Smi::cast(GetExpression(1))->value(); | |
rmcilroy
2016/01/20 08:52:13
Nit - could you pull the '1' out to a constant som
Michael Starzinger
2016/01/20 11:45:27
Done. Added the constant to the InterpreterFrameCo
| |
1144 return raw_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; | |
1145 } | |
1146 | |
1147 | |
1148 void InterpretedFrame::PatchBytecodeOffset(int new_offset) { | |
1149 STATIC_ASSERT(InterpreterFrameConstants::kBytecodeOffsetFromFp == | |
1150 StandardFrameConstants::kExpressionsOffset - kPointerSize); | |
1151 int raw_offset = new_offset + BytecodeArray::kHeaderSize - kHeapObjectTag; | |
1152 SetExpression(1, Smi::FromInt(raw_offset)); | |
1153 } | |
1154 | |
1155 | |
1131 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 1156 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { |
1132 return Smi::cast(GetExpression(0))->value(); | 1157 return Smi::cast(GetExpression(0))->value(); |
1133 } | 1158 } |
1134 | 1159 |
1135 | 1160 |
1136 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { | 1161 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { |
1137 return fp() + StandardFrameConstants::kCallerSPOffset; | 1162 return fp() + StandardFrameConstants::kCallerSPOffset; |
1138 } | 1163 } |
1139 | 1164 |
1140 | 1165 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1589 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1614 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1590 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1615 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1591 list.Add(frame, zone); | 1616 list.Add(frame, zone); |
1592 } | 1617 } |
1593 return list.ToVector(); | 1618 return list.ToVector(); |
1594 } | 1619 } |
1595 | 1620 |
1596 | 1621 |
1597 } // namespace internal | 1622 } // namespace internal |
1598 } // namespace v8 | 1623 } // namespace v8 |
OLD | NEW |