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

Unified Diff: src/frames.cc

Issue 2134093002: [builtins] Show builtin frames in PrintStack() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Print frame kind Created 4 years, 5 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/frames-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index d14646989ebfb71161bccd93a67a2ae53e742d1f..f06a9c813bd134a5b7116d781c5f42c98cf2f37e 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -657,6 +657,46 @@ 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);
+ accumulator->Add("builtin exit frame: ");
+ 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();
+ 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,15 +1417,14 @@ 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();
}
+void BuiltinFrame::PrintFrameKind(StringStream* accumulator) const {
+ accumulator->Add("builtin frame: ");
+}
+
Address InternalFrame::GetCallerStackPointer() const {
// Internal frames have no arguments. The stack pointer of the
// caller is at a fixed offset from the frame pointer.
@@ -1466,6 +1505,7 @@ void JavaScriptFrame::Print(StringStream* accumulator,
accumulator->PrintSecurityTokenIfChanged(function);
PrintIndex(accumulator, mode, index);
+ PrintFrameKind(accumulator);
Code* code = NULL;
if (IsConstructor()) accumulator->Add("new ");
accumulator->PrintFunction(function, receiver, &code);
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698