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 #ifndef V8_FRAMES_INL_H_ | 5 #ifndef V8_FRAMES_INL_H_ |
6 #define V8_FRAMES_INL_H_ | 6 #define V8_FRAMES_INL_H_ |
7 | 7 |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 inline Object* StandardFrame::GetExpression(int index) const { | 107 inline Object* StandardFrame::GetExpression(int index) const { |
108 return Memory::Object_at(GetExpressionAddress(index)); | 108 return Memory::Object_at(GetExpressionAddress(index)); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 inline void StandardFrame::SetExpression(int index, Object* value) { | 112 inline void StandardFrame::SetExpression(int index, Object* value) { |
113 Memory::Object_at(GetExpressionAddress(index)) = value; | 113 Memory::Object_at(GetExpressionAddress(index)) = value; |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 inline Object* StandardFrame::context() const { | |
118 const int offset = StandardFrameConstants::kContextOffset; | |
119 Object* maybe_result = Memory::Object_at(fp() + offset); | |
120 DCHECK(!maybe_result->IsSmi()); | |
121 return maybe_result; | |
122 } | |
123 | |
124 | |
125 inline Address StandardFrame::caller_fp() const { | 117 inline Address StandardFrame::caller_fp() const { |
126 return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset); | 118 return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset); |
127 } | 119 } |
128 | 120 |
129 | 121 |
130 inline Address StandardFrame::caller_pc() const { | 122 inline Address StandardFrame::caller_pc() const { |
131 return Memory::Address_at(ComputePCAddress(fp())); | 123 return Memory::Address_at(ComputePCAddress(fp())); |
132 } | 124 } |
133 | 125 |
134 | 126 |
(...skipping 23 matching lines...) Expand all Loading... |
158 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) | 150 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) |
159 : StandardFrame(iterator) {} | 151 : StandardFrame(iterator) {} |
160 | 152 |
161 Address JavaScriptFrame::GetParameterSlot(int index) const { | 153 Address JavaScriptFrame::GetParameterSlot(int index) const { |
162 int param_count = ComputeParametersCount(); | 154 int param_count = ComputeParametersCount(); |
163 DCHECK(-1 <= index && index < param_count); | 155 DCHECK(-1 <= index && index < param_count); |
164 int parameter_offset = (param_count - index - 1) * kPointerSize; | 156 int parameter_offset = (param_count - index - 1) * kPointerSize; |
165 return caller_sp() + parameter_offset; | 157 return caller_sp() + parameter_offset; |
166 } | 158 } |
167 | 159 |
168 | |
169 Object* JavaScriptFrame::GetParameter(int index) const { | |
170 return Memory::Object_at(GetParameterSlot(index)); | |
171 } | |
172 | |
173 | |
174 inline Address JavaScriptFrame::GetOperandSlot(int index) const { | 160 inline Address JavaScriptFrame::GetOperandSlot(int index) const { |
175 Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; | 161 Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; |
176 DCHECK(IsAddressAligned(base, kPointerSize)); | 162 DCHECK(IsAddressAligned(base, kPointerSize)); |
177 DCHECK_EQ(type(), JAVA_SCRIPT); | 163 DCHECK_EQ(type(), JAVA_SCRIPT); |
178 DCHECK_LT(index, ComputeOperandsCount()); | 164 DCHECK_LT(index, ComputeOperandsCount()); |
179 DCHECK_LE(0, index); | 165 DCHECK_LE(0, index); |
180 // Operand stack grows down. | 166 // Operand stack grows down. |
181 return base - index * kPointerSize; | 167 return base - index * kPointerSize; |
182 } | 168 } |
183 | 169 |
(...skipping 23 matching lines...) Expand all Loading... |
207 inline bool JavaScriptFrame::has_adapted_arguments() const { | 193 inline bool JavaScriptFrame::has_adapted_arguments() const { |
208 return IsArgumentsAdaptorFrame(caller_fp()); | 194 return IsArgumentsAdaptorFrame(caller_fp()); |
209 } | 195 } |
210 | 196 |
211 | 197 |
212 inline Object* JavaScriptFrame::function_slot_object() const { | 198 inline Object* JavaScriptFrame::function_slot_object() const { |
213 const int offset = JavaScriptFrameConstants::kFunctionOffset; | 199 const int offset = JavaScriptFrameConstants::kFunctionOffset; |
214 return Memory::Object_at(fp() + offset); | 200 return Memory::Object_at(fp() + offset); |
215 } | 201 } |
216 | 202 |
217 | |
218 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) | 203 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) |
219 : StandardFrame(iterator) { | 204 : StandardFrame(iterator) { |
220 } | 205 } |
221 | 206 |
222 | 207 |
223 inline OptimizedFrame::OptimizedFrame(StackFrameIteratorBase* iterator) | 208 inline OptimizedFrame::OptimizedFrame(StackFrameIteratorBase* iterator) |
224 : JavaScriptFrame(iterator) { | 209 : JavaScriptFrame(iterator) { |
225 } | 210 } |
226 | 211 |
227 | 212 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 DCHECK(!done()); | 293 DCHECK(!done()); |
309 DCHECK(frame_->is_java_script() || frame_->is_exit()); | 294 DCHECK(frame_->is_java_script() || frame_->is_exit()); |
310 return frame_; | 295 return frame_; |
311 } | 296 } |
312 | 297 |
313 | 298 |
314 } // namespace internal | 299 } // namespace internal |
315 } // namespace v8 | 300 } // namespace v8 |
316 | 301 |
317 #endif // V8_FRAMES_INL_H_ | 302 #endif // V8_FRAMES_INL_H_ |
OLD | NEW |