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