Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: src/frames-inl.h

Issue 14348003: Add support for yield expressions (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Rebase on top of https://codereview.chromium.org/14416011/ Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/frames.h ('k') | src/runtime.cc » ('j') | src/runtime.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/frames.h ('k') | src/runtime.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698