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.h" | 9 #include "src/ast.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 } else { | 1072 } else { |
1073 CHECK_EQ(Translation::JS_FRAME_FUNCTION, opcode); | 1073 CHECK_EQ(Translation::JS_FRAME_FUNCTION, opcode); |
1074 function = this->function(); | 1074 function = this->function(); |
1075 } | 1075 } |
1076 functions->Add(JSFunction::cast(function)); | 1076 functions->Add(JSFunction::cast(function)); |
1077 } | 1077 } |
1078 } | 1078 } |
1079 } | 1079 } |
1080 | 1080 |
1081 | 1081 |
| 1082 int OptimizedFrame::StackSlotOffsetRelativeToFp(int slot_index) { |
| 1083 return StandardFrameConstants::kCallerSPOffset - |
| 1084 ((slot_index + 1) * kPointerSize); |
| 1085 } |
| 1086 |
| 1087 |
1082 Object* OptimizedFrame::StackSlotAt(int index) const { | 1088 Object* OptimizedFrame::StackSlotAt(int index) const { |
1083 // Positive index means the value is spilled to the locals | 1089 return Memory::Object_at(fp() + StackSlotOffsetRelativeToFp(index)); |
1084 // area. Negative means it is stored in the incoming parameter | |
1085 // area. | |
1086 if (index >= 0) return GetExpression(index); | |
1087 | |
1088 // Index -1 overlaps with last parameter, -n with the first parameter, | |
1089 // (-n - 1) with the receiver with n being the number of parameters | |
1090 // of the outermost, optimized frame. | |
1091 int const parameter_count = ComputeParametersCount(); | |
1092 int const parameter_index = index + parameter_count; | |
1093 return (parameter_index == -1) ? receiver() : GetParameter(parameter_index); | |
1094 } | 1090 } |
1095 | 1091 |
1096 | 1092 |
1097 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 1093 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { |
1098 return Smi::cast(GetExpression(0))->value(); | 1094 return Smi::cast(GetExpression(0))->value(); |
1099 } | 1095 } |
1100 | 1096 |
1101 | 1097 |
1102 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { | 1098 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { |
1103 return fp() + StandardFrameConstants::kCallerSPOffset; | 1099 return fp() + StandardFrameConstants::kCallerSPOffset; |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1547 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1552 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1548 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1553 list.Add(frame, zone); | 1549 list.Add(frame, zone); |
1554 } | 1550 } |
1555 return list.ToVector(); | 1551 return list.ToVector(); |
1556 } | 1552 } |
1557 | 1553 |
1558 | 1554 |
1559 } // namespace internal | 1555 } // namespace internal |
1560 } // namespace v8 | 1556 } // namespace v8 |
OLD | NEW |