| 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/v8memory.h" | 10 #include "src/v8memory.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) | 154 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) |
| 155 : StandardFrame(iterator) { | 155 : StandardFrame(iterator) { |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 Address JavaScriptFrame::GetParameterSlot(int index) const { | 159 Address JavaScriptFrame::GetParameterSlot(int index) const { |
| 160 int param_count = ComputeParametersCount(); | 160 int param_count = ComputeParametersCount(); |
| 161 DCHECK(-1 <= index && index < param_count); | 161 // DCHECK(-1 <= index && index < param_count); |
| 162 int parameter_offset = (param_count - index - 1) * kPointerSize; | 162 int parameter_offset = (param_count - index - 1) * kPointerSize; |
| 163 return caller_sp() + parameter_offset; | 163 return caller_sp() + parameter_offset; |
| 164 } | 164 } |
| 165 | 165 |
| 166 | 166 |
| 167 Object* JavaScriptFrame::GetParameter(int index) const { | 167 Object* JavaScriptFrame::GetParameter(int index) const { |
| 168 return Memory::Object_at(GetParameterSlot(index)); | 168 return Memory::Object_at(GetParameterSlot(index)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 inline bool JavaScriptFrame::has_adapted_arguments() const { | 210 inline bool JavaScriptFrame::has_adapted_arguments() const { |
| 211 return IsArgumentsAdaptorFrame(caller_fp()); | 211 return IsArgumentsAdaptorFrame(caller_fp()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 | 214 |
| 215 inline JSFunction* JavaScriptFrame::function() const { | 215 inline JSFunction* JavaScriptFrame::function() const { |
| 216 return JSFunction::cast(function_slot_object()); | 216 return JSFunction::cast(function_slot_object()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 inline Object* JavaScriptFrame::NewTarget() const { |
| 221 if (!IsConstructor()) { |
| 222 return isolate()->heap()->undefined_value(); |
| 223 } |
| 224 |
| 225 Address fp = this->fp(); |
| 226 if (has_adapted_arguments()) { |
| 227 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); |
| 228 } |
| 229 |
| 230 int param_count = GetArgumentsLength(); |
| 231 // One for return address |
| 232 // One for receiver |
| 233 // One for original constructor |
| 234 Object* new_target = Memory::Object_at(fp + (3 + param_count) * kPointerSize); |
| 235 DCHECK(new_target->IsJSFunction()); |
| 236 return new_target; |
| 237 } |
| 238 |
| 239 |
| 220 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) | 240 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) |
| 221 : StandardFrame(iterator) { | 241 : StandardFrame(iterator) { |
| 222 } | 242 } |
| 223 | 243 |
| 224 | 244 |
| 225 inline OptimizedFrame::OptimizedFrame(StackFrameIteratorBase* iterator) | 245 inline OptimizedFrame::OptimizedFrame(StackFrameIteratorBase* iterator) |
| 226 : JavaScriptFrame(iterator) { | 246 : JavaScriptFrame(iterator) { |
| 227 } | 247 } |
| 228 | 248 |
| 229 | 249 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 inline StackFrame* SafeStackFrameIterator::frame() const { | 295 inline StackFrame* SafeStackFrameIterator::frame() const { |
| 276 DCHECK(!done()); | 296 DCHECK(!done()); |
| 277 DCHECK(frame_->is_java_script() || frame_->is_exit()); | 297 DCHECK(frame_->is_java_script() || frame_->is_exit()); |
| 278 return frame_; | 298 return frame_; |
| 279 } | 299 } |
| 280 | 300 |
| 281 | 301 |
| 282 } } // namespace v8::internal | 302 } } // namespace v8::internal |
| 283 | 303 |
| 284 #endif // V8_FRAMES_INL_H_ | 304 #endif // V8_FRAMES_INL_H_ |
| OLD | NEW |