Index: src/frames-inl.h |
diff --git a/src/frames-inl.h b/src/frames-inl.h |
index 83b37a5fe53a81f294d411e9381b8b9d555e6250..68ddd51bcc23d586d4feb81ca437d18fa0825700 100644 |
--- a/src/frames-inl.h |
+++ b/src/frames-inl.h |
@@ -213,6 +213,31 @@ Object* JavaScriptFrame::GetParameter(int index) const { |
} |
+inline Address JavaScriptFrame::GetOperandSlot(int index) const { |
+ Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; |
+ ASSERT(IsAddressAligned(base, kPointerSize)); |
+ ASSERT(index < ComputeOperandsCount()); |
+ // Operand stack grows down. |
+ return base - index * kPointerSize; |
+} |
+ |
+ |
+inline Object* JavaScriptFrame::GetOperand(int index) const { |
+ return Memory::Object_at(GetOperandSlot(index)); |
+} |
+ |
+ |
+inline int JavaScriptFrame::ComputeOperandsCount() const { |
+ Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; |
+ // Base points to low address of first operand and stack grows down, so add |
+ // kPointerSize to get the actual stack size. |
+ intptr_t stack_size_in_bytes = (base + kPointerSize) - sp(); |
+ ASSERT(IsAligned(stack_size_in_bytes, kPointerSize)); |
Michael Starzinger
2013/04/26 09:53:16
Can we add an assert here that the type of the fra
wingo
2013/04/26 10:11:42
Done.
|
+ ASSERT(stack_size_in_bytes >= 0); |
+ return stack_size_in_bytes >> kPointerSizeLog2; |
+} |
+ |
+ |
inline Object* JavaScriptFrame::receiver() const { |
return GetParameter(-1); |
} |