Chromium Code Reviews| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 // Base points to low address of first operand and stack grows down, so add | 192 // Base points to low address of first operand and stack grows down, so add |
| 193 // kPointerSize to get the actual stack size. | 193 // kPointerSize to get the actual stack size. |
| 194 intptr_t stack_size_in_bytes = (base + kPointerSize) - sp(); | 194 intptr_t stack_size_in_bytes = (base + kPointerSize) - sp(); |
| 195 DCHECK(IsAligned(stack_size_in_bytes, kPointerSize)); | 195 DCHECK(IsAligned(stack_size_in_bytes, kPointerSize)); |
| 196 DCHECK(type() == JAVA_SCRIPT); | 196 DCHECK(type() == JAVA_SCRIPT); |
| 197 DCHECK(stack_size_in_bytes >= 0); | 197 DCHECK(stack_size_in_bytes >= 0); |
| 198 return static_cast<int>(stack_size_in_bytes >> kPointerSizeLog2); | 198 return static_cast<int>(stack_size_in_bytes >> kPointerSizeLog2); |
| 199 } | 199 } |
| 200 | 200 |
| 201 | 201 |
| 202 inline Object* JavaScriptFrame::receiver() const { | |
| 203 return GetParameter(-1); | |
| 204 } | |
| 205 | |
| 206 | |
| 207 inline void JavaScriptFrame::set_receiver(Object* value) { | 202 inline void JavaScriptFrame::set_receiver(Object* value) { |
| 208 Memory::Object_at(GetParameterSlot(-1)) = value; | 203 Memory::Object_at(GetParameterSlot(-1)) = value; |
| 209 } | 204 } |
| 210 | 205 |
| 211 | 206 |
| 212 inline bool JavaScriptFrame::has_adapted_arguments() const { | 207 inline bool JavaScriptFrame::has_adapted_arguments() const { |
| 213 return IsArgumentsAdaptorFrame(caller_fp()); | 208 return IsArgumentsAdaptorFrame(caller_fp()); |
| 214 } | 209 } |
| 215 | 210 |
| 216 | 211 |
| 217 inline JSFunction* JavaScriptFrame::function() const { | |
| 218 return JSFunction::cast(function_slot_object()); | |
| 219 } | |
| 220 | |
| 221 | |
| 222 inline Object* JavaScriptFrame::function_slot_object() const { | 212 inline Object* JavaScriptFrame::function_slot_object() const { |
| 223 const int offset = JavaScriptFrameConstants::kFunctionOffset; | 213 const int offset = JavaScriptFrameConstants::kFunctionOffset; |
| 224 return Memory::Object_at(fp() + offset); | 214 return Memory::Object_at(fp() + offset); |
| 225 } | 215 } |
| 226 | 216 |
| 227 | 217 |
| 228 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) | 218 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) |
| 229 : StandardFrame(iterator) { | 219 : StandardFrame(iterator) { |
| 230 } | 220 } |
| 231 | 221 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { | 271 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { |
| 282 // TODO(1233797): The frame hierarchy needs to change. It's | 272 // TODO(1233797): The frame hierarchy needs to change. It's |
| 283 // 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 |
| 284 // the JavaScript frame type, because we may encounter arguments | 274 // the JavaScript frame type, because we may encounter arguments |
| 285 // adaptor frames. | 275 // adaptor frames. |
| 286 StackFrame* frame = iterator_.frame(); | 276 StackFrame* frame = iterator_.frame(); |
| 287 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor()); | 277 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor()); |
| 288 return static_cast<JavaScriptFrame*>(frame); | 278 return static_cast<JavaScriptFrame*>(frame); |
| 289 } | 279 } |
| 290 | 280 |
| 281 inline StandardFrame* StackTraceFrameIterator::frame() const { | |
| 282 StackFrame* frame = iterator_.frame(); | |
| 283 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor() || | |
| 284 frame->is_wasm()); | |
| 285 return static_cast<StandardFrame*>(frame); | |
| 286 } | |
| 287 | |
| 288 bool StackTraceFrameIterator::isJS() const { return frame()->is_java_script(); } | |
|
titzer
2016/04/06 09:53:23
Spell out JavaScript here.
Clemens Hammacher
2016/04/06 10:18:28
OK, changed it to is_javascript.
| |
| 289 | |
| 290 bool StackTraceFrameIterator::isWasm() const { return frame()->is_wasm(); } | |
| 291 | |
| 292 JavaScriptFrame* StackTraceFrameIterator::jsFrame() const { | |
|
titzer
2016/04/06 09:53:22
CamelCase doesn't quite fit the surrounding style
Clemens Hammacher
2016/04/06 10:18:28
Done.
| |
| 293 DCHECK(isJS()); | |
| 294 return static_cast<JavaScriptFrame*>(frame()); | |
| 295 } | |
| 296 | |
| 297 WasmFrame* StackTraceFrameIterator::wasmFrame() const { | |
| 298 DCHECK(isWasm()); | |
| 299 return static_cast<WasmFrame*>(frame()); | |
| 300 } | |
| 291 | 301 |
| 292 inline StackFrame* SafeStackFrameIterator::frame() const { | 302 inline StackFrame* SafeStackFrameIterator::frame() const { |
| 293 DCHECK(!done()); | 303 DCHECK(!done()); |
| 294 DCHECK(frame_->is_java_script() || frame_->is_exit()); | 304 DCHECK(frame_->is_java_script() || frame_->is_exit()); |
| 295 return frame_; | 305 return frame_; |
| 296 } | 306 } |
| 297 | 307 |
| 298 | 308 |
| 299 } // namespace internal | 309 } // namespace internal |
| 300 } // namespace v8 | 310 } // namespace v8 |
| 301 | 311 |
| 302 #endif // V8_FRAMES_INL_H_ | 312 #endif // V8_FRAMES_INL_H_ |
| OLD | NEW |