[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:
mstarzinger 2016-05-13 02:44:52 -07:00 committed by Commit bot
parent 29001f44fc
commit c3cf2607f6
10 changed files with 27 additions and 30 deletions

View File

@ -401,7 +401,7 @@ void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
: info->isolate()->heap()->empty_string();
Logger::LogEventsAndTags log_tag = Logger::ToNativeByScript(tag, *script);
PROFILE(info->isolate(),
CodeCreateEvent(log_tag, *abstract_code, *shared, info, script_name,
CodeCreateEvent(log_tag, *abstract_code, *shared, script_name,
line_num, column_num));
}
}

View File

@ -15,7 +15,7 @@ namespace internal {
// Forward declarations.
class BitVector;
class CompilationInfo;
namespace compiler {

View File

@ -12,8 +12,9 @@
namespace v8 {
namespace internal {
class Variable;
class CompilationInfo;
class Scope;
class Variable;
namespace compiler {

View File

@ -2722,7 +2722,7 @@ static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
Handle<SharedFunctionInfo> shared =
isolate->factory()->NewSharedFunctionInfo(name_str, code, false);
PROFILE(isolate, CodeCreateEvent(tag, AbstractCode::cast(*code), *shared,
info, *script_str, 0, 0));
*script_str, 0, 0));
}
}

View File

@ -11,6 +11,9 @@
namespace v8 {
namespace internal {
class CompilationInfo;
namespace interpreter {
class LoopBuilder;

View File

@ -189,8 +189,7 @@ void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag,
void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag,
AbstractCode* code,
SharedFunctionInfo* shared,
CompilationInfo* info, Name* source,
SharedFunctionInfo* shared, Name* source,
int line, int column) {
name_buffer_->Init(tag);
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
// to leave logging functions free from heap allocations.
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared, CompilationInfo* info,
Name* source, int line, int column) {
PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line, column));
SharedFunctionInfo* shared, Name* source, int line,
int column) {
PROFILER_LOG(CodeCreateEvent(tag, code, shared, source, line, column));
if (!is_logging_code_events()) return;
CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, source, line,
column));
CALL_LISTENERS(CodeCreateEvent(tag, code, shared, source, line, column));
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
@ -1616,8 +1614,7 @@ void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
PROFILE(isolate_,
CodeCreateEvent(
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
*code, *shared, NULL,
*script_name, line_num, column_num));
*code, *shared, *script_name, line_num, column_num));
} else {
// Can't distinguish eval and script here, so always use Script.
PROFILE(isolate_, CodeCreateEvent(Logger::ToNativeByScript(
@ -1628,8 +1625,8 @@ void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
PROFILE(isolate_,
CodeCreateEvent(
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
*code, *shared, NULL,
isolate_->heap()->empty_string(), line_num, column_num));
*code, *shared, isolate_->heap()->empty_string(), line_num,
column_num));
}
} else if (shared->IsApiFunction()) {
// API function.

View File

@ -57,7 +57,6 @@ namespace internal {
// Forward declarations.
class CodeEventListener;
class CompilationInfo;
class CpuProfiler;
class Isolate;
class Log;
@ -226,8 +225,8 @@ class Logger {
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared, Name* name);
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared, CompilationInfo* info,
Name* source, int line, int column);
SharedFunctionInfo* shared, Name* source, int line,
int column);
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
int args_count);
// Emits a code deoptimization event.
@ -470,9 +469,8 @@ class CodeEventListener {
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared, Name* name) = 0;
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared,
CompilationInfo* info, Name* source, int line,
int column) = 0;
SharedFunctionInfo* shared, Name* source,
int line, int column) = 0;
virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
int args_count) = 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,
SharedFunctionInfo* shared, Name* name) override;
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared, CompilationInfo* info,
Name* source, int line, int column) override;
SharedFunctionInfo* shared, Name* source, int line,
int column) override;
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override;
void CallbackEvent(Name* name, Address entry_point) override {}

View File

@ -260,8 +260,7 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
AbstractCode* abstract_code,
SharedFunctionInfo* shared,
CompilationInfo* info, Name* script_name,
SharedFunctionInfo* shared, Name* script_name,
int line, int column) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;

View File

@ -20,7 +20,6 @@ namespace internal {
// Forward declarations.
class CodeEntry;
class CodeMap;
class CompilationInfo;
class CpuProfile;
class CpuProfilesCollection;
class ProfileGenerator;
@ -228,8 +227,8 @@ class CpuProfiler : public CodeEventListener {
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared, Name* script_name) override;
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
SharedFunctionInfo* shared, CompilationInfo* info,
Name* script_name, int line, int column) override;
SharedFunctionInfo* shared, Name* script_name, int line,
int column) override;
void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
int args_count) override;
void CodeMovingGCEvent() override {}

View File

@ -1033,8 +1033,8 @@ static void TickLines(bool optimize) {
i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name);
int line = 1;
int column = 1;
profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, func->shared(), NULL,
*str, line, column);
profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, func->shared(), *str,
line, column);
// Enqueue a tick event to enable code events processing.
EnqueueTickSampleEvent(processor.get(), code_address);