Commit 0bc811e9 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[deoptimizer] Use consistent terms for the bytecode offset

The bytecode offset (previously 'bailout id') was referred to as 'ast
id', 'node id', 'bailout id' in different spots. And 'bailout id' was
used to refer to deoptimization exits. This CL makes used terms more
consistent.

Bug: v8:11332
Change-Id: I2b34c7d4ebf465939e18fdfba675d83852f2430a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2639756
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72190}
parent 727d22be
......@@ -158,7 +158,7 @@ class CompilerTracer : public AllStatic {
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintTracePrefix(scope, "found optimized code for", function, code_kind);
if (!osr_offset.IsNone()) {
PrintF(scope.file(), " at OSR AST id %d", osr_offset.ToInt());
PrintF(scope.file(), " at OSR bytecode offset %d", osr_offset.ToInt());
}
PrintTraceSuffix(scope);
}
......
This diff is collapsed.
......@@ -185,7 +185,7 @@ class TranslatedFrame {
int GetValueCount();
Kind kind() const { return kind_; }
BytecodeOffset node_id() const { return node_id_; }
BytecodeOffset bytecode_offset() const { return bytecode_offset_; }
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
// TODO(jgruber): Simplify/clarify the semantics of this field. The name
......@@ -293,7 +293,7 @@ class TranslatedFrame {
int height = 0, int return_value_offset = 0,
int return_value_count = 0)
: kind_(kind),
node_id_(BytecodeOffset::None()),
bytecode_offset_(BytecodeOffset::None()),
raw_shared_info_(shared_info),
height_(height),
return_value_offset_(return_value_offset),
......@@ -304,7 +304,7 @@ class TranslatedFrame {
void Handlify();
Kind kind_;
BytecodeOffset node_id_;
BytecodeOffset bytecode_offset_;
SharedFunctionInfo raw_shared_info_;
Handle<SharedFunctionInfo> shared_info_;
int height_;
......@@ -442,12 +442,6 @@ class TranslatedState {
FeedbackSlot feedback_slot_;
};
class OptimizedFunctionVisitor {
public:
virtual ~OptimizedFunctionVisitor() = default;
virtual void VisitFunction(JSFunction function) = 0;
};
class Deoptimizer : public Malloced {
public:
struct DeoptInfo {
......@@ -464,9 +458,9 @@ class Deoptimizer : public Malloced {
static DeoptInfo GetDeoptInfo(Code code, Address from);
static int ComputeSourcePositionFromBytecodeArray(Isolate* isolate,
SharedFunctionInfo shared,
BytecodeOffset node_id);
static int ComputeSourcePositionFromBytecodeArray(
Isolate* isolate, SharedFunctionInfo shared,
BytecodeOffset bytecode_offset);
static const char* MessageFor(DeoptimizeKind kind, bool reuse_code);
......@@ -482,8 +476,8 @@ class Deoptimizer : public Malloced {
bool should_reuse_code() const;
static Deoptimizer* New(Address raw_function, DeoptimizeKind kind,
unsigned bailout_id, Address from, int fp_to_sp_delta,
Isolate* isolate);
unsigned deopt_exit_index, Address from,
int fp_to_sp_delta, Isolate* isolate);
static Deoptimizer* Grab(Isolate* isolate);
// The returned object with information on the optimized frame needs to be
......@@ -549,9 +543,10 @@ class Deoptimizer : public Malloced {
static constexpr int kMaxNumberOfEntries = 16384;
// This marker is passed to Deoptimizer::New as {bailout_id} on platforms
// that have fixed deopt sizes (see also kSupportsFixedDeoptExitSizes). The
// actual deoptimization id is then calculated from the return address.
// This marker is passed to Deoptimizer::New as {deopt_exit_index} on
// platforms that have fixed deopt sizes (see also
// kSupportsFixedDeoptExitSizes). The actual deoptimization id is then
// calculated from the return address.
static constexpr unsigned kFixedExitSizeMarker = kMaxUInt32;
// Set to true when the architecture supports deoptimization exit sequences
......@@ -581,7 +576,7 @@ class Deoptimizer : public Malloced {
const TranslatedFrame::iterator& iterator);
Deoptimizer(Isolate* isolate, JSFunction function, DeoptimizeKind kind,
unsigned bailout_id, Address from, int fp_to_sp_delta);
unsigned deopt_exit_index, Address from, int fp_to_sp_delta);
Code FindOptimizedCode();
void DeleteFrameDescriptions();
......@@ -607,7 +602,6 @@ class Deoptimizer : public Malloced {
unsigned ComputeInputFrameSize() const;
static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo shared);
static unsigned ComputeOutgoingArgumentSize(Code code, unsigned bailout_id);
static void MarkAllCodeForContext(NativeContext native_context);
static void DeoptimizeMarkedCodeForContext(NativeContext native_context);
......@@ -625,7 +619,7 @@ class Deoptimizer : public Malloced {
CodeTracer::Scope* verbose_trace_scope() const {
return FLAG_trace_deopt_verbose ? trace_scope() : nullptr;
}
void TraceDeoptBegin(int optimization_id, int node_id);
void TraceDeoptBegin(int optimization_id, BytecodeOffset bytecode_offset);
void TraceDeoptEnd(double deopt_duration);
#ifdef DEBUG
static void TraceFoundActivation(Isolate* isolate, JSFunction function);
......@@ -636,7 +630,7 @@ class Deoptimizer : public Malloced {
Isolate* isolate_;
JSFunction function_;
Code compiled_code_;
unsigned bailout_id_;
unsigned deopt_exit_index_;
DeoptimizeKind deopt_kind_;
Address from_;
int fp_to_sp_delta_;
......
......@@ -1551,13 +1551,13 @@ void OptimizedFrame::Summarize(std::vector<FrameSummary>* frames) const {
it->kind() ==
TranslatedFrame::kJavaScriptBuiltinContinuationWithCatch) {
code_offset = 0;
abstract_code =
handle(AbstractCode::cast(isolate()->builtins()->builtin(
Builtins::GetBuiltinFromBytecodeOffset(it->node_id()))),
isolate());
abstract_code = handle(
AbstractCode::cast(isolate()->builtins()->builtin(
Builtins::GetBuiltinFromBytecodeOffset(it->bytecode_offset()))),
isolate());
} else {
DCHECK_EQ(it->kind(), TranslatedFrame::kInterpretedFunction);
code_offset = it->node_id().ToInt(); // Points to current bytecode.
code_offset = it->bytecode_offset().ToInt();
abstract_code =
handle(shared_info->abstract_code(isolate()), isolate());
}
......
......@@ -322,8 +322,8 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
// Determine the entry point for which this OSR request has been fired and
// also disarm all back edges in the calling code to stop new requests.
BytecodeOffset ast_id = DetermineEntryAndDisarmOSRForInterpreter(frame);
DCHECK(!ast_id.IsNone());
BytecodeOffset osr_offset = DetermineEntryAndDisarmOSRForInterpreter(frame);
DCHECK(!osr_offset.IsNone());
MaybeHandle<Code> maybe_result;
Handle<JSFunction> function(frame->function(), isolate);
......@@ -332,9 +332,10 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintF(scope.file(), "[OSR - Compiling: ");
function->PrintName(scope.file());
PrintF(scope.file(), " at AST id %d]\n", ast_id.ToInt());
PrintF(scope.file(), " at OSR bytecode offset %d]\n", osr_offset.ToInt());
}
maybe_result = Compiler::GetOptimizedCodeForOSR(function, ast_id, frame);
maybe_result =
Compiler::GetOptimizedCodeForOSR(function, osr_offset, frame);
// Possibly compile for NCI caching.
if (!MaybeSpawnNativeContextIndependentCompilationJob(
......@@ -353,12 +354,13 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
DeoptimizationData::cast(result->deoptimization_data());
if (data.OsrPcOffset().value() >= 0) {
DCHECK(BytecodeOffset(data.OsrBytecodeOffset().value()) == ast_id);
DCHECK(BytecodeOffset(data.OsrBytecodeOffset().value()) == osr_offset);
if (FLAG_trace_osr) {
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintF(scope.file(),
"[OSR - Entry at AST id %d, offset %d in optimized code]\n",
ast_id.ToInt(), data.OsrPcOffset().value());
"[OSR - Entry at OSR bytecode offset %d, offset %d in optimized "
"code]\n",
osr_offset.ToInt(), data.OsrPcOffset().value());
}
DCHECK(result->is_turbofanned());
......@@ -402,7 +404,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintF(scope.file(), "[OSR - Failed: ");
function->PrintName(scope.file());
PrintF(scope.file(), " at AST id %d]\n", ast_id.ToInt());
PrintF(scope.file(), " at OSR bytecode offset %d]\n", osr_offset.ToInt());
}
if (!function->HasAttachedOptimizedCode()) {
......
......@@ -25,8 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This tests that we do not share optimized code across closures that
// were optimized using OSR (for a particular OSR entry AST id) even if
// This tests that we do not share optimized code across closures that were
// optimized using OSR (for a particular OSR entry bytecode offset) even if
// caching of optimized code kicks in.
function makeClosure() {
......
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