OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 int parameter_offset = (param_count - index - 1) * kPointerSize; | 206 int parameter_offset = (param_count - index - 1) * kPointerSize; |
207 return caller_sp() + parameter_offset; | 207 return caller_sp() + parameter_offset; |
208 } | 208 } |
209 | 209 |
210 | 210 |
211 Object* JavaScriptFrame::GetParameter(int index) const { | 211 Object* JavaScriptFrame::GetParameter(int index) const { |
212 return Memory::Object_at(GetParameterSlot(index)); | 212 return Memory::Object_at(GetParameterSlot(index)); |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 inline Address JavaScriptFrame::GetOperandSlot(int index) const { | |
217 Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; | |
218 ASSERT(IsAddressAligned(base, kPointerSize)); | |
219 ASSERT(index < ComputeOperandsCount()); | |
220 // Operand stack grows down. | |
221 return base - index * kPointerSize; | |
222 } | |
223 | |
224 | |
225 inline Object* JavaScriptFrame::GetOperand(int index) const { | |
226 return Memory::Object_at(GetOperandSlot(index)); | |
227 } | |
228 | |
229 | |
230 inline int JavaScriptFrame::ComputeOperandsCount() const { | |
231 Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; | |
232 // Base points to low address of first operand and stack grows down, so add | |
233 // kPointerSize to get the actual stack size. | |
234 intptr_t stack_size_in_bytes = (base + kPointerSize) - sp(); | |
235 ASSERT(IsAligned(stack_size_in_bytes, kPointerSize)); | |
Michael Starzinger
2013/04/26 09:53:16
Can we add an assert here that the type of the fra
wingo
2013/04/26 10:11:42
Done.
| |
236 ASSERT(stack_size_in_bytes >= 0); | |
237 return stack_size_in_bytes >> kPointerSizeLog2; | |
238 } | |
239 | |
240 | |
216 inline Object* JavaScriptFrame::receiver() const { | 241 inline Object* JavaScriptFrame::receiver() const { |
217 return GetParameter(-1); | 242 return GetParameter(-1); |
218 } | 243 } |
219 | 244 |
220 | 245 |
221 inline void JavaScriptFrame::set_receiver(Object* value) { | 246 inline void JavaScriptFrame::set_receiver(Object* value) { |
222 Memory::Object_at(GetParameterSlot(-1)) = value; | 247 Memory::Object_at(GetParameterSlot(-1)) = value; |
223 } | 248 } |
224 | 249 |
225 | 250 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 template<typename Iterator> | 354 template<typename Iterator> |
330 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { | 355 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { |
331 iterator_.Reset(); | 356 iterator_.Reset(); |
332 if (!done()) Advance(); | 357 if (!done()) Advance(); |
333 } | 358 } |
334 | 359 |
335 | 360 |
336 } } // namespace v8::internal | 361 } } // namespace v8::internal |
337 | 362 |
338 #endif // V8_FRAMES_INL_H_ | 363 #endif // V8_FRAMES_INL_H_ |
OLD | NEW |