| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 return marker == Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR); | 144 return marker == Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR); |
| 145 } | 145 } |
| 146 | 146 |
| 147 | 147 |
| 148 inline bool StandardFrame::IsConstructFrame(Address fp) { | 148 inline bool StandardFrame::IsConstructFrame(Address fp) { |
| 149 Object* marker = | 149 Object* marker = |
| 150 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); | 150 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); |
| 151 return marker == Smi::FromInt(StackFrame::CONSTRUCT); | 151 return marker == Smi::FromInt(StackFrame::CONSTRUCT); |
| 152 } | 152 } |
| 153 | 153 |
| 154 | |
| 155 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) | 154 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) |
| 156 : StandardFrame(iterator) { | 155 : StandardFrame(iterator) {} |
| 157 } | |
| 158 | |
| 159 | 156 |
| 160 Address JavaScriptFrame::GetParameterSlot(int index) const { | 157 Address JavaScriptFrame::GetParameterSlot(int index) const { |
| 161 int param_count = ComputeParametersCount(); | 158 int param_count = ComputeParametersCount(); |
| 162 DCHECK(-1 <= index && index < param_count); | 159 DCHECK(-1 <= index && index < param_count); |
| 163 int parameter_offset = (param_count - index - 1) * kPointerSize; | 160 int parameter_offset = (param_count - index - 1) * kPointerSize; |
| 164 return caller_sp() + parameter_offset; | 161 return caller_sp() + parameter_offset; |
| 165 } | 162 } |
| 166 | 163 |
| 167 | 164 |
| 168 Object* JavaScriptFrame::GetParameter(int index) const { | 165 Object* JavaScriptFrame::GetParameter(int index) const { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 232 |
| 236 | 233 |
| 237 inline InterpretedFrame::InterpretedFrame(StackFrameIteratorBase* iterator) | 234 inline InterpretedFrame::InterpretedFrame(StackFrameIteratorBase* iterator) |
| 238 : JavaScriptFrame(iterator) {} | 235 : JavaScriptFrame(iterator) {} |
| 239 | 236 |
| 240 | 237 |
| 241 inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame( | 238 inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame( |
| 242 StackFrameIteratorBase* iterator) : JavaScriptFrame(iterator) { | 239 StackFrameIteratorBase* iterator) : JavaScriptFrame(iterator) { |
| 243 } | 240 } |
| 244 | 241 |
| 242 inline WasmFrame::WasmFrame(StackFrameIteratorBase* iterator) |
| 243 : StandardFrame(iterator) {} |
| 245 | 244 |
| 246 inline InternalFrame::InternalFrame(StackFrameIteratorBase* iterator) | 245 inline InternalFrame::InternalFrame(StackFrameIteratorBase* iterator) |
| 247 : StandardFrame(iterator) { | 246 : StandardFrame(iterator) { |
| 248 } | 247 } |
| 249 | 248 |
| 250 | 249 |
| 251 inline StubFailureTrampolineFrame::StubFailureTrampolineFrame( | 250 inline StubFailureTrampolineFrame::StubFailureTrampolineFrame( |
| 252 StackFrameIteratorBase* iterator) : StandardFrame(iterator) { | 251 StackFrameIteratorBase* iterator) : StandardFrame(iterator) { |
| 253 } | 252 } |
| 254 | 253 |
| 255 | 254 |
| 256 inline ConstructFrame::ConstructFrame(StackFrameIteratorBase* iterator) | 255 inline ConstructFrame::ConstructFrame(StackFrameIteratorBase* iterator) |
| 257 : InternalFrame(iterator) { | 256 : InternalFrame(iterator) { |
| 258 } | 257 } |
| 259 | 258 |
| 260 | |
| 261 inline JavaScriptFrameIterator::JavaScriptFrameIterator( | 259 inline JavaScriptFrameIterator::JavaScriptFrameIterator( |
| 262 Isolate* isolate) | 260 Isolate* isolate) |
| 263 : iterator_(isolate) { | 261 : iterator_(isolate) { |
| 264 if (!done()) Advance(); | 262 if (!done()) Advance(); |
| 265 } | 263 } |
| 266 | 264 |
| 267 | |
| 268 inline JavaScriptFrameIterator::JavaScriptFrameIterator( | 265 inline JavaScriptFrameIterator::JavaScriptFrameIterator( |
| 269 Isolate* isolate, ThreadLocalTop* top) | 266 Isolate* isolate, ThreadLocalTop* top) |
| 270 : iterator_(isolate, top) { | 267 : iterator_(isolate, top) { |
| 271 if (!done()) Advance(); | 268 if (!done()) Advance(); |
| 272 } | 269 } |
| 273 | 270 |
| 274 | |
| 275 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { | 271 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { |
| 276 // TODO(1233797): The frame hierarchy needs to change. It's | 272 // TODO(1233797): The frame hierarchy needs to change. It's |
| 277 // problematic that we can't use the safe-cast operator to cast to | 273 // problematic that we can't use the safe-cast operator to cast to |
| 278 // the JavaScript frame type, because we may encounter arguments | 274 // the JavaScript frame type, because we may encounter arguments |
| 279 // adaptor frames. | 275 // adaptor frames. |
| 280 StackFrame* frame = iterator_.frame(); | 276 StackFrame* frame = iterator_.frame(); |
| 281 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor()); | 277 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor()); |
| 282 return static_cast<JavaScriptFrame*>(frame); | 278 return static_cast<JavaScriptFrame*>(frame); |
| 283 } | 279 } |
| 284 | 280 |
| 285 | 281 |
| 286 inline StackFrame* SafeStackFrameIterator::frame() const { | 282 inline StackFrame* SafeStackFrameIterator::frame() const { |
| 287 DCHECK(!done()); | 283 DCHECK(!done()); |
| 288 DCHECK(frame_->is_java_script() || frame_->is_exit()); | 284 DCHECK(frame_->is_java_script() || frame_->is_exit()); |
| 289 return frame_; | 285 return frame_; |
| 290 } | 286 } |
| 291 | 287 |
| 292 | 288 |
| 293 } // namespace internal | 289 } // namespace internal |
| 294 } // namespace v8 | 290 } // namespace v8 |
| 295 | 291 |
| 296 #endif // V8_FRAMES_INL_H_ | 292 #endif // V8_FRAMES_INL_H_ |
| OLD | NEW |