Index: src/x64/frames-x64.cc |
diff --git a/src/x64/frames-x64.cc b/src/x64/frames-x64.cc |
index f206be8e382e232b07336a5b439ce6c03233b6f0..fe224ad998823a58aee088bd9c43056904056e09 100644 |
--- a/src/x64/frames-x64.cc |
+++ b/src/x64/frames-x64.cc |
@@ -65,18 +65,14 @@ StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { |
} |
int JavaScriptFrame::GetProvidedParametersCount() const { |
- UNIMPLEMENTED(); |
- return 0; |
-} |
- |
-byte* ArgumentsAdaptorFrame::GetCallerStackPointer() const { |
- UNIMPLEMENTED(); |
- return NULL; |
+ return ComputeParametersCount(); |
} |
void ExitFrame::Iterate(ObjectVisitor* a) const { |
- UNIMPLEMENTED(); |
+ // Exit frames on X64 do not contain any pointers. The arguments |
+ // are traversed as part of the expression stack of the calling |
+ // frame. |
} |
byte* InternalFrame::GetCallerStackPointer() const { |
@@ -86,8 +82,31 @@ byte* InternalFrame::GetCallerStackPointer() const { |
} |
byte* JavaScriptFrame::GetCallerStackPointer() const { |
- UNIMPLEMENTED(); |
- return NULL; |
+ int arguments; |
+ if (Heap::gc_state() != Heap::NOT_IN_GC || disable_heap_access_) { |
+ // The arguments for cooked frames are traversed as if they were |
+ // expression stack elements of the calling frame. The reason for |
+ // this rather strange decision is that we cannot access the |
+ // function during mark-compact GCs when the stack is cooked. |
+ // In fact accessing heap objects (like function->shared() below) |
+ // at all during GC is problematic. |
+ arguments = 0; |
+ } else { |
+ // Compute the number of arguments by getting the number of formal |
+ // parameters of the function. We must remember to take the |
+ // receiver into account (+1). |
+ JSFunction* function = JSFunction::cast(this->function()); |
+ arguments = function->shared()->formal_parameter_count() + 1; |
+ } |
+ const int offset = StandardFrameConstants::kCallerSPOffset; |
+ return fp() + offset + (arguments * kPointerSize); |
+} |
+ |
+ |
+byte* ArgumentsAdaptorFrame::GetCallerStackPointer() const { |
+ const int arguments = Smi::cast(GetExpression(0))->value(); |
+ const int offset = StandardFrameConstants::kCallerSPOffset; |
+ return fp() + offset + (arguments + 1) * kPointerSize; |
} |