Commit 237f0f32 authored by Alexandre Talon's avatar Alexandre Talon Committed by Commit Bot

[Turbofan] Updating the name of a variable after removing the AstGraphBuilder

Since the AST graph builder is gone, no variable should be named osr_ast_id.
This CL replaces it with osr_offset. It designates the offset of the bytecode
where the OSRing was triggered.

Bug: 
Change-Id: Ia53a83b09f917fcd0174da685a18edd3ee3aa01f
Reviewed-on: https://chromium-review.googlesource.com/621008Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47566}
parent 94e1437f
......@@ -72,7 +72,7 @@ CompilationInfo::CompilationInfo(Handle<Script> script,
flags_(0),
code_flags_(code_flags),
mode_(mode),
osr_ast_id_(BailoutId::None()),
osr_offset_(BailoutId::None()),
zone_(zone),
deferred_handles_(nullptr),
dependencies_(isolate, zone),
......
......@@ -79,7 +79,7 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
Isolate* isolate() const { return isolate_; }
Zone* zone() { return zone_; }
bool is_osr() const { return !osr_ast_id_.IsNone(); }
bool is_osr() const { return !osr_offset_.IsNone(); }
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
void set_shared_info(Handle<SharedFunctionInfo> shared_info) {
shared_info_ = shared_info;
......@@ -88,7 +88,7 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
Handle<JSFunction> closure() const { return closure_; }
Handle<Code> code() const { return code_; }
Code::Flags code_flags() const { return code_flags_; }
BailoutId osr_ast_id() const { return osr_ast_id_; }
BailoutId osr_offset() const { return osr_offset_; }
JavaScriptFrame* osr_frame() const { return osr_frame_; }
int num_parameters() const;
int num_parameters_including_this() const;
......@@ -174,9 +174,9 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
bool IsOptimizing() const { return mode_ == OPTIMIZE; }
bool IsStub() const { return mode_ == STUB; }
bool IsWasm() const { return output_code_kind() == Code::WASM_FUNCTION; }
void SetOptimizingForOsr(BailoutId osr_ast_id, JavaScriptFrame* osr_frame) {
void SetOptimizingForOsr(BailoutId osr_offset, JavaScriptFrame* osr_frame) {
DCHECK(IsOptimizing());
osr_ast_id_ = osr_ast_id;
osr_offset_ = osr_offset;
osr_frame_ = osr_frame;
}
......@@ -316,7 +316,7 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
// Compilation mode flag and whether deoptimization is allowed.
Mode mode_;
BailoutId osr_ast_id_;
BailoutId osr_offset_;
// Holds the bytecode array generated by the interpreter.
// TODO(rmcilroy/mstarzinger): Temporary work-around until compiler.cc is
......
......@@ -466,13 +466,13 @@ bool FinalizeUnoptimizedCode(
}
MUST_USE_RESULT MaybeHandle<Code> GetCodeFromOptimizedCodeCache(
Handle<JSFunction> function, BailoutId osr_ast_id) {
Handle<JSFunction> function, BailoutId osr_offset) {
RuntimeCallTimerScope runtimeTimer(
function->GetIsolate(),
&RuntimeCallStats::CompileGetFromOptimizedCodeMap);
Handle<SharedFunctionInfo> shared(function->shared());
DisallowHeapAllocation no_gc;
if (osr_ast_id.IsNone()) {
if (osr_offset.IsNone()) {
if (function->feedback_vector_cell()->value()->IsFeedbackVector()) {
FeedbackVector* feedback_vector = function->feedback_vector();
feedback_vector->EvictOptimizedCodeMarkedForDeoptimization(
......@@ -492,7 +492,7 @@ MUST_USE_RESULT MaybeHandle<Code> GetCodeFromOptimizedCodeCache(
void ClearOptimizedCodeCache(CompilationInfo* compilation_info) {
Handle<JSFunction> function = compilation_info->closure();
if (compilation_info->osr_ast_id().IsNone()) {
if (compilation_info->osr_offset().IsNone()) {
Handle<FeedbackVector> vector =
handle(function->feedback_vector(), function->GetIsolate());
vector->ClearOptimizedCode();
......@@ -516,7 +516,7 @@ void InsertCodeIntoOptimizedCodeCache(CompilationInfo* compilation_info) {
Handle<JSFunction> function = compilation_info->closure();
Handle<SharedFunctionInfo> shared(function->shared());
Handle<Context> native_context(function->context()->native_context());
if (compilation_info->osr_ast_id().IsNone()) {
if (compilation_info->osr_offset().IsNone()) {
Handle<FeedbackVector> vector =
handle(function->feedback_vector(), function->GetIsolate());
FeedbackVector::SetOptimizedCode(vector, code);
......@@ -594,7 +594,7 @@ bool GetOptimizedCodeLater(CompilationJob* job) {
MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
ConcurrencyMode mode,
BailoutId osr_ast_id = BailoutId::None(),
BailoutId osr_offset = BailoutId::None(),
JavaScriptFrame* osr_frame = nullptr) {
Isolate* isolate = function->GetIsolate();
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
......@@ -606,13 +606,13 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
}
Handle<Code> cached_code;
if (GetCodeFromOptimizedCodeCache(function, osr_ast_id)
if (GetCodeFromOptimizedCodeCache(function, osr_offset)
.ToHandle(&cached_code)) {
if (FLAG_trace_opt) {
PrintF("[found optimized code for ");
function->ShortPrint();
if (!osr_ast_id.IsNone()) {
PrintF(" at OSR AST id %d", osr_ast_id.ToInt());
if (!osr_offset.IsNone()) {
PrintF(" at OSR AST id %d", osr_offset.ToInt());
}
PrintF("]\n");
}
......@@ -635,7 +635,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
CompilationInfo* compilation_info = job->compilation_info();
ParseInfo* parse_info = job->parse_info();
compilation_info->SetOptimizingForOsr(osr_ast_id, osr_frame);
compilation_info->SetOptimizingForOsr(osr_offset, osr_frame);
// Do not use TurboFan if we need to be able to set break points.
if (compilation_info->shared_info()->HasBreakInfo()) {
......@@ -1422,11 +1422,11 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForNative(
}
MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
BailoutId osr_ast_id,
BailoutId osr_offset,
JavaScriptFrame* osr_frame) {
DCHECK(!osr_ast_id.IsNone());
DCHECK(!osr_offset.IsNone());
DCHECK_NOT_NULL(osr_frame);
return GetOptimizedCode(function, ConcurrencyMode::kNotConcurrent, osr_ast_id,
return GetOptimizedCode(function, ConcurrencyMode::kNotConcurrent, osr_offset,
osr_frame);
}
......
......@@ -140,7 +140,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
// Generate and return optimized code for OSR, or empty handle on failure.
MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCodeForOSR(
Handle<JSFunction> function, BailoutId osr_ast_id,
Handle<JSFunction> function, BailoutId osr_offset,
JavaScriptFrame* osr_frame);
};
......
......@@ -474,7 +474,7 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint(
BytecodeGraphBuilder::BytecodeGraphBuilder(
Zone* local_zone, Handle<SharedFunctionInfo> shared_info,
Handle<FeedbackVector> feedback_vector, BailoutId osr_ast_id,
Handle<FeedbackVector> feedback_vector, BailoutId osr_offset,
JSGraph* jsgraph, CallFrequency invocation_frequency,
SourcePositionTable* source_positions, int inlining_id,
JSTypeHintLowering::Flags flags, bool stack_check)
......@@ -493,7 +493,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
bytecode_iterator_(nullptr),
bytecode_analysis_(nullptr),
environment_(nullptr),
osr_ast_id_(osr_ast_id),
osr_offset_(osr_offset),
currently_peeled_loop_offset_(-1),
stack_check_(stack_check),
merge_environments_(local_zone),
......@@ -831,7 +831,7 @@ void BytecodeGraphBuilder::VisitSingleBytecode(
void BytecodeGraphBuilder::VisitBytecodes() {
BytecodeAnalysis bytecode_analysis(bytecode_array(), local_zone(),
FLAG_analyze_environment_liveness);
bytecode_analysis.Analyze(osr_ast_id_);
bytecode_analysis.Analyze(osr_offset_);
set_bytecode_analysis(&bytecode_analysis);
interpreter::BytecodeArrayIterator iterator(bytecode_array());
......
......@@ -27,7 +27,7 @@ class BytecodeGraphBuilder {
public:
BytecodeGraphBuilder(
Zone* local_zone, Handle<SharedFunctionInfo> shared,
Handle<FeedbackVector> feedback_vector, BailoutId osr_ast_id,
Handle<FeedbackVector> feedback_vector, BailoutId osr_offset,
JSGraph* jsgraph, CallFrequency invocation_frequency,
SourcePositionTable* source_positions,
int inlining_id = SourcePosition::kNotInlined,
......@@ -349,7 +349,7 @@ class BytecodeGraphBuilder {
const interpreter::BytecodeArrayIterator* bytecode_iterator_;
const BytecodeAnalysis* bytecode_analysis_;
Environment* environment_;
BailoutId osr_ast_id_;
BailoutId osr_offset_;
int currently_peeled_loop_offset_;
bool stack_check_;
......
......@@ -623,11 +623,11 @@ void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) {
if (info->is_osr()) {
DCHECK(osr_pc_offset_ >= 0);
data->SetOsrBytecodeOffset(Smi::FromInt(info_->osr_ast_id().ToInt()));
data->SetOsrBytecodeOffset(Smi::FromInt(info_->osr_offset().ToInt()));
data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_));
} else {
BailoutId osr_ast_id = BailoutId::None();
data->SetOsrBytecodeOffset(Smi::FromInt(osr_ast_id.ToInt()));
BailoutId osr_offset = BailoutId::None();
data->SetOsrBytecodeOffset(Smi::FromInt(osr_offset.ToInt()));
data->SetOsrPcOffset(Smi::FromInt(-1));
}
......
......@@ -893,7 +893,7 @@ struct GraphBuilderPhase {
BytecodeGraphBuilder graph_builder(
temp_zone, data->info()->shared_info(),
handle(data->info()->closure()->feedback_vector()),
data->info()->osr_ast_id(), data->jsgraph(), CallFrequency(1.0f),
data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f),
data->source_positions(), SourcePosition::kNotInlined, flags);
graph_builder.CreateGraph();
}
......
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