Commit 7dc828b2 authored by Bret Sepulveda's avatar Bret Sepulveda Committed by Commit Bot

Stop logging Builtin functions as LazyCompile.

Builtin functions were being logged via both LogCodeObjects and
LogCompiledFunctions. The latter assumes the code in question has a
Name and so would end up logging an unattributable entry. This patch
stops logging that entry.

Bug: v8:8061
Change-Id: I20e5a853b8a214a91191fa644083bac7af9dc2c4
Reviewed-on: https://chromium-review.googlesource.com/1177759Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55302}
parent 9fa50159
......@@ -2231,9 +2231,6 @@ void ExistingCodeLogger::LogExistingFunction(
#endif
CALL_CODE_EVENT_HANDLER(CallbackEvent(shared->DebugName(), entry_point))
}
} else {
CALL_CODE_EVENT_HANDLER(CodeCreateEvent(
tag, *code, *shared, ReadOnlyRoots(isolate_).empty_string()))
}
}
......
......@@ -30,6 +30,7 @@
#include <unordered_set>
#include <vector>
#include "src/api-inl.h"
#include "src/builtins/builtins.h"
#include "src/log-utils.h"
#include "src/log.h"
#include "src/objects-inl.h"
......@@ -164,6 +165,7 @@ class ScopedLoggerInitializer {
return result;
}
void LogCodeObjects() { logger_->LogCodeObjects(); }
void LogCompiledFunctions() { logger_->LogCompiledFunctions(); }
void StringEvent(const char* name, const char* value) {
......@@ -889,3 +891,29 @@ TEST(LogFunctionEvents) {
i::FLAG_log_function_events = false;
isolate->Dispose();
}
TEST(BuiltinsNotLoggedAsLazyCompile) {
SETUP_FLAGS();
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
logger.LogCodeObjects();
logger.LogCompiledFunctions();
logger.StopLogging();
i::EmbeddedVector<char, 100> address_buffer;
i::Handle<i::Code> builtin = logger.i_isolate()->builtins()->builtin_handle(
i::Builtins::kStringPrototypeToLowerCaseIntl);
i::SNPrintF(address_buffer, ",0x%" V8PRIxPTR ",%d,",
builtin->InstructionStart(), builtin->InstructionSize());
std::string address(address_buffer.start());
// Should only be logged as "Builtin", not as "LazyCompile".
CHECK(logger.ContainsLine({"code-creation,Builtin,3,", address}));
CHECK(!logger.ContainsLine({"code-creation,LazyCompile,3,", address}));
}
isolate->Dispose();
}
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