Commit 152c93d8 authored by Bret Sepulveda's avatar Bret Sepulveda Committed by Commit Bot

Stop logging Builtin functions as LazyCompile (reland).

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: Iebc9bfa9618986afdbf8b1b71b64bf17a1f4196a
Reviewed-on: https://chromium-review.googlesource.com/1184923Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55379}
parent 93d03643
......@@ -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,33 @@ 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::Handle<i::Code> builtin = logger.i_isolate()->builtins()->builtin_handle(
i::Builtins::kBooleanConstructor);
i::EmbeddedVector<char, 100> buffer;
// Should only be logged as "Builtin" with a name, never as "LazyCompile".
i::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,BooleanConstructor",
builtin->InstructionStart(), builtin->InstructionSize());
CHECK(logger.ContainsLine(
{"code-creation,Builtin,3,", std::string(buffer.start())}));
i::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,", builtin->InstructionStart(),
builtin->InstructionSize());
CHECK(!logger.ContainsLine(
{"code-creation,LazyCompile,3,", std::string(buffer.start())}));
}
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