Commit ec778f9a authored by henrika's avatar henrika Committed by V8 LUCI CQ

[logging][profiling] Log BytecodeHandler code in JIT loggers

Local tests on Windows using the --enable-system-instrumentation flag
in combination with ETW have shown that parts of the JS stack miss
symbols and most of these missing parts comes from
code-creation,Bytecodehandler events.

The CL fixes this issue.

Bug: v8:11043
Change-Id: I77b150742e689a4002dbc5937d6daa08a0795ab9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3574545Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Henrik Andreasson <henrika@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79858}
parent 6879c515
...@@ -1915,6 +1915,8 @@ void Logger::LogCompiledFunctions() { ...@@ -1915,6 +1915,8 @@ void Logger::LogCompiledFunctions() {
existing_code_logger_.LogCompiledFunctions(); existing_code_logger_.LogCompiledFunctions();
} }
void Logger::LogBuiltins() { existing_code_logger_.LogBuiltins(); }
void Logger::LogAccessorCallbacks() { void Logger::LogAccessorCallbacks() {
Heap* heap = isolate_->heap(); Heap* heap = isolate_->heap();
HeapObjectIterator iterator(heap); HeapObjectIterator iterator(heap);
...@@ -2066,6 +2068,7 @@ void Logger::SetCodeEventHandler(uint32_t options, ...@@ -2066,6 +2068,7 @@ void Logger::SetCodeEventHandler(uint32_t options,
if (options & kJitCodeEventEnumExisting) { if (options & kJitCodeEventEnumExisting) {
HandleScope scope(isolate_); HandleScope scope(isolate_);
LogCodeObjects(); LogCodeObjects();
LogBuiltins();
LogCompiledFunctions(); LogCompiledFunctions();
} }
} }
...@@ -2138,8 +2141,6 @@ void ExistingCodeLogger::LogCodeObject(Object object) { ...@@ -2138,8 +2141,6 @@ void ExistingCodeLogger::LogCodeObject(Object object) {
case CodeKind::BASELINE: case CodeKind::BASELINE:
case CodeKind::MAGLEV: case CodeKind::MAGLEV:
return; // We log this later using LogCompiledFunctions. return; // We log this later using LogCompiledFunctions.
case CodeKind::BYTECODE_HANDLER:
return; // We log it later by walking the dispatch table.
case CodeKind::FOR_TESTING: case CodeKind::FOR_TESTING:
description = "STUB code"; description = "STUB code";
tag = CodeEventListener::STUB_TAG; tag = CodeEventListener::STUB_TAG;
...@@ -2148,6 +2149,11 @@ void ExistingCodeLogger::LogCodeObject(Object object) { ...@@ -2148,6 +2149,11 @@ void ExistingCodeLogger::LogCodeObject(Object object) {
description = "Regular expression code"; description = "Regular expression code";
tag = CodeEventListener::REG_EXP_TAG; tag = CodeEventListener::REG_EXP_TAG;
break; break;
case CodeKind::BYTECODE_HANDLER:
description =
isolate_->builtins()->name(abstract_code->GetCode().builtin_id());
tag = CodeEventListener::BYTECODE_HANDLER_TAG;
break;
case CodeKind::BUILTIN: case CodeKind::BUILTIN:
if (Code::cast(object).is_interpreter_trampoline_builtin() && if (Code::cast(object).is_interpreter_trampoline_builtin() &&
ToCodeT(Code::cast(object)) != ToCodeT(Code::cast(object)) !=
...@@ -2197,6 +2203,16 @@ void ExistingCodeLogger::LogCodeObjects() { ...@@ -2197,6 +2203,16 @@ void ExistingCodeLogger::LogCodeObjects() {
} }
} }
void ExistingCodeLogger::LogBuiltins() {
Builtins* builtins = isolate_->builtins();
DCHECK(builtins->is_initialized());
for (Builtin builtin = Builtins::kFirst; builtin <= Builtins::kLast;
++builtin) {
Code code = FromCodeT(builtins->code(builtin));
LogCodeObject(code);
}
}
void ExistingCodeLogger::LogCompiledFunctions() { void ExistingCodeLogger::LogCompiledFunctions() {
Heap* heap = isolate_->heap(); Heap* heap = isolate_->heap();
HandleScope scope(isolate_); HandleScope scope(isolate_);
......
...@@ -88,6 +88,7 @@ class ExistingCodeLogger { ...@@ -88,6 +88,7 @@ class ExistingCodeLogger {
: isolate_(isolate), listener_(listener) {} : isolate_(isolate), listener_(listener) {}
void LogCodeObjects(); void LogCodeObjects();
void LogBuiltins();
void LogCompiledFunctions(); void LogCompiledFunctions();
void LogExistingFunction(Handle<SharedFunctionInfo> shared, void LogExistingFunction(Handle<SharedFunctionInfo> shared,
...@@ -296,6 +297,7 @@ class Logger : public CodeEventListener { ...@@ -296,6 +297,7 @@ class Logger : public CodeEventListener {
V8_EXPORT_PRIVATE void LogAccessorCallbacks(); V8_EXPORT_PRIVATE void LogAccessorCallbacks();
// Used for logging stubs found in the snapshot. // Used for logging stubs found in the snapshot.
V8_EXPORT_PRIVATE void LogCodeObjects(); V8_EXPORT_PRIVATE void LogCodeObjects();
V8_EXPORT_PRIVATE void LogBuiltins();
// Logs all Maps found on the heap. // Logs all Maps found on the heap.
void LogAllMaps(); void LogAllMaps();
......
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