[compiler] Avoid passing CompilationInfo to profiler.
This completely removes any potential for a side-channel between the various compiler backends and the profiler. The CompilationInfo is no longer passed. R=yangguo@chromium.org Review-Url: https://codereview.chromium.org/1970193002 Cr-Commit-Position: refs/heads/master@{#36230}
This commit is contained in:
parent
29001f44fc
commit
c3cf2607f6
@ -401,7 +401,7 @@ void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
|
|||||||
: info->isolate()->heap()->empty_string();
|
: info->isolate()->heap()->empty_string();
|
||||||
Logger::LogEventsAndTags log_tag = Logger::ToNativeByScript(tag, *script);
|
Logger::LogEventsAndTags log_tag = Logger::ToNativeByScript(tag, *script);
|
||||||
PROFILE(info->isolate(),
|
PROFILE(info->isolate(),
|
||||||
CodeCreateEvent(log_tag, *abstract_code, *shared, info, script_name,
|
CodeCreateEvent(log_tag, *abstract_code, *shared, script_name,
|
||||||
line_num, column_num));
|
line_num, column_num));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace internal {
|
|||||||
|
|
||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
class BitVector;
|
class BitVector;
|
||||||
|
class CompilationInfo;
|
||||||
|
|
||||||
namespace compiler {
|
namespace compiler {
|
||||||
|
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
class Variable;
|
class CompilationInfo;
|
||||||
class Scope;
|
class Scope;
|
||||||
|
class Variable;
|
||||||
|
|
||||||
namespace compiler {
|
namespace compiler {
|
||||||
|
|
||||||
|
@ -2722,7 +2722,7 @@ static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
|
|||||||
Handle<SharedFunctionInfo> shared =
|
Handle<SharedFunctionInfo> shared =
|
||||||
isolate->factory()->NewSharedFunctionInfo(name_str, code, false);
|
isolate->factory()->NewSharedFunctionInfo(name_str, code, false);
|
||||||
PROFILE(isolate, CodeCreateEvent(tag, AbstractCode::cast(*code), *shared,
|
PROFILE(isolate, CodeCreateEvent(tag, AbstractCode::cast(*code), *shared,
|
||||||
info, *script_str, 0, 0));
|
*script_str, 0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
class CompilationInfo;
|
||||||
|
|
||||||
namespace interpreter {
|
namespace interpreter {
|
||||||
|
|
||||||
class LoopBuilder;
|
class LoopBuilder;
|
||||||
|
19
src/log.cc
19
src/log.cc
@ -189,8 +189,7 @@ void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag,
|
|||||||
|
|
||||||
void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag,
|
void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag,
|
||||||
AbstractCode* code,
|
AbstractCode* code,
|
||||||
SharedFunctionInfo* shared,
|
SharedFunctionInfo* shared, Name* source,
|
||||||
CompilationInfo* info, Name* source,
|
|
||||||
int line, int column) {
|
int line, int column) {
|
||||||
name_buffer_->Init(tag);
|
name_buffer_->Init(tag);
|
||||||
name_buffer_->AppendBytes(ComputeMarker(shared, code));
|
name_buffer_->AppendBytes(ComputeMarker(shared, code));
|
||||||
@ -1150,13 +1149,12 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
|||||||
// the SharedFunctionInfo object, we left it to caller
|
// the SharedFunctionInfo object, we left it to caller
|
||||||
// to leave logging functions free from heap allocations.
|
// to leave logging functions free from heap allocations.
|
||||||
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, CompilationInfo* info,
|
SharedFunctionInfo* shared, Name* source, int line,
|
||||||
Name* source, int line, int column) {
|
int column) {
|
||||||
PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line, column));
|
PROFILER_LOG(CodeCreateEvent(tag, code, shared, source, line, column));
|
||||||
|
|
||||||
if (!is_logging_code_events()) return;
|
if (!is_logging_code_events()) return;
|
||||||
CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, source, line,
|
CALL_LISTENERS(CodeCreateEvent(tag, code, shared, source, line, column));
|
||||||
column));
|
|
||||||
|
|
||||||
if (!FLAG_log_code || !log_->IsEnabled()) return;
|
if (!FLAG_log_code || !log_->IsEnabled()) return;
|
||||||
Log::MessageBuilder msg(log_);
|
Log::MessageBuilder msg(log_);
|
||||||
@ -1616,8 +1614,7 @@ void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
|
|||||||
PROFILE(isolate_,
|
PROFILE(isolate_,
|
||||||
CodeCreateEvent(
|
CodeCreateEvent(
|
||||||
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
|
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
|
||||||
*code, *shared, NULL,
|
*code, *shared, *script_name, line_num, column_num));
|
||||||
*script_name, line_num, column_num));
|
|
||||||
} else {
|
} else {
|
||||||
// Can't distinguish eval and script here, so always use Script.
|
// Can't distinguish eval and script here, so always use Script.
|
||||||
PROFILE(isolate_, CodeCreateEvent(Logger::ToNativeByScript(
|
PROFILE(isolate_, CodeCreateEvent(Logger::ToNativeByScript(
|
||||||
@ -1628,8 +1625,8 @@ void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
|
|||||||
PROFILE(isolate_,
|
PROFILE(isolate_,
|
||||||
CodeCreateEvent(
|
CodeCreateEvent(
|
||||||
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
|
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
|
||||||
*code, *shared, NULL,
|
*code, *shared, isolate_->heap()->empty_string(), line_num,
|
||||||
isolate_->heap()->empty_string(), line_num, column_num));
|
column_num));
|
||||||
}
|
}
|
||||||
} else if (shared->IsApiFunction()) {
|
} else if (shared->IsApiFunction()) {
|
||||||
// API function.
|
// API function.
|
||||||
|
14
src/log.h
14
src/log.h
@ -57,7 +57,6 @@ namespace internal {
|
|||||||
|
|
||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
class CodeEventListener;
|
class CodeEventListener;
|
||||||
class CompilationInfo;
|
|
||||||
class CpuProfiler;
|
class CpuProfiler;
|
||||||
class Isolate;
|
class Isolate;
|
||||||
class Log;
|
class Log;
|
||||||
@ -226,8 +225,8 @@ class Logger {
|
|||||||
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, Name* name);
|
SharedFunctionInfo* shared, Name* name);
|
||||||
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, CompilationInfo* info,
|
SharedFunctionInfo* shared, Name* source, int line,
|
||||||
Name* source, int line, int column);
|
int column);
|
||||||
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
|
||||||
int args_count);
|
int args_count);
|
||||||
// Emits a code deoptimization event.
|
// Emits a code deoptimization event.
|
||||||
@ -470,9 +469,8 @@ class CodeEventListener {
|
|||||||
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, Name* name) = 0;
|
SharedFunctionInfo* shared, Name* name) = 0;
|
||||||
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared,
|
SharedFunctionInfo* shared, Name* source,
|
||||||
CompilationInfo* info, Name* source, int line,
|
int line, int column) = 0;
|
||||||
int column) = 0;
|
|
||||||
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
int args_count) = 0;
|
int args_count) = 0;
|
||||||
virtual void CallbackEvent(Name* name, Address entry_point) = 0;
|
virtual void CallbackEvent(Name* name, Address entry_point) = 0;
|
||||||
@ -501,8 +499,8 @@ class CodeEventLogger : public CodeEventListener {
|
|||||||
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, Name* name) override;
|
SharedFunctionInfo* shared, Name* name) override;
|
||||||
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, CompilationInfo* info,
|
SharedFunctionInfo* shared, Name* source, int line,
|
||||||
Name* source, int line, int column) override;
|
int column) override;
|
||||||
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override;
|
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override;
|
||||||
|
|
||||||
void CallbackEvent(Name* name, Address entry_point) override {}
|
void CallbackEvent(Name* name, Address entry_point) override {}
|
||||||
|
@ -260,8 +260,7 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
|
|||||||
|
|
||||||
void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
|
void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
|
||||||
AbstractCode* abstract_code,
|
AbstractCode* abstract_code,
|
||||||
SharedFunctionInfo* shared,
|
SharedFunctionInfo* shared, Name* script_name,
|
||||||
CompilationInfo* info, Name* script_name,
|
|
||||||
int line, int column) {
|
int line, int column) {
|
||||||
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
|
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
|
||||||
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
|
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
|
||||||
|
@ -20,7 +20,6 @@ namespace internal {
|
|||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
class CodeEntry;
|
class CodeEntry;
|
||||||
class CodeMap;
|
class CodeMap;
|
||||||
class CompilationInfo;
|
|
||||||
class CpuProfile;
|
class CpuProfile;
|
||||||
class CpuProfilesCollection;
|
class CpuProfilesCollection;
|
||||||
class ProfileGenerator;
|
class ProfileGenerator;
|
||||||
@ -228,8 +227,8 @@ class CpuProfiler : public CodeEventListener {
|
|||||||
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, Name* script_name) override;
|
SharedFunctionInfo* shared, Name* script_name) override;
|
||||||
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
SharedFunctionInfo* shared, CompilationInfo* info,
|
SharedFunctionInfo* shared, Name* script_name, int line,
|
||||||
Name* script_name, int line, int column) override;
|
int column) override;
|
||||||
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
|
||||||
int args_count) override;
|
int args_count) override;
|
||||||
void CodeMovingGCEvent() override {}
|
void CodeMovingGCEvent() override {}
|
||||||
|
@ -1033,8 +1033,8 @@ static void TickLines(bool optimize) {
|
|||||||
i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name);
|
i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name);
|
||||||
int line = 1;
|
int line = 1;
|
||||||
int column = 1;
|
int column = 1;
|
||||||
profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, func->shared(), NULL,
|
profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, func->shared(), *str,
|
||||||
*str, line, column);
|
line, column);
|
||||||
|
|
||||||
// Enqueue a tick event to enable code events processing.
|
// Enqueue a tick event to enable code events processing.
|
||||||
EnqueueTickSampleEvent(processor.get(), code_address);
|
EnqueueTickSampleEvent(processor.get(), code_address);
|
||||||
|
Loading…
Reference in New Issue
Block a user