Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index d81d5afaaa7370f4198afb8881d91a6bfd73c020..4e67463f1fb75c31e29d32d39480470944c58c06 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -528,6 +528,17 @@ Address StandardFrame::GetExpressionAddress(int n) const { |
} |
+Object* StandardFrame::GetExpression(Address fp, int index) { |
+ return Memory::Object_at(GetExpressionAddress(fp, index)); |
+} |
+ |
+ |
+Address StandardFrame::GetExpressionAddress(Address fp, int n) { |
+ const int offset = StandardFrameConstants::kExpressionsOffset; |
+ return fp + offset - n * kPointerSize; |
+} |
+ |
+ |
int StandardFrame::ComputeExpressionsCount() const { |
const int offset = |
StandardFrameConstants::kExpressionsOffset + kPointerSize; |
@@ -646,6 +657,16 @@ 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(); |
+ } else { |
+ return GetNumberOfIncomingArguments(); |
+ } |
+} |
+ |
+ |
Code* JavaScriptFrame::unchecked_code() const { |
JSFunction* function = JSFunction::cast(this->function()); |
return function->unchecked_code(); |
@@ -812,6 +833,22 @@ DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData( |
} |
+int OptimizedFrame::GetInlineCount() { |
+ ASSERT(is_optimized()); |
+ |
+ int deopt_index = Safepoint::kNoDeoptimizationIndex; |
+ DeoptimizationInputData* data = GetDeoptimizationData(&deopt_index); |
+ |
+ TranslationIterator it(data->TranslationByteArray(), |
+ data->TranslationIndex(deopt_index)->value()); |
+ Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
+ ASSERT(opcode == Translation::BEGIN); |
+ USE(opcode); |
+ int frame_count = it.Next(); |
+ return frame_count; |
+} |
+ |
+ |
void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) { |
ASSERT(functions->length() == 0); |
ASSERT(is_optimized()); |