Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index d14646989ebfb71161bccd93a67a2ae53e742d1f..4129e6bbd491e2f7ee147d4d541ed6351ec023d8 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -657,6 +657,45 @@ bool BuiltinExitFrame::IsConstructor() const { |
return !new_target_slot_object()->IsUndefined(isolate()); |
} |
+Object* BuiltinExitFrame::GetParameter(int i) const { |
+ DCHECK(i >= 0 && i < ComputeParametersCount()); |
+ int offset = BuiltinExitFrameConstants::kArgcOffset + (i + 1) * kPointerSize; |
+ return Memory::Object_at(fp() + offset); |
+} |
+ |
+int BuiltinExitFrame::ComputeParametersCount() const { |
+ Object* argc_slot = argc_slot_object(); |
+ DCHECK(argc_slot->IsSmi()); |
+ // Argc also counts the receiver, target, new target, and argc itself as args, |
+ // therefore the real argument count is argc - 4. |
+ int argc = Smi::cast(argc_slot)->value() - 4; |
+ DCHECK(argc >= 0); |
+ return argc; |
+} |
+ |
+void BuiltinExitFrame::Print(StringStream* accumulator, PrintMode mode, |
+ int index) const { |
+ DisallowHeapAllocation no_gc; |
+ Object* receiver = this->receiver(); |
+ JSFunction* function = this->function(); |
+ |
+ accumulator->PrintSecurityTokenIfChanged(function); |
+ PrintIndex(accumulator, mode, index); |
+ Code* code = NULL; |
+ if (IsConstructor()) accumulator->Add("new "); |
+ accumulator->PrintFunction(function, receiver, &code); |
+ |
+ accumulator->Add("(this=%o", receiver); |
+ |
+ // Print the parameters. |
+ int parameters_count = ComputeParametersCount(); |
Yang
2016/07/11 10:24:32
Let's only print up to, let's say, 5 parameters.
|
+ for (int i = 0; i < parameters_count; i++) { |
+ accumulator->Add(",%o", GetParameter(i)); |
+ } |
+ |
+ accumulator->Add(")\n\n"); |
+} |
+ |
Address StandardFrame::GetExpressionAddress(int n) const { |
const int offset = StandardFrameConstants::kExpressionsOffset; |
return fp() + offset - n * kPointerSize; |
@@ -1377,11 +1416,6 @@ Code* ArgumentsAdaptorFrame::unchecked_code() const { |
Builtins::kArgumentsAdaptorTrampoline); |
} |
-void BuiltinFrame::Print(StringStream* accumulator, PrintMode mode, |
- int index) const { |
- // TODO(bmeurer) |
-} |
- |
int BuiltinFrame::GetNumberOfIncomingArguments() const { |
return Smi::cast(GetExpression(0))->value(); |
} |