Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index f52b3ce4e47a1bf0fd099723fb36d0f0ac604128..627bb8951b2bcd85dd59c0b265e6ab187affd813 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -559,25 +559,29 @@ void ExitFrame::FillState(Address fp, Address sp, State* state) { |
Address StandardFrame::GetExpressionAddress(int n) const { |
- const int offset = StandardFrameConstants::kExpressionsOffset; |
+ const int offset = (is_java_script() && !is_optimized()) |
+ ? JavaScriptFrameConstants::kLocal0Offset |
+ : StandardFrameConstants::kExpressionsOffset; |
return fp() + offset - n * kPointerSize; |
} |
-Object* StandardFrame::GetExpression(Address fp, int index) { |
- return Memory::Object_at(GetExpressionAddress(fp, index)); |
+Object* StandardFrame::GetStandardFrameExpression(Address fp, int index) { |
+ return Memory::Object_at(GetStandardFrameExpressionAddress(fp, index)); |
} |
-Address StandardFrame::GetExpressionAddress(Address fp, int n) { |
+Address StandardFrame::GetStandardFrameExpressionAddress(Address fp, int n) { |
const int offset = StandardFrameConstants::kExpressionsOffset; |
return fp + offset - n * kPointerSize; |
} |
int StandardFrame::ComputeExpressionsCount() const { |
- const int offset = |
- StandardFrameConstants::kExpressionsOffset + kPointerSize; |
+ const int offsetStart = (is_java_script() && !is_optimized()) |
+ ? JavaScriptFrameConstants::kLocal0Offset |
+ : StandardFrameConstants::kExpressionsOffset; |
+ const int offset = offsetStart + kPointerSize; |
Address base = fp() + offset; |
Address limit = sp(); |
DCHECK(base >= limit); // stack grows downwards |
@@ -616,8 +620,9 @@ void StandardFrame::IterateCompiledFrame(ObjectVisitor* v) const { |
// Visit the outgoing parameters. |
Object** parameters_base = &Memory::Object_at(sp()); |
- Object** parameters_limit = &Memory::Object_at( |
- fp() + JavaScriptFrameConstants::kFunctionOffset - slot_space); |
+ Object** parameters_limit = |
+ &Memory::Object_at(fp() + StandardFrameConstants::kMarkerOffset - |
+ slot_space); |
// Visit the parameters that may be on top of the saved registers. |
if (safepoint_entry.argument_count() > 0) { |
@@ -717,7 +722,7 @@ bool JavaScriptFrame::IsConstructor() const { |
int JavaScriptFrame::GetArgumentsLength() const { |
// If there is an arguments adaptor frame get the arguments length from it. |
if (has_adapted_arguments()) { |
- return Smi::cast(GetExpression(caller_fp(), 0))->value(); |
+ return ArgumentsAdaptorFrame::GetArgumentsLength(caller_fp()); |
} else { |
return GetNumberOfIncomingArguments(); |
} |
@@ -1073,6 +1078,11 @@ void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { |
} |
+int ArgumentsAdaptorFrame::GetArgumentsLength(Address fp) { |
+ return Smi::cast(GetStandardFrameExpression(fp, 0))->value(); |
+} |
+ |
+ |
int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { |
return Smi::cast(GetExpression(0))->value(); |
} |