OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 inline bool StandardFrame::IsConstructFrame(Address fp) { | 144 inline bool StandardFrame::IsConstructFrame(Address fp) { |
145 Object* marker = | 145 Object* marker = |
146 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); | 146 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); |
147 return marker == Smi::FromInt(CONSTRUCT); | 147 return marker == Smi::FromInt(CONSTRUCT); |
148 } | 148 } |
149 | 149 |
150 | 150 |
| 151 Address JavaScriptFrame::GetParameterSlot(int index) const { |
| 152 int param_count = ComputeParametersCount(); |
| 153 ASSERT(-1 <= index && index < param_count); |
| 154 int parameter_offset = (param_count - index - 1) * kPointerSize; |
| 155 return caller_sp() + parameter_offset; |
| 156 } |
| 157 |
| 158 |
| 159 Object* JavaScriptFrame::GetParameter(int index) const { |
| 160 return Memory::Object_at(GetParameterSlot(index)); |
| 161 } |
| 162 |
| 163 |
151 inline Object* JavaScriptFrame::receiver() const { | 164 inline Object* JavaScriptFrame::receiver() const { |
152 const int offset = JavaScriptFrameConstants::kReceiverOffset; | 165 return GetParameter(-1); |
153 return Memory::Object_at(caller_sp() + offset); | |
154 } | 166 } |
155 | 167 |
156 | 168 |
157 inline void JavaScriptFrame::set_receiver(Object* value) { | 169 inline void JavaScriptFrame::set_receiver(Object* value) { |
158 const int offset = JavaScriptFrameConstants::kReceiverOffset; | 170 Memory::Object_at(GetParameterSlot(-1)) = value; |
159 Memory::Object_at(caller_sp() + offset) = value; | |
160 } | 171 } |
161 | 172 |
162 | 173 |
163 inline bool JavaScriptFrame::has_adapted_arguments() const { | 174 inline bool JavaScriptFrame::has_adapted_arguments() const { |
164 return IsArgumentsAdaptorFrame(caller_fp()); | 175 return IsArgumentsAdaptorFrame(caller_fp()); |
165 } | 176 } |
166 | 177 |
167 | 178 |
168 inline Object* JavaScriptFrame::function() const { | 179 inline Object* JavaScriptFrame::function() const { |
169 Object* result = function_slot_object(); | 180 Object* result = function_slot_object(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 template<typename Iterator> | 238 template<typename Iterator> |
228 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { | 239 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { |
229 iterator_.Reset(); | 240 iterator_.Reset(); |
230 if (!done()) Advance(); | 241 if (!done()) Advance(); |
231 } | 242 } |
232 | 243 |
233 | 244 |
234 } } // namespace v8::internal | 245 } } // namespace v8::internal |
235 | 246 |
236 #endif // V8_FRAMES_INL_H_ | 247 #endif // V8_FRAMES_INL_H_ |
OLD | NEW |