Commit 43dc9d5f authored by ishell@chromium.org's avatar ishell@chromium.org Committed by V8 LUCI CQ

[cleanup] Cleanup StringStream::PrintFunction()

... by removing the unused Code* argument.

Bug: v8:11880
Change-Id: Icec0c448e844a371ec1751a30419f79dc11876d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3777717
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81868}
parent 9e45c433
...@@ -987,9 +987,8 @@ void BuiltinExitFrame::Print(StringStream* accumulator, PrintMode mode, ...@@ -987,9 +987,8 @@ void BuiltinExitFrame::Print(StringStream* accumulator, PrintMode mode,
accumulator->PrintSecurityTokenIfChanged(function); accumulator->PrintSecurityTokenIfChanged(function);
PrintIndex(accumulator, mode, index); PrintIndex(accumulator, mode, index);
accumulator->Add("builtin exit frame: "); accumulator->Add("builtin exit frame: ");
Code code;
if (IsConstructor()) accumulator->Add("new "); if (IsConstructor()) accumulator->Add("new ");
accumulator->PrintFunction(function, receiver, &code); accumulator->PrintFunction(function, receiver);
accumulator->Add("(this=%o", receiver); accumulator->Add("(this=%o", receiver);
...@@ -2364,9 +2363,8 @@ void WasmCompileLazyFrame::Iterate(RootVisitor* v) const { ...@@ -2364,9 +2363,8 @@ void WasmCompileLazyFrame::Iterate(RootVisitor* v) const {
namespace { namespace {
void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo shared, void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo shared) {
Code code) { if (FLAG_max_stack_trace_source_length != 0) {
if (FLAG_max_stack_trace_source_length != 0 && !code.is_null()) {
std::ostringstream os; std::ostringstream os;
os << "--------- s o u r c e c o d e ---------\n" os << "--------- s o u r c e c o d e ---------\n"
<< SourceCodeOf(shared, FLAG_max_stack_trace_source_length) << SourceCodeOf(shared, FLAG_max_stack_trace_source_length)
...@@ -2389,9 +2387,8 @@ void JavaScriptFrame::Print(StringStream* accumulator, PrintMode mode, ...@@ -2389,9 +2387,8 @@ void JavaScriptFrame::Print(StringStream* accumulator, PrintMode mode,
accumulator->PrintSecurityTokenIfChanged(function); accumulator->PrintSecurityTokenIfChanged(function);
PrintIndex(accumulator, mode, index); PrintIndex(accumulator, mode, index);
PrintFrameKind(accumulator); PrintFrameKind(accumulator);
Code code;
if (IsConstructor()) accumulator->Add("new "); if (IsConstructor()) accumulator->Add("new ");
accumulator->PrintFunction(function, receiver, &code); accumulator->PrintFunction(function, receiver);
accumulator->Add(" [%p]", function); accumulator->Add(" [%p]", function);
// Get scope information for nicer output, if possible. If code is nullptr, or // Get scope information for nicer output, if possible. If code is nullptr, or
...@@ -2437,7 +2434,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, PrintMode mode, ...@@ -2437,7 +2434,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, PrintMode mode,
} }
if (is_optimized()) { if (is_optimized()) {
accumulator->Add(" {\n// optimized frame\n"); accumulator->Add(" {\n// optimized frame\n");
PrintFunctionSource(accumulator, *shared, code); PrintFunctionSource(accumulator, *shared);
accumulator->Add("}\n"); accumulator->Add("}\n");
return; return;
} }
...@@ -2487,7 +2484,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, PrintMode mode, ...@@ -2487,7 +2484,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, PrintMode mode,
accumulator->Add(" [%02d] : %o\n", i, GetExpression(i)); accumulator->Add(" [%02d] : %o\n", i, GetExpression(i));
} }
PrintFunctionSource(accumulator, *shared, code); PrintFunctionSource(accumulator, *shared);
accumulator->Add("}\n\n"); accumulator->Add("}\n\n");
} }
......
...@@ -406,9 +406,8 @@ void StringStream::PrintSecurityTokenIfChanged(JSFunction fun) { ...@@ -406,9 +406,8 @@ void StringStream::PrintSecurityTokenIfChanged(JSFunction fun) {
} }
} }
void StringStream::PrintFunction(JSFunction fun, Object receiver, Code* code) { void StringStream::PrintFunction(JSFunction fun, Object receiver) {
PrintPrototype(fun, receiver); PrintPrototype(fun, receiver);
*code = FromCodeT(fun.code());
} }
void StringStream::PrintPrototype(JSFunction fun, Object receiver) { void StringStream::PrintPrototype(JSFunction fun, Object receiver) {
......
...@@ -181,8 +181,7 @@ class StringStream final { ...@@ -181,8 +181,7 @@ class StringStream final {
void PrintUsingMap(JSObject js_object); void PrintUsingMap(JSObject js_object);
void PrintPrototype(JSFunction fun, Object receiver); void PrintPrototype(JSFunction fun, Object receiver);
void PrintSecurityTokenIfChanged(JSFunction function); void PrintSecurityTokenIfChanged(JSFunction function);
// NOTE: Returns the code in the output parameter. void PrintFunction(JSFunction function, Object receiver);
void PrintFunction(JSFunction function, Object receiver, Code* code);
// Reset the stream. // Reset the stream.
void Reset() { void Reset() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment