Commit 59d08247 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[compiler] Remove CompilationInfo::abstract_code accessor.

In the long run we do not want to rely on compilation results being
available on the CompilationInfo. This removes the accessor for the
abstract code, which is very inviting to be used outside of compilation
pipeline.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1903723002

Cr-Commit-Position: refs/heads/master@{#35653}
parent 89606003
...@@ -447,18 +447,18 @@ void OptimizedCompileJob::RecordOptimizationStats() { ...@@ -447,18 +447,18 @@ void OptimizedCompileJob::RecordOptimizationStats() {
namespace { namespace {
void RecordFunctionCompilation(Logger::LogEventsAndTags tag, void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
CompilationInfo* info, CompilationInfo* info) {
Handle<SharedFunctionInfo> shared) {
// SharedFunctionInfo is passed separately, because if CompilationInfo
// was created using Script object, it will not have it.
// Log the code generation. If source information is available include // Log the code generation. If source information is available include
// script name and line number. Check explicitly whether logging is // script name and line number. Check explicitly whether logging is
// enabled as finding the line number is not free. // enabled as finding the line number is not free.
if (info->isolate()->logger()->is_logging_code_events() || if (info->isolate()->logger()->is_logging_code_events() ||
info->isolate()->cpu_profiler()->is_profiling()) { info->isolate()->cpu_profiler()->is_profiling()) {
Handle<SharedFunctionInfo> shared = info->shared_info();
Handle<Script> script = info->parse_info()->script(); Handle<Script> script = info->parse_info()->script();
Handle<AbstractCode> abstract_code = info->abstract_code(); Handle<AbstractCode> abstract_code =
info->has_bytecode_array()
? Handle<AbstractCode>::cast(info->bytecode_array())
: Handle<AbstractCode>::cast(info->code());
if (abstract_code.is_identical_to( if (abstract_code.is_identical_to(
info->isolate()->builtins()->CompileLazy())) { info->isolate()->builtins()->CompileLazy())) {
return; return;
...@@ -588,7 +588,7 @@ MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) { ...@@ -588,7 +588,7 @@ MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) {
// Compile either unoptimized code or bytecode for the interpreter. // Compile either unoptimized code or bytecode for the interpreter.
if (!CompileBaselineCode(info)) return MaybeHandle<Code>(); if (!CompileBaselineCode(info)) return MaybeHandle<Code>();
RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info);
// Update the shared function info with the scope info. // Update the shared function info with the scope info.
InstallSharedScopeInfo(info, shared); InstallSharedScopeInfo(info, shared);
...@@ -729,8 +729,7 @@ bool GetOptimizedCodeNow(CompilationInfo* info) { ...@@ -729,8 +729,7 @@ bool GetOptimizedCodeNow(CompilationInfo* info) {
job->RecordOptimizationStats(); job->RecordOptimizationStats();
DCHECK(!isolate->has_pending_exception()); DCHECK(!isolate->has_pending_exception());
InsertCodeIntoOptimizedCodeMap(info); InsertCodeIntoOptimizedCodeMap(info);
RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info);
info->shared_info());
return true; return true;
} }
...@@ -1031,7 +1030,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { ...@@ -1031,7 +1030,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
? Logger::EVAL_TAG ? Logger::EVAL_TAG
: Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script);
PROFILE(isolate, CodeCreateEvent(log_tag, *info->abstract_code(), *result, PROFILE(isolate, CodeCreateEvent(log_tag, result->abstract_code(), *result,
info, *script_name)); info, *script_name));
if (!script.is_null()) if (!script.is_null())
...@@ -1220,7 +1219,7 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { ...@@ -1220,7 +1219,7 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
} }
// The existing unoptimized code was replaced with the new one. // The existing unoptimized code was replaced with the new one.
RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, &unoptimized, shared); RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, &unoptimized);
} }
return true; return true;
} }
...@@ -1548,7 +1547,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( ...@@ -1548,7 +1547,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
} }
if (maybe_existing.is_null()) { if (maybe_existing.is_null()) {
RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); RecordFunctionCompilation(Logger::FUNCTION_TAG, &info);
live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); live_edit_tracker.RecordFunctionInfo(result, literal, info.zone());
} }
...@@ -1622,7 +1621,7 @@ void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) { ...@@ -1622,7 +1621,7 @@ void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) {
job->RetryOptimization(kBailedOutDueToDependencyChange); job->RetryOptimization(kBailedOutDueToDependencyChange);
} else if (job->GenerateCode() == OptimizedCompileJob::SUCCEEDED) { } else if (job->GenerateCode() == OptimizedCompileJob::SUCCEEDED) {
job->RecordOptimizationStats(); job->RecordOptimizationStats();
RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info.get(), shared); RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info.get());
if (shared->SearchOptimizedCodeMap(info->context()->native_context(), if (shared->SearchOptimizedCodeMap(info->context()->native_context(),
info->osr_ast_id()).code == nullptr) { info->osr_ast_id()).code == nullptr) {
InsertCodeIntoOptimizedCodeMap(info.get()); InsertCodeIntoOptimizedCodeMap(info.get());
......
...@@ -207,11 +207,6 @@ class CompilationInfo { ...@@ -207,11 +207,6 @@ class CompilationInfo {
bool has_bytecode_array() const { return !bytecode_array_.is_null(); } bool has_bytecode_array() const { return !bytecode_array_.is_null(); }
Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; } Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; }
Handle<AbstractCode> abstract_code() const {
return has_bytecode_array() ? Handle<AbstractCode>::cast(bytecode_array())
: Handle<AbstractCode>::cast(code());
}
bool is_tracking_positions() const { return track_positions_; } bool is_tracking_positions() const { return track_positions_; }
bool is_calling() const { bool is_calling() const {
......
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