Index: src/frames-inl.h |
diff --git a/src/frames-inl.h b/src/frames-inl.h |
index 83b37a5fe53a81f294d411e9381b8b9d555e6250..6ca1f1ff69868850549d3d026e6a6401375a2c36 100644 |
--- a/src/frames-inl.h |
+++ b/src/frames-inl.h |
@@ -213,6 +213,33 @@ Object* JavaScriptFrame::GetParameter(int index) const { |
} |
+inline Address JavaScriptFrame::GetOperandSlot(int index) const { |
+ Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; |
+ ASSERT(IsAddressAligned(base, kPointerSize)); |
+ ASSERT(type() == JAVA_SCRIPT); |
+ 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)); |
+ ASSERT(type() == JAVA_SCRIPT); |
+ ASSERT(stack_size_in_bytes >= 0); |
+ return stack_size_in_bytes >> kPointerSizeLog2; |
+} |
+ |
+ |
inline Object* JavaScriptFrame::receiver() const { |
return GetParameter(-1); |
} |