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