[compiler] Rename type BailoutId to BytecodeOffset

This reflects the actual contents of the type, which is an offset into
the bytecode (or certain marker values). Historically, in the days of
FCG the bailout id used to refer to node ids - this is why certain
tracing output still calls the bailout id 'node id' and 'ast id'.
These spots will be fixed in a follow-up CL.

This change is mechanical:

 git grep -l BailoutId | while read f; do \
  sed -i 's/BailoutId/BytecodeOffset/g' $f; done

With a manual component of updating the DeoptimizationData method
name from 'BytecodeOffset' to 'GetBytecodeOffset'.

Bug: v8:11332
Change-Id: I956b947a480bf52263159c0eb1e895360bcbe6d2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2639754
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72189}
This commit is contained in:
Jakob Gruber 2021-01-20 13:07:43 +01:00 committed by Commit Bot
parent da9d340a9a
commit 727d22be0c
42 changed files with 222 additions and 205 deletions

View File

@ -88,14 +88,14 @@ const BuiltinMetadata builtin_metadata[] = {BUILTIN_LIST(
} // namespace
BailoutId Builtins::GetContinuationBailoutId(Name name) {
BytecodeOffset Builtins::GetContinuationBytecodeOffset(Name name) {
DCHECK(Builtins::KindOf(name) == TFJ || Builtins::KindOf(name) == TFC ||
Builtins::KindOf(name) == TFS);
return BailoutId(BailoutId::kFirstBuiltinContinuationId + name);
return BytecodeOffset(BytecodeOffset::kFirstBuiltinContinuationId + name);
}
Builtins::Name Builtins::GetBuiltinFromBailoutId(BailoutId id) {
int builtin_index = id.ToInt() - BailoutId::kFirstBuiltinContinuationId;
Builtins::Name Builtins::GetBuiltinFromBytecodeOffset(BytecodeOffset id) {
int builtin_index = id.ToInt() - BytecodeOffset::kFirstBuiltinContinuationId;
DCHECK(Builtins::KindOf(builtin_index) == TFJ ||
Builtins::KindOf(builtin_index) == TFC ||
Builtins::KindOf(builtin_index) == TFS);

View File

@ -20,7 +20,7 @@ class Handle;
class Isolate;
// Forward declarations.
class BailoutId;
class BytecodeOffset;
class RootVisitor;
enum class InterpreterPushArgsMode : unsigned;
namespace compiler {
@ -79,8 +79,8 @@ class Builtins {
// The different builtin kinds are documented in builtins-definitions.h.
enum Kind { CPP, TFJ, TFC, TFS, TFH, BCH, ASM };
static BailoutId GetContinuationBailoutId(Name name);
static Name GetBuiltinFromBailoutId(BailoutId);
static BytecodeOffset GetContinuationBytecodeOffset(Name name);
static Name GetBuiltinFromBytecodeOffset(BytecodeOffset);
// Convenience wrappers.
Handle<Code> CallFunction(ConvertReceiverMode = ConvertReceiverMode::kAny);

View File

@ -152,7 +152,7 @@ class CompilerTracer : public AllStatic {
static void TraceOptimizedCodeCacheHit(Isolate* isolate,
Handle<JSFunction> function,
BailoutId osr_offset,
BytecodeOffset osr_offset,
CodeKind code_kind) {
if (!FLAG_trace_opt) return;
CodeTracer::Scope scope(isolate->GetCodeTracer());
@ -834,7 +834,8 @@ bool FinalizeDeferredUnoptimizedCompilationJobs(
}
V8_WARN_UNUSED_RESULT MaybeHandle<Code> GetCodeFromOptimizedCodeCache(
Handle<JSFunction> function, BailoutId osr_offset, CodeKind code_kind) {
Handle<JSFunction> function, BytecodeOffset osr_offset,
CodeKind code_kind) {
RuntimeCallTimerScope runtimeTimer(
function->GetIsolate(),
RuntimeCallCounterId::kCompileGetFromOptimizedCodeMap);
@ -1064,10 +1065,10 @@ Handle<Code> ContinuationForConcurrentOptimization(
return BUILTIN_CODE(isolate, InterpreterEntryTrampoline);
}
MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
ConcurrencyMode mode, CodeKind code_kind,
BailoutId osr_offset = BailoutId::None(),
JavaScriptFrame* osr_frame = nullptr) {
MaybeHandle<Code> GetOptimizedCode(
Handle<JSFunction> function, ConcurrencyMode mode, CodeKind code_kind,
BytecodeOffset osr_offset = BytecodeOffset::None(),
JavaScriptFrame* osr_frame = nullptr) {
DCHECK(CodeKindIsOptimizedJSFunction(code_kind));
Isolate* isolate = function->GetIsolate();
@ -3029,7 +3030,7 @@ template Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
// static
MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
BailoutId osr_offset,
BytecodeOffset osr_offset,
JavaScriptFrame* osr_frame) {
DCHECK(!osr_offset.IsNone());
DCHECK_NOT_NULL(osr_frame);

View File

@ -192,7 +192,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
// Generate and return optimized code for OSR, or empty handle on failure.
V8_WARN_UNUSED_RESULT static MaybeHandle<Code> GetOptimizedCodeForOSR(
Handle<JSFunction> function, BailoutId osr_offset,
Handle<JSFunction> function, BytecodeOffset osr_offset,
JavaScriptFrame* osr_frame);
};

View File

@ -119,7 +119,7 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
CodeKind code_kind() const { return code_kind_; }
int32_t builtin_index() const { return builtin_index_; }
void set_builtin_index(int32_t index) { builtin_index_ = index; }
BailoutId osr_offset() const { return osr_offset_; }
BytecodeOffset osr_offset() const { return osr_offset_; }
JavaScriptFrame* osr_frame() const { return osr_frame_; }
void SetPoisoningMitigationLevel(PoisoningMitigationLevel poisoning_level) {
@ -155,7 +155,8 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
bool IsTurboprop() const { return code_kind() == CodeKind::TURBOPROP; }
bool IsWasm() const { return code_kind() == CodeKind::WASM_FUNCTION; }
void SetOptimizingForOsr(BailoutId osr_offset, JavaScriptFrame* osr_frame) {
void SetOptimizingForOsr(BytecodeOffset osr_offset,
JavaScriptFrame* osr_frame) {
DCHECK(IsOptimizing());
osr_offset_ = osr_offset;
osr_frame_ = osr_frame;
@ -276,8 +277,8 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
// The WebAssembly compilation result, not published in the NativeModule yet.
std::unique_ptr<wasm::WasmCompilationResult> wasm_compilation_result_;
// Entry point when compiling for OSR, {BailoutId::None} otherwise.
BailoutId osr_offset_ = BailoutId::None();
// Entry point when compiling for OSR, {BytecodeOffset::None} otherwise.
BytecodeOffset osr_offset_ = BytecodeOffset::None();
// The zone from which the compilation pipeline working on this
// OptimizedCompilationInfo allocates.

View File

@ -187,7 +187,7 @@ class InstructionOperandConverter {
// Deoptimization exit.
class DeoptimizationExit : public ZoneObject {
public:
explicit DeoptimizationExit(SourcePosition pos, BailoutId bailout_id,
explicit DeoptimizationExit(SourcePosition pos, BytecodeOffset bailout_id,
int translation_id, int pc_offset,
DeoptimizeKind kind, DeoptimizeReason reason)
: deoptimization_id_(kNoDeoptIndex),
@ -215,7 +215,7 @@ class DeoptimizationExit : public ZoneObject {
Label* label() { return &label_; }
// The label after the deoptimization check, which will resume execution.
Label* continue_label() { return &continue_label_; }
BailoutId bailout_id() const { return bailout_id_; }
BytecodeOffset bailout_id() const { return bailout_id_; }
int translation_id() const { return translation_id_; }
int pc_offset() const { return pc_offset_; }
DeoptimizeKind kind() const { return kind_; }
@ -238,7 +238,7 @@ class DeoptimizationExit : public ZoneObject {
const SourcePosition pos_;
Label label_;
Label continue_label_;
const BailoutId bailout_id_;
const BytecodeOffset bailout_id_;
const int translation_id_;
const int pc_offset_;
const DeoptimizeKind kind_;

View File

@ -1022,7 +1022,7 @@ Handle<DeoptimizationData> CodeGenerator::GenerateDeoptimizationData() {
data->SetOsrBytecodeOffset(Smi::FromInt(info_->osr_offset().ToInt()));
data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_));
} else {
BailoutId osr_offset = BailoutId::None();
BytecodeOffset osr_offset = BytecodeOffset::None();
data->SetOsrBytecodeOffset(Smi::FromInt(osr_offset.ToInt()));
data->SetOsrPcOffset(Smi::FromInt(-1));
}
@ -1164,7 +1164,7 @@ void CodeGenerator::BuildTranslationForFrameStateDescriptor(
shared_info = info()->shared_info();
}
const BailoutId bailout_id = descriptor->bailout_id();
const BytecodeOffset bailout_id = descriptor->bailout_id();
const int shared_info_id =
DefineDeoptimizationLiteral(DeoptimizationLiteral(shared_info));
const unsigned int height =

View File

@ -1001,7 +1001,7 @@ namespace {
size_t GetConservativeFrameSizeInBytes(FrameStateType type,
size_t parameters_count,
size_t locals_count,
BailoutId bailout_id) {
BytecodeOffset bailout_id) {
switch (type) {
case FrameStateType::kInterpretedFunction: {
auto info = InterpretedFrameInfo::Conservative(
@ -1026,7 +1026,7 @@ size_t GetConservativeFrameSizeInBytes(FrameStateType type,
auto info = BuiltinContinuationFrameInfo::Conservative(
static_cast<int>(parameters_count),
Builtins::CallInterfaceDescriptorFor(
Builtins::GetBuiltinFromBailoutId(bailout_id)),
Builtins::GetBuiltinFromBytecodeOffset(bailout_id)),
config);
return info.frame_size_in_bytes();
}
@ -1037,7 +1037,7 @@ size_t GetConservativeFrameSizeInBytes(FrameStateType type,
size_t GetTotalConservativeFrameSizeInBytes(FrameStateType type,
size_t parameters_count,
size_t locals_count,
BailoutId bailout_id,
BytecodeOffset bailout_id,
FrameStateDescriptor* outer_state) {
size_t outer_total_conservative_frame_size_in_bytes =
(outer_state == nullptr)
@ -1051,7 +1051,7 @@ size_t GetTotalConservativeFrameSizeInBytes(FrameStateType type,
} // namespace
FrameStateDescriptor::FrameStateDescriptor(
Zone* zone, FrameStateType type, BailoutId bailout_id,
Zone* zone, FrameStateType type, BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine, size_t parameters_count,
size_t locals_count, size_t stack_count,
MaybeHandle<SharedFunctionInfo> shared_info,
@ -1127,7 +1127,7 @@ size_t FrameStateDescriptor::GetJSFrameCount() const {
}
JSToWasmFrameStateDescriptor::JSToWasmFrameStateDescriptor(
Zone* zone, FrameStateType type, BailoutId bailout_id,
Zone* zone, FrameStateType type, BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine, size_t parameters_count,
size_t locals_count, size_t stack_count,
MaybeHandle<SharedFunctionInfo> shared_info,

View File

@ -1300,7 +1300,8 @@ class StateValueList {
class FrameStateDescriptor : public ZoneObject {
public:
FrameStateDescriptor(Zone* zone, FrameStateType type, BailoutId bailout_id,
FrameStateDescriptor(Zone* zone, FrameStateType type,
BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine,
size_t parameters_count, size_t locals_count,
size_t stack_count,
@ -1308,7 +1309,7 @@ class FrameStateDescriptor : public ZoneObject {
FrameStateDescriptor* outer_state = nullptr);
FrameStateType type() const { return type_; }
BailoutId bailout_id() const { return bailout_id_; }
BytecodeOffset bailout_id() const { return bailout_id_; }
OutputFrameStateCombine state_combine() const { return frame_state_combine_; }
size_t parameters_count() const { return parameters_count_; }
size_t locals_count() const { return locals_count_; }
@ -1347,7 +1348,7 @@ class FrameStateDescriptor : public ZoneObject {
private:
FrameStateType type_;
BailoutId bailout_id_;
BytecodeOffset bailout_id_;
OutputFrameStateCombine frame_state_combine_;
const size_t parameters_count_;
const size_t locals_count_;
@ -1361,7 +1362,7 @@ class FrameStateDescriptor : public ZoneObject {
class JSToWasmFrameStateDescriptor : public FrameStateDescriptor {
public:
JSToWasmFrameStateDescriptor(Zone* zone, FrameStateType type,
BailoutId bailout_id,
BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine,
size_t parameters_count, size_t locals_count,
size_t stack_count,

View File

@ -79,7 +79,7 @@ ResumeJumpTarget ResumeJumpTarget::AtLoopHeader(int loop_header_offset,
}
BytecodeAnalysis::BytecodeAnalysis(Handle<BytecodeArray> bytecode_array,
Zone* zone, BailoutId osr_bailout_id,
Zone* zone, BytecodeOffset osr_bailout_id,
bool analyze_liveness)
: bytecode_array_(bytecode_array),
zone_(zone),

View File

@ -99,7 +99,7 @@ struct V8_EXPORT_PRIVATE LoopInfo {
class V8_EXPORT_PRIVATE BytecodeAnalysis : public ZoneObject {
public:
BytecodeAnalysis(Handle<BytecodeArray> bytecode_array, Zone* zone,
BailoutId osr_bailout_id, bool analyze_liveness);
BytecodeOffset osr_bailout_id, bool analyze_liveness);
BytecodeAnalysis(const BytecodeAnalysis&) = delete;
BytecodeAnalysis& operator=(const BytecodeAnalysis&) = delete;
@ -128,7 +128,7 @@ class V8_EXPORT_PRIVATE BytecodeAnalysis : public ZoneObject {
return osr_entry_point_;
}
// Return the osr_bailout_id (for verification purposes).
BailoutId osr_bailout_id() const { return osr_bailout_id_; }
BytecodeOffset osr_bailout_id() const { return osr_bailout_id_; }
// Return whether liveness analysis was performed (for verification purposes).
bool liveness_analyzed() const { return analyze_liveness_; }
@ -167,7 +167,7 @@ class V8_EXPORT_PRIVATE BytecodeAnalysis : public ZoneObject {
Handle<BytecodeArray> const bytecode_array_;
Zone* const zone_;
BailoutId const osr_bailout_id_;
BytecodeOffset const osr_bailout_id_;
bool const analyze_liveness_;
ZoneStack<LoopStackEntry> loop_stack_;
ZoneVector<int> loop_end_index_queue_;

View File

@ -38,7 +38,7 @@ class BytecodeGraphBuilder {
NativeContextRef const& native_context,
SharedFunctionInfoRef const& shared_info,
FeedbackCellRef const& feedback_cell,
BailoutId osr_offset, JSGraph* jsgraph,
BytecodeOffset osr_offset, JSGraph* jsgraph,
CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions, int inlining_id,
CodeKind code_kind, BytecodeGraphBuilderFlags flags,
@ -210,7 +210,7 @@ class BytecodeGraphBuilder {
//
// The low-level chokepoint - use the variants below instead.
void PrepareFrameState(Node* node, OutputFrameStateCombine combine,
BailoutId bailout_id,
BytecodeOffset bailout_id,
const BytecodeLivenessState* liveness);
// In the common case, frame states are conceptually "after" a given
@ -218,7 +218,7 @@ class BytecodeGraphBuilder {
void PrepareFrameState(Node* node, OutputFrameStateCombine combine) {
if (!OperatorProperties::HasFrameStateInput(node->op())) return;
const int offset = bytecode_iterator().current_offset();
return PrepareFrameState(node, combine, BailoutId(offset),
return PrepareFrameState(node, combine, BytecodeOffset(offset),
bytecode_analysis().GetOutLivenessFor(offset));
}
@ -232,7 +232,7 @@ class BytecodeGraphBuilder {
DCHECK(OperatorProperties::HasFrameStateInput(node->op()));
DCHECK(node->opcode() == IrOpcode::kJSStackCheck);
return PrepareFrameState(node, OutputFrameStateCombine::Ignore(),
BailoutId(kFunctionEntryBytecodeOffset),
BytecodeOffset(kFunctionEntryBytecodeOffset),
bytecode_analysis().GetInLivenessFor(0));
}
@ -252,7 +252,7 @@ class BytecodeGraphBuilder {
DCHECK(node->opcode() == IrOpcode::kJSStackCheck);
const int offset = bytecode_analysis().osr_bailout_id().ToInt();
return PrepareFrameState(node, OutputFrameStateCombine::Ignore(),
BailoutId(offset),
BytecodeOffset(offset),
bytecode_analysis().GetOutLivenessFor(offset));
}
@ -578,7 +578,8 @@ class BytecodeGraphBuilder::Environment : public ZoneObject {
// Preserve a checkpoint of the environment for the IR graph. Any
// further mutation of the environment will not affect checkpoints.
Node* Checkpoint(BailoutId bytecode_offset, OutputFrameStateCombine combine,
Node* Checkpoint(BytecodeOffset bytecode_offset,
OutputFrameStateCombine combine,
const BytecodeLivenessState* liveness);
// Control dependency tracked by this environment.
@ -1001,7 +1002,7 @@ Node* BytecodeGraphBuilder::Environment::GetStateValuesFromCache(
}
Node* BytecodeGraphBuilder::Environment::Checkpoint(
BailoutId bailout_id, OutputFrameStateCombine combine,
BytecodeOffset bailout_id, OutputFrameStateCombine combine,
const BytecodeLivenessState* liveness) {
if (parameter_count() == register_count()) {
// Re-use the state-value cache if the number of local registers happens
@ -1037,7 +1038,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
JSHeapBroker* broker, Zone* local_zone,
NativeContextRef const& native_context,
SharedFunctionInfoRef const& shared_info,
FeedbackCellRef const& feedback_cell, BailoutId osr_offset,
FeedbackCellRef const& feedback_cell, BytecodeOffset osr_offset,
JSGraph* jsgraph, CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions, int inlining_id, CodeKind code_kind,
BytecodeGraphBuilderFlags flags, TickCounter* tick_counter)
@ -1260,7 +1261,7 @@ void BytecodeGraphBuilder::PrepareEagerCheckpoint() {
DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
DCHECK_EQ(IrOpcode::kDead,
NodeProperties::GetFrameStateInput(node)->opcode());
BailoutId bailout_id(bytecode_iterator().current_offset());
BytecodeOffset bailout_id(bytecode_iterator().current_offset());
const BytecodeLivenessState* liveness_before =
bytecode_analysis().GetInLivenessFor(
@ -1287,7 +1288,7 @@ void BytecodeGraphBuilder::PrepareEagerCheckpoint() {
}
void BytecodeGraphBuilder::PrepareFrameState(
Node* node, OutputFrameStateCombine combine, BailoutId bailout_id,
Node* node, OutputFrameStateCombine combine, BytecodeOffset bailout_id,
const BytecodeLivenessState* liveness) {
if (OperatorProperties::HasFrameStateInput(node->op())) {
// Add the frame state for after the operation. The node in question has
@ -4553,7 +4554,7 @@ void BytecodeGraphBuilder::UpdateSourcePosition(int offset) {
void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone,
SharedFunctionInfoRef const& shared_info,
FeedbackCellRef const& feedback_cell,
BailoutId osr_offset, JSGraph* jsgraph,
BytecodeOffset osr_offset, JSGraph* jsgraph,
CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions,
int inlining_id, CodeKind code_kind,

View File

@ -42,7 +42,7 @@ using BytecodeGraphBuilderFlags = base::Flags<BytecodeGraphBuilderFlag>;
void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone,
SharedFunctionInfoRef const& shared_info,
FeedbackCellRef const& feedback_cell,
BailoutId osr_offset, JSGraph* jsgraph,
BytecodeOffset osr_offset, JSGraph* jsgraph,
CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions,
int inlining_id, CodeKind code_kind,

View File

@ -1528,7 +1528,7 @@ MachineRepresentation DeadValueRepresentationOf(Operator const* op) {
}
const Operator* CommonOperatorBuilder::FrameState(
BailoutId bailout_id, OutputFrameStateCombine state_combine,
BytecodeOffset bailout_id, OutputFrameStateCombine state_combine,
const FrameStateFunctionInfo* function_info) {
FrameStateInfo state_info(bailout_id, state_combine, function_info);
return zone()->New<Operator1<FrameStateInfo>>( // --

View File

@ -543,7 +543,7 @@ class V8_EXPORT_PRIVATE CommonOperatorBuilder final
const Operator* ObjectState(uint32_t object_id, int pointer_slots);
const Operator* TypedObjectState(uint32_t object_id,
const ZoneVector<MachineType>* types);
const Operator* FrameState(BailoutId bailout_id,
const Operator* FrameState(BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine,
const FrameStateFunctionInfo* function_info);
const Operator* Call(const CallDescriptor* call_descriptor);

View File

@ -123,7 +123,7 @@ FrameState CreateBuiltinContinuationFrameStateCommon(
common->StateValues(parameter_count, SparseInputMask::Dense());
Node* params_node = graph->NewNode(op_param, parameter_count, parameters);
BailoutId bailout_id = Builtins::GetContinuationBailoutId(name);
BytecodeOffset bailout_id = Builtins::GetContinuationBytecodeOffset(name);
const FrameStateFunctionInfo* state_info =
common->CreateFrameStateFunctionInfo(frame_type, parameter_count, 0,
shared, signature);

View File

@ -122,7 +122,8 @@ class JSToWasmFrameStateFunctionInfo : public FrameStateFunctionInfo {
class FrameStateInfo final {
public:
FrameStateInfo(BailoutId bailout_id, OutputFrameStateCombine state_combine,
FrameStateInfo(BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine,
const FrameStateFunctionInfo* info)
: bailout_id_(bailout_id),
frame_state_combine_(state_combine),
@ -132,7 +133,7 @@ class FrameStateInfo final {
return info_ == nullptr ? FrameStateType::kInterpretedFunction
: info_->type();
}
BailoutId bailout_id() const { return bailout_id_; }
BytecodeOffset bailout_id() const { return bailout_id_; }
OutputFrameStateCombine state_combine() const { return frame_state_combine_; }
MaybeHandle<SharedFunctionInfo> shared_info() const {
return info_ == nullptr ? MaybeHandle<SharedFunctionInfo>()
@ -147,7 +148,7 @@ class FrameStateInfo final {
const FrameStateFunctionInfo* function_info() const { return info_; }
private:
BailoutId const bailout_id_;
BytecodeOffset const bailout_id_;
OutputFrameStateCombine const frame_state_combine_;
const FrameStateFunctionInfo* const info_;
};

View File

@ -2049,13 +2049,11 @@ struct PromiseCtorFrameStateParams {
// Remnant of old-style JSCallReducer code. Could be ported to graph assembler,
// but probably not worth the effort.
FrameState CreateArtificialFrameState(Node* node, Node* outer_frame_state,
int parameter_count, BailoutId bailout_id,
FrameStateType frame_state_type,
const SharedFunctionInfoRef& shared,
Node* context,
CommonOperatorBuilder* common,
Graph* graph) {
FrameState CreateArtificialFrameState(
Node* node, Node* outer_frame_state, int parameter_count,
BytecodeOffset bailout_id, FrameStateType frame_state_type,
const SharedFunctionInfoRef& shared, Node* context,
CommonOperatorBuilder* common, Graph* graph) {
const FrameStateFunctionInfo* state_info =
common->CreateFrameStateFunctionInfo(
frame_state_type, parameter_count + 1, 0, shared.object());
@ -2089,7 +2087,7 @@ FrameState PromiseConstructorFrameState(
DCHECK_EQ(1, params.shared.internal_formal_parameter_count());
return CreateArtificialFrameState(
params.node_ptr, params.outer_frame_state, 1,
BailoutId::ConstructStubInvoke(), FrameStateType::kConstructStub,
BytecodeOffset::ConstructStubInvoke(), FrameStateType::kConstructStub,
params.shared, params.context, common, graph);
}
@ -6740,7 +6738,7 @@ Reduction JSCallReducer::ReduceTypedArrayConstructor(
// Insert a construct stub frame into the chain of frame states. This will
// reconstruct the proper frame when deoptimizing within the constructor.
frame_state = CreateArtificialFrameState(
node, frame_state, arity, BailoutId::ConstructStubInvoke(),
node, frame_state, arity, BytecodeOffset::ConstructStubInvoke(),
FrameStateType::kConstructStub, shared, context, common(), graph());
// This continuation just returns the newly created JSTypedArray. We

View File

@ -247,7 +247,7 @@ Reduction JSInliner::InlineCall(Node* call, Node* new_target, Node* context,
Node* JSInliner::CreateArtificialFrameState(Node* node, Node* outer_frame_state,
int parameter_count,
BailoutId bailout_id,
BytecodeOffset bailout_id,
FrameStateType frame_state_type,
SharedFunctionInfoRef shared,
Node* context) {
@ -545,7 +545,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
{
CallFrequency frequency = call.frequency();
BuildGraphFromBytecode(broker(), zone(), *shared_info, feedback_cell,
BailoutId::None(), jsgraph(), frequency,
BytecodeOffset::None(), jsgraph(), frequency,
source_positions_, inlining_id, info_->code_kind(),
flags, &info_->tick_counter());
}
@ -598,7 +598,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
Control control = n.control();
Node* frame_state_inside = CreateArtificialFrameState(
node, frame_state, n.ArgumentCount(),
BailoutId::ConstructStubCreate(), FrameStateType::kConstructStub,
BytecodeOffset::ConstructStubCreate(), FrameStateType::kConstructStub,
*shared_info, context);
Node* create =
graph()->NewNode(javascript()->Create(), call.target(), new_target,
@ -652,8 +652,9 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
// Insert a construct stub frame into the chain of frame states. This will
// reconstruct the proper frame when deoptimizing within the constructor.
frame_state = CreateArtificialFrameState(
node, frame_state, n.ArgumentCount(), BailoutId::ConstructStubInvoke(),
FrameStateType::kConstructStub, *shared_info, context);
node, frame_state, n.ArgumentCount(),
BytecodeOffset::ConstructStubInvoke(), FrameStateType::kConstructStub,
*shared_info, context);
}
// Insert a JSConvertReceiver node for sloppy callees. Note that the context
@ -682,7 +683,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
DCHECK_EQ(parameter_count, start->op()->ValueOutputCount() - 5);
if (call.argument_count() != parameter_count) {
frame_state = CreateArtificialFrameState(
node, frame_state, call.argument_count(), BailoutId::None(),
node, frame_state, call.argument_count(), BytecodeOffset::None(),
FrameStateType::kArgumentsAdaptor, *shared_info);
}

View File

@ -11,7 +11,7 @@
namespace v8 {
namespace internal {
class BailoutId;
class BytecodeOffset;
class OptimizedCompilationInfo;
namespace compiler {
@ -64,7 +64,8 @@ class JSInliner final : public AdvancedReducer {
FeedbackCellRef DetermineCallContext(Node* node, Node** context_out);
Node* CreateArtificialFrameState(Node* node, Node* outer_frame_state,
int parameter_count, BailoutId bailout_id,
int parameter_count,
BytecodeOffset bailout_id,
FrameStateType frame_state_type,
SharedFunctionInfoRef shared,
Node* context = nullptr);

View File

@ -1037,7 +1037,7 @@ class PipelineCompilationJob final : public OptimizedCompilationJob {
public:
PipelineCompilationJob(Isolate* isolate,
Handle<SharedFunctionInfo> shared_info,
Handle<JSFunction> function, BailoutId osr_offset,
Handle<JSFunction> function, BytecodeOffset osr_offset,
JavaScriptFrame* osr_frame, CodeKind code_kind);
~PipelineCompilationJob() final;
PipelineCompilationJob(const PipelineCompilationJob&) = delete;
@ -1075,7 +1075,7 @@ bool ShouldUseConcurrentInlining(CodeKind code_kind, bool is_osr) {
PipelineCompilationJob::PipelineCompilationJob(
Isolate* isolate, Handle<SharedFunctionInfo> shared_info,
Handle<JSFunction> function, BailoutId osr_offset,
Handle<JSFunction> function, BytecodeOffset osr_offset,
JavaScriptFrame* osr_frame, CodeKind code_kind)
// Note that the OptimizedCompilationInfo is not initialized at the time
// we pass it to the CompilationJob constructor, but it is not
@ -3175,7 +3175,7 @@ MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
// static
std::unique_ptr<OptimizedCompilationJob> Pipeline::NewCompilationJob(
Isolate* isolate, Handle<JSFunction> function, CodeKind code_kind,
bool has_script, BailoutId osr_offset, JavaScriptFrame* osr_frame) {
bool has_script, BytecodeOffset osr_offset, JavaScriptFrame* osr_frame) {
Handle<SharedFunctionInfo> shared =
handle(function->shared(), function->GetIsolate());
return std::make_unique<PipelineCompilationJob>(

View File

@ -48,7 +48,7 @@ class Pipeline : public AllStatic {
static V8_EXPORT_PRIVATE std::unique_ptr<OptimizedCompilationJob>
NewCompilationJob(Isolate* isolate, Handle<JSFunction> function,
CodeKind code_kind, bool has_script,
BailoutId osr_offset = BailoutId::None(),
BytecodeOffset osr_offset = BytecodeOffset::None(),
JavaScriptFrame* osr_frame = nullptr);
// Run the pipeline for the WebAssembly compilation info.

View File

@ -382,7 +382,7 @@ class SerializerForBackgroundCompilation {
SerializerForBackgroundCompilation(
ZoneStats* zone_stats, JSHeapBroker* broker,
CompilationDependencies* dependencies, Handle<JSFunction> closure,
SerializerForBackgroundCompilationFlags flags, BailoutId osr_offset);
SerializerForBackgroundCompilationFlags flags, BytecodeOffset osr_offset);
Hints Run(); // NOTE: Returns empty for an
// already-serialized function.
@ -555,7 +555,7 @@ class SerializerForBackgroundCompilation {
Zone* zone() { return zone_scope_.zone(); }
Environment* environment() const { return environment_; }
SerializerForBackgroundCompilationFlags flags() const { return flags_; }
BailoutId osr_offset() const { return osr_offset_; }
BytecodeOffset osr_offset() const { return osr_offset_; }
const BytecodeAnalysis& bytecode_analysis() { return *bytecode_analysis_; }
JSHeapBroker* const broker_;
@ -565,7 +565,7 @@ class SerializerForBackgroundCompilation {
// Instead of storing the virtual_closure here, we could extract it from the
// {closure_hints_} but that would be cumbersome.
VirtualClosure const function_;
BailoutId const osr_offset_;
BytecodeOffset const osr_offset_;
base::Optional<BytecodeAnalysis> bytecode_analysis_;
ZoneUnorderedMap<int, Environment*> jump_target_environments_;
Environment* const environment_;
@ -579,7 +579,7 @@ class SerializerForBackgroundCompilation {
void RunSerializerForBackgroundCompilation(
ZoneStats* zone_stats, JSHeapBroker* broker,
CompilationDependencies* dependencies, Handle<JSFunction> closure,
SerializerForBackgroundCompilationFlags flags, BailoutId osr_offset) {
SerializerForBackgroundCompilationFlags flags, BytecodeOffset osr_offset) {
SerializerForBackgroundCompilation serializer(
zone_stats, broker, dependencies, closure, flags, osr_offset);
serializer.Run();
@ -1056,7 +1056,7 @@ std::ostream& operator<<(
SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
ZoneStats* zone_stats, JSHeapBroker* broker,
CompilationDependencies* dependencies, Handle<JSFunction> closure,
SerializerForBackgroundCompilationFlags flags, BailoutId osr_offset)
SerializerForBackgroundCompilationFlags flags, BytecodeOffset osr_offset)
: broker_(broker),
dependencies_(dependencies),
zone_scope_(zone_stats, ZONE_NAME),
@ -1087,7 +1087,7 @@ SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
zone_scope_(zone_stats, ZONE_NAME),
flags_(flags),
function_(function.virtual_closure()),
osr_offset_(BailoutId::None()),
osr_offset_(BytecodeOffset::None()),
jump_target_environments_(zone()),
environment_(zone()->New<Environment>(zone(), broker_->isolate(),
function, new_target, arguments,

View File

@ -10,7 +10,7 @@
namespace v8 {
namespace internal {
class BailoutId;
class BytecodeOffset;
class Zone;
namespace compiler {
@ -31,7 +31,7 @@ using SerializerForBackgroundCompilationFlags =
void RunSerializerForBackgroundCompilation(
ZoneStats* zone_stats, JSHeapBroker* broker,
CompilationDependencies* dependencies, Handle<JSFunction> closure,
SerializerForBackgroundCompilationFlags flags, BailoutId osr_offset);
SerializerForBackgroundCompilationFlags flags, BytecodeOffset osr_offset);
} // namespace compiler
} // namespace internal

View File

@ -896,7 +896,7 @@ void Deoptimizer::DoComputeOutputFrames() {
CHECK_GT(static_cast<uintptr_t>(caller_frame_top_),
stack_guard->real_jslimit());
BailoutId node_id = input_data.BytecodeOffset(bailout_id_);
BytecodeOffset node_id = input_data.GetBytecodeOffset(bailout_id_);
ByteArray translations = input_data.TranslationByteArray();
unsigned translation_index = input_data.TranslationIndex(bailout_id_).value();
@ -1373,7 +1373,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
Builtins* builtins = isolate_->builtins();
Code construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
BailoutId bailout_id = translated_frame->node_id();
BytecodeOffset bailout_id = translated_frame->node_id();
const int parameters_count = translated_frame->height();
ConstructStubFrameInfo frame_info =
@ -1386,7 +1386,8 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
" translating construct stub => bailout_id=%d (%s), "
"variable_frame_size=%d, frame_size=%d\n",
bailout_id.ToInt(),
bailout_id == BailoutId::ConstructStubCreate() ? "create" : "invoke",
bailout_id == BytecodeOffset::ConstructStubCreate() ? "create"
: "invoke",
frame_info.frame_size_in_bytes_without_fixed(), output_frame_size);
}
@ -1464,9 +1465,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
frame_writer.PushRawObject(roots.the_hole_value(), "padding\n");
CHECK(bailout_id == BailoutId::ConstructStubCreate() ||
bailout_id == BailoutId::ConstructStubInvoke());
const char* debug_hint = bailout_id == BailoutId::ConstructStubCreate()
CHECK(bailout_id == BytecodeOffset::ConstructStubCreate() ||
bailout_id == BytecodeOffset::ConstructStubInvoke());
const char* debug_hint = bailout_id == BytecodeOffset::ConstructStubCreate()
? "new target\n"
: "allocated receiver\n";
frame_writer.PushTranslatedValue(receiver_iterator, debug_hint);
@ -1488,7 +1489,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
DCHECK(bailout_id.IsValidForConstructStub());
Address start = construct_stub.InstructionStart();
const int pc_offset =
bailout_id == BailoutId::ConstructStubCreate()
bailout_id == BytecodeOffset::ConstructStubCreate()
? isolate_->heap()->construct_stub_create_deopt_pc_offset().value()
: isolate_->heap()->construct_stub_invoke_deopt_pc_offset().value();
intptr_t pc_value = static_cast<intptr_t>(start + pc_offset);
@ -1687,8 +1688,9 @@ void Deoptimizer::DoComputeBuiltinContinuation(
TranslatedFrame::iterator value_iterator = translated_frame->begin();
const BailoutId bailout_id = translated_frame->node_id();
Builtins::Name builtin_name = Builtins::GetBuiltinFromBailoutId(bailout_id);
const BytecodeOffset bailout_id = translated_frame->node_id();
Builtins::Name builtin_name =
Builtins::GetBuiltinFromBytecodeOffset(bailout_id);
CallInterfaceDescriptor continuation_descriptor =
Builtins::CallInterfaceDescriptorFor(builtin_name);
@ -2121,7 +2123,7 @@ Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) {
return result;
}
void Translation::BeginBuiltinContinuationFrame(BailoutId bailout_id,
void Translation::BeginBuiltinContinuationFrame(BytecodeOffset bailout_id,
int literal_id,
unsigned height) {
buffer_->Add(BUILTIN_CONTINUATION_FRAME);
@ -2131,7 +2133,7 @@ void Translation::BeginBuiltinContinuationFrame(BailoutId bailout_id,
}
void Translation::BeginJSToWasmBuiltinContinuationFrame(
BailoutId bailout_id, int literal_id, unsigned height,
BytecodeOffset bailout_id, int literal_id, unsigned height,
base::Optional<wasm::ValueType::Kind> return_type) {
buffer_->Add(JS_TO_WASM_BUILTIN_CONTINUATION_FRAME);
buffer_->Add(bailout_id.ToInt());
@ -2140,9 +2142,8 @@ void Translation::BeginJSToWasmBuiltinContinuationFrame(
buffer_->Add(EncodeWasmReturnType(return_type));
}
void Translation::BeginJavaScriptBuiltinContinuationFrame(BailoutId bailout_id,
int literal_id,
unsigned height) {
void Translation::BeginJavaScriptBuiltinContinuationFrame(
BytecodeOffset bailout_id, int literal_id, unsigned height) {
buffer_->Add(JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME);
buffer_->Add(bailout_id.ToInt());
buffer_->Add(literal_id);
@ -2150,15 +2151,15 @@ void Translation::BeginJavaScriptBuiltinContinuationFrame(BailoutId bailout_id,
}
void Translation::BeginJavaScriptBuiltinContinuationWithCatchFrame(
BailoutId bailout_id, int literal_id, unsigned height) {
BytecodeOffset bailout_id, int literal_id, unsigned height) {
buffer_->Add(JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH_FRAME);
buffer_->Add(bailout_id.ToInt());
buffer_->Add(literal_id);
buffer_->Add(height);
}
void Translation::BeginConstructStubFrame(BailoutId bailout_id, int literal_id,
unsigned height) {
void Translation::BeginConstructStubFrame(BytecodeOffset bailout_id,
int literal_id, unsigned height) {
buffer_->Add(CONSTRUCT_STUB_FRAME);
buffer_->Add(bailout_id.ToInt());
buffer_->Add(literal_id);
@ -2171,7 +2172,7 @@ void Translation::BeginArgumentsAdaptorFrame(int literal_id, unsigned height) {
buffer_->Add(height);
}
void Translation::BeginInterpretedFrame(BailoutId bytecode_offset,
void Translation::BeginInterpretedFrame(BytecodeOffset bytecode_offset,
int literal_id, unsigned height,
int return_value_offset,
int return_value_count) {
@ -2507,7 +2508,7 @@ Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code code, Address pc) {
// static
int Deoptimizer::ComputeSourcePositionFromBytecodeArray(
Isolate* isolate, SharedFunctionInfo shared, BailoutId node_id) {
Isolate* isolate, SharedFunctionInfo shared, BytecodeOffset node_id) {
DCHECK(shared.HasBytecodeArray());
return AbstractCode::cast(shared.GetBytecodeArray(isolate))
.SourcePosition(node_id.ToInt());
@ -2862,7 +2863,7 @@ void TranslatedValue::Handlify() {
}
TranslatedFrame TranslatedFrame::InterpretedFrame(
BailoutId bytecode_offset, SharedFunctionInfo shared_info, int height,
BytecodeOffset bytecode_offset, SharedFunctionInfo shared_info, int height,
int return_value_offset, int return_value_count) {
TranslatedFrame frame(kInterpretedFunction, shared_info, height,
return_value_offset, return_value_count);
@ -2876,21 +2877,21 @@ TranslatedFrame TranslatedFrame::ArgumentsAdaptorFrame(
}
TranslatedFrame TranslatedFrame::ConstructStubFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height) {
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
TranslatedFrame frame(kConstructStub, shared_info, height);
frame.node_id_ = bailout_id;
return frame;
}
TranslatedFrame TranslatedFrame::BuiltinContinuationFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height) {
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
TranslatedFrame frame(kBuiltinContinuation, shared_info, height);
frame.node_id_ = bailout_id;
return frame;
}
TranslatedFrame TranslatedFrame::JSToWasmBuiltinContinuationFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height,
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height,
base::Optional<wasm::ValueType::Kind> return_type) {
TranslatedFrame frame(kJSToWasmBuiltinContinuation, shared_info, height);
frame.node_id_ = bailout_id;
@ -2899,14 +2900,14 @@ TranslatedFrame TranslatedFrame::JSToWasmBuiltinContinuationFrame(
}
TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height) {
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
TranslatedFrame frame(kJavaScriptBuiltinContinuation, shared_info, height);
frame.node_id_ = bailout_id;
return frame;
}
TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationWithCatchFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height) {
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
TranslatedFrame frame(kJavaScriptBuiltinContinuationWithCatch, shared_info,
height);
frame.node_id_ = bailout_id;
@ -2964,7 +2965,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
static_cast<Translation::Opcode>(iterator->Next());
switch (opcode) {
case Translation::INTERPRETED_FRAME: {
BailoutId bytecode_offset = BailoutId(iterator->Next());
BytecodeOffset bytecode_offset = BytecodeOffset(iterator->Next());
SharedFunctionInfo shared_info =
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
int height = iterator->Next();
@ -2998,7 +2999,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
}
case Translation::CONSTRUCT_STUB_FRAME: {
BailoutId bailout_id = BailoutId(iterator->Next());
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
SharedFunctionInfo shared_info =
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
int height = iterator->Next();
@ -3013,7 +3014,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
}
case Translation::BUILTIN_CONTINUATION_FRAME: {
BailoutId bailout_id = BailoutId(iterator->Next());
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
SharedFunctionInfo shared_info =
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
int height = iterator->Next();
@ -3029,7 +3030,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
}
case Translation::JS_TO_WASM_BUILTIN_CONTINUATION_FRAME: {
BailoutId bailout_id = BailoutId(iterator->Next());
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
SharedFunctionInfo shared_info =
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
int height = iterator->Next();
@ -3049,7 +3050,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
}
case Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME: {
BailoutId bailout_id = BailoutId(iterator->Next());
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
SharedFunctionInfo shared_info =
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
int height = iterator->Next();
@ -3064,7 +3065,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
bailout_id, shared_info, height);
}
case Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH_FRAME: {
BailoutId bailout_id = BailoutId(iterator->Next());
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
SharedFunctionInfo shared_info =
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
int height = iterator->Next();

View File

@ -185,7 +185,7 @@ class TranslatedFrame {
int GetValueCount();
Kind kind() const { return kind_; }
BailoutId node_id() const { return node_id_; }
BytecodeOffset node_id() const { return node_id_; }
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
// TODO(jgruber): Simplify/clarify the semantics of this field. The name
@ -262,7 +262,7 @@ class TranslatedFrame {
friend class Deoptimizer;
// Constructor static methods.
static TranslatedFrame InterpretedFrame(BailoutId bytecode_offset,
static TranslatedFrame InterpretedFrame(BytecodeOffset bytecode_offset,
SharedFunctionInfo shared_info,
int height, int return_value_offset,
int return_value_count);
@ -270,18 +270,18 @@ class TranslatedFrame {
SharedFunctionInfo shared_info);
static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo shared_info,
int height);
static TranslatedFrame ConstructStubFrame(BailoutId bailout_id,
static TranslatedFrame ConstructStubFrame(BytecodeOffset bailout_id,
SharedFunctionInfo shared_info,
int height);
static TranslatedFrame BuiltinContinuationFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height);
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height);
static TranslatedFrame JSToWasmBuiltinContinuationFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height,
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height,
base::Optional<wasm::ValueType::Kind> return_type);
static TranslatedFrame JavaScriptBuiltinContinuationFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height);
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height);
static TranslatedFrame JavaScriptBuiltinContinuationWithCatchFrame(
BailoutId bailout_id, SharedFunctionInfo shared_info, int height);
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height);
static TranslatedFrame InvalidFrame() {
return TranslatedFrame(kInvalid, SharedFunctionInfo());
}
@ -293,7 +293,7 @@ class TranslatedFrame {
int height = 0, int return_value_offset = 0,
int return_value_count = 0)
: kind_(kind),
node_id_(BailoutId::None()),
node_id_(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_;
BailoutId node_id_;
BytecodeOffset node_id_;
SharedFunctionInfo raw_shared_info_;
Handle<SharedFunctionInfo> shared_info_;
int height_;
@ -466,7 +466,7 @@ class Deoptimizer : public Malloced {
static int ComputeSourcePositionFromBytecodeArray(Isolate* isolate,
SharedFunctionInfo shared,
BailoutId node_id);
BytecodeOffset node_id);
static const char* MessageFor(DeoptimizeKind kind, bool reuse_code);
@ -939,22 +939,21 @@ class Translation {
int index() const { return index_; }
// Commands.
void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id,
void BeginInterpretedFrame(BytecodeOffset bytecode_offset, int literal_id,
unsigned height, int return_value_offset,
int return_value_count);
void BeginArgumentsAdaptorFrame(int literal_id, unsigned height);
void BeginConstructStubFrame(BailoutId bailout_id, int literal_id,
void BeginConstructStubFrame(BytecodeOffset bailout_id, int literal_id,
unsigned height);
void BeginBuiltinContinuationFrame(BailoutId bailout_id, int literal_id,
void BeginBuiltinContinuationFrame(BytecodeOffset bailout_id, int literal_id,
unsigned height);
void BeginJSToWasmBuiltinContinuationFrame(
BailoutId bailout_id, int literal_id, unsigned height,
BytecodeOffset bailout_id, int literal_id, unsigned height,
base::Optional<wasm::ValueType::Kind> return_type);
void BeginJavaScriptBuiltinContinuationFrame(BailoutId bailout_id,
void BeginJavaScriptBuiltinContinuationFrame(BytecodeOffset bailout_id,
int literal_id, unsigned height);
void BeginJavaScriptBuiltinContinuationWithCatchFrame(BailoutId bailout_id,
int literal_id,
unsigned height);
void BeginJavaScriptBuiltinContinuationWithCatchFrame(
BytecodeOffset bailout_id, int literal_id, unsigned height);
void ArgumentsElements(CreateArgumentsType type);
void ArgumentsLength();
void BeginCapturedObject(int length);

View File

@ -1553,7 +1553,7 @@ void OptimizedFrame::Summarize(std::vector<FrameSummary>* frames) const {
code_offset = 0;
abstract_code =
handle(AbstractCode::cast(isolate()->builtins()->builtin(
Builtins::GetBuiltinFromBailoutId(it->node_id()))),
Builtins::GetBuiltinFromBytecodeOffset(it->node_id()))),
isolate());
} else {
DCHECK_EQ(it->kind(), TranslatedFrame::kInterpretedFunction);

View File

@ -777,11 +777,11 @@ DEFINE_DEOPT_ENTRY_ACCESSORS(BytecodeOffsetRaw, Smi)
DEFINE_DEOPT_ENTRY_ACCESSORS(TranslationIndex, Smi)
DEFINE_DEOPT_ENTRY_ACCESSORS(Pc, Smi)
BailoutId DeoptimizationData::BytecodeOffset(int i) {
return BailoutId(BytecodeOffsetRaw(i).value());
BytecodeOffset DeoptimizationData::GetBytecodeOffset(int i) {
return BytecodeOffset(BytecodeOffsetRaw(i).value());
}
void DeoptimizationData::SetBytecodeOffset(int i, BailoutId value) {
void DeoptimizationData::SetBytecodeOffset(int i, BytecodeOffset value) {
SetBytecodeOffsetRaw(i, Smi::FromInt(value.ToInt()));
}

View File

@ -232,7 +232,8 @@ bool Code::CanDeoptAt(Address pc) {
for (int i = 0; i < deopt_data.DeoptCount(); i++) {
if (deopt_data.Pc(i).value() == -1) continue;
Address address = code_start_address + deopt_data.Pc(i).value();
if (address == pc && deopt_data.BytecodeOffset(i) != BailoutId::None()) {
if (address == pc &&
deopt_data.GetBytecodeOffset(i) != BytecodeOffset::None()) {
return true;
}
}
@ -457,7 +458,7 @@ void DeoptimizationData::DeoptimizationDataPrint(std::ostream& os) { // NOLINT
}
for (int i = 0; i < deopt_count; i++) {
os << std::setw(6) << i << " " << std::setw(15)
<< BytecodeOffset(i).ToInt() << " " << std::setw(4);
<< GetBytecodeOffset(i).ToInt() << " " << std::setw(4);
print_pc(os, Pc(i).value());
os << std::setw(2);

View File

@ -890,9 +890,9 @@ class DeoptimizationData : public FixedArray {
#undef DECL_ENTRY_ACCESSORS
inline BailoutId BytecodeOffset(int i);
inline BytecodeOffset GetBytecodeOffset(int i);
inline void SetBytecodeOffset(int i, BailoutId value);
inline void SetBytecodeOffset(int i, BytecodeOffset value);
inline int DeoptCount();

View File

@ -17,7 +17,7 @@ const int OSROptimizedCodeCache::kMaxLength;
void OSROptimizedCodeCache::AddOptimizedCode(
Handle<NativeContext> native_context, Handle<SharedFunctionInfo> shared,
Handle<Code> code, BailoutId osr_offset) {
Handle<Code> code, BytecodeOffset osr_offset) {
DCHECK(!osr_offset.IsNone());
DCHECK(CodeKindIsOptimizedJSFunction(code->kind()));
STATIC_ASSERT(kEntryLength == 3);
@ -91,7 +91,7 @@ void OSROptimizedCodeCache::Compact(Handle<NativeContext> native_context) {
}
Code OSROptimizedCodeCache::GetOptimizedCode(Handle<SharedFunctionInfo> shared,
BailoutId osr_offset,
BytecodeOffset osr_offset,
Isolate* isolate) {
DisallowGarbageCollection no_gc;
int index = FindEntry(shared, osr_offset);
@ -157,21 +157,21 @@ SharedFunctionInfo OSROptimizedCodeCache::GetSFIFromEntry(int index) {
: SharedFunctionInfo::cast(sfi_entry);
}
BailoutId OSROptimizedCodeCache::GetBailoutIdFromEntry(int index) {
BytecodeOffset OSROptimizedCodeCache::GetBytecodeOffsetFromEntry(int index) {
DCHECK_LE(index + OSRCodeCacheConstants::kEntryLength, length());
DCHECK_EQ(index % kEntryLength, 0);
Smi osr_offset_entry;
Get(index + kOsrIdOffset)->ToSmi(&osr_offset_entry);
return BailoutId(osr_offset_entry.value());
return BytecodeOffset(osr_offset_entry.value());
}
int OSROptimizedCodeCache::FindEntry(Handle<SharedFunctionInfo> shared,
BailoutId osr_offset) {
BytecodeOffset osr_offset) {
DisallowGarbageCollection no_gc;
DCHECK(!osr_offset.IsNone());
for (int index = 0; index < length(); index += kEntryLength) {
if (GetSFIFromEntry(index) != *shared) continue;
if (GetBailoutIdFromEntry(index) != osr_offset) continue;
if (GetBytecodeOffsetFromEntry(index) != osr_offset) continue;
return index;
}
return -1;
@ -188,7 +188,8 @@ void OSROptimizedCodeCache::ClearEntry(int index, Isolate* isolate) {
void OSROptimizedCodeCache::InitializeEntry(int entry,
SharedFunctionInfo shared,
Code code, BailoutId osr_offset) {
Code code,
BytecodeOffset osr_offset) {
Set(entry + OSRCodeCacheConstants::kSharedOffset,
HeapObjectReference::Weak(shared));
Set(entry + OSRCodeCacheConstants::kCachedCodeOffset,

View File

@ -32,7 +32,7 @@ class V8_EXPORT OSROptimizedCodeCache : public WeakFixedArray {
// kOSRCodeCacheInitialLength entries.
static void AddOptimizedCode(Handle<NativeContext> context,
Handle<SharedFunctionInfo> shared,
Handle<Code> code, BailoutId osr_offset);
Handle<Code> code, BytecodeOffset osr_offset);
// Reduces the size of the OSR code cache if the number of valid entries are
// less than the current capacity of the cache.
static void Compact(Handle<NativeContext> context);
@ -40,10 +40,10 @@ class V8_EXPORT OSROptimizedCodeCache : public WeakFixedArray {
static void Clear(NativeContext context);
// Returns the code corresponding to the shared function |shared| and
// BailoutId |offset| if an entry exists in the cache. Returns an empty
// BytecodeOffset |offset| if an entry exists in the cache. Returns an empty
// object otherwise.
Code GetOptimizedCode(Handle<SharedFunctionInfo> shared, BailoutId osr_offset,
Isolate* isolate);
Code GetOptimizedCode(Handle<SharedFunctionInfo> shared,
BytecodeOffset osr_offset, Isolate* isolate);
// Remove all code objects marked for deoptimization from OSR code cache.
void EvictMarkedCode(Isolate* isolate);
@ -58,12 +58,13 @@ class V8_EXPORT OSROptimizedCodeCache : public WeakFixedArray {
// Helper functions to get individual items from an entry in the cache.
Code GetCodeFromEntry(int index);
SharedFunctionInfo GetSFIFromEntry(int index);
BailoutId GetBailoutIdFromEntry(int index);
BytecodeOffset GetBytecodeOffsetFromEntry(int index);
inline int FindEntry(Handle<SharedFunctionInfo> shared, BailoutId osr_offset);
inline int FindEntry(Handle<SharedFunctionInfo> shared,
BytecodeOffset osr_offset);
inline void ClearEntry(int src, Isolate* isolate);
inline void InitializeEntry(int entry, SharedFunctionInfo shared, Code code,
BailoutId osr_offset);
BytecodeOffset osr_offset);
inline void MoveEntry(int src, int dst, Isolate* isolate);
OBJECT_CONSTRUCTORS(OSROptimizedCodeCache, WeakFixedArray);

View File

@ -283,13 +283,15 @@ static bool IsSuitableForOnStackReplacement(Isolate* isolate,
namespace {
BailoutId DetermineEntryAndDisarmOSRForInterpreter(JavaScriptFrame* frame) {
BytecodeOffset DetermineEntryAndDisarmOSRForInterpreter(
JavaScriptFrame* frame) {
InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame);
// Note that the bytecode array active on the stack might be different from
// the one installed on the function (e.g. patched by debugger). This however
// is fine because we guarantee the layout to be in sync, hence any BailoutId
// representing the entry point will be valid for any copy of the bytecode.
// is fine because we guarantee the layout to be in sync, hence any
// BytecodeOffset representing the entry point will be valid for any copy of
// the bytecode.
Handle<BytecodeArray> bytecode(iframe->GetBytecodeArray(), iframe->isolate());
DCHECK(frame->LookupCode().is_interpreter_trampoline_builtin());
@ -299,8 +301,9 @@ BailoutId DetermineEntryAndDisarmOSRForInterpreter(JavaScriptFrame* frame) {
// Reset the OSR loop nesting depth to disarm back edges.
bytecode->set_osr_loop_nesting_level(0);
// Return a BailoutId representing the bytecode offset of the back branch.
return BailoutId(iframe->GetBytecodeOffset());
// Return a BytecodeOffset representing the bytecode offset of the back
// branch.
return BytecodeOffset(iframe->GetBytecodeOffset());
}
} // namespace
@ -319,7 +322,7 @@ 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.
BailoutId ast_id = DetermineEntryAndDisarmOSRForInterpreter(frame);
BytecodeOffset ast_id = DetermineEntryAndDisarmOSRForInterpreter(frame);
DCHECK(!ast_id.IsNone());
MaybeHandle<Code> maybe_result;
@ -350,7 +353,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
DeoptimizationData::cast(result->deoptimization_data());
if (data.OsrPcOffset().value() >= 0) {
DCHECK(BailoutId(data.OsrBytecodeOffset().value()) == ast_id);
DCHECK(BytecodeOffset(data.OsrBytecodeOffset().value()) == ast_id);
if (FLAG_trace_osr) {
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintF(scope.file(),

View File

@ -80,12 +80,12 @@ std::ostream& operator<<(std::ostream& os, FeedbackSlot slot) {
return os << "#" << slot.id_;
}
size_t hash_value(BailoutId id) {
size_t hash_value(BytecodeOffset id) {
base::hash<int> h;
return h(id.id_);
}
std::ostream& operator<<(std::ostream& os, BailoutId id) {
std::ostream& operator<<(std::ostream& os, BytecodeOffset id) {
return os << id.id_;
}

View File

@ -569,29 +569,34 @@ class FeedbackSlot {
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, FeedbackSlot);
class BailoutId {
class BytecodeOffset {
public:
explicit BailoutId(int id) : id_(id) {}
explicit BytecodeOffset(int id) : id_(id) {}
int ToInt() const { return id_; }
static BailoutId None() { return BailoutId(kNoneId); }
static BytecodeOffset None() { return BytecodeOffset(kNoneId); }
// Special bailout id support for deopting into the {JSConstructStub} stub.
// The following hard-coded deoptimization points are supported by the stub:
// - {ConstructStubCreate} maps to {construct_stub_create_deopt_pc_offset}.
// - {ConstructStubInvoke} maps to {construct_stub_invoke_deopt_pc_offset}.
static BailoutId ConstructStubCreate() { return BailoutId(1); }
static BailoutId ConstructStubInvoke() { return BailoutId(2); }
static BytecodeOffset ConstructStubCreate() { return BytecodeOffset(1); }
static BytecodeOffset ConstructStubInvoke() { return BytecodeOffset(2); }
bool IsValidForConstructStub() const {
return id_ == ConstructStubCreate().ToInt() ||
id_ == ConstructStubInvoke().ToInt();
}
bool IsNone() const { return id_ == kNoneId; }
bool operator==(const BailoutId& other) const { return id_ == other.id_; }
bool operator!=(const BailoutId& other) const { return id_ != other.id_; }
friend size_t hash_value(BailoutId);
V8_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream&, BailoutId);
bool operator==(const BytecodeOffset& other) const {
return id_ == other.id_;
}
bool operator!=(const BytecodeOffset& other) const {
return id_ != other.id_;
}
friend size_t hash_value(BytecodeOffset);
V8_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream&,
BytecodeOffset);
private:
friend class Builtins;
@ -600,7 +605,7 @@ class BailoutId {
// Using 0 could disguise errors.
// Builtin continuations bailout ids start here. If you need to add a
// non-builtin BailoutId, add it before this id so that this Id has the
// non-builtin BytecodeOffset, add it before this id so that this Id has the
// highest number.
static const int kFirstBuiltinContinuationId = 1;

View File

@ -81,8 +81,8 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
graph.NewNode(common.StateValues(0, SparseInputMask::Dense()));
Node* state_node = graph.NewNode(
common.FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(),
nullptr),
common.FrameState(BytecodeOffset::None(),
OutputFrameStateCombine::Ignore(), nullptr),
parameters, locals, stack, context, UndefinedConstant(), graph.start());
return state_node;

View File

@ -333,7 +333,7 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
MachineType::AnyTagged(), MachineType::AnyTagged());
BailoutId bailout_id(42);
BytecodeOffset bailout_id(42);
Node* function_node = m.Parameter(0);
Node* receiver = m.Parameter(1);
@ -389,7 +389,7 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) {
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
MachineType::AnyTagged(), MachineType::AnyTagged());
BailoutId bailout_id_before(42);
BytecodeOffset bailout_id_before(42);
// Some arguments for the call node.
Node* function_node = m.Parameter(0);
@ -481,8 +481,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) {
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
MachineType::AnyTagged(), MachineType::AnyTagged());
BailoutId bailout_id_before(42);
BailoutId bailout_id_parent(62);
BytecodeOffset bailout_id_before(42);
BytecodeOffset bailout_id_parent(62);
// Some arguments for the call node.
Node* function_node = m.Parameter(0);

View File

@ -61,7 +61,7 @@ class BytecodeAnalysisTest : public TestWithIsolateAndZone {
Handle<BytecodeArray> bytecode,
const std::vector<std::pair<std::string, std::string>>&
expected_liveness) {
BytecodeAnalysis analysis(bytecode, zone(), BailoutId::None(), true);
BytecodeAnalysis analysis(bytecode, zone(), BytecodeOffset::None(), true);
interpreter::BytecodeArrayIterator iterator(bytecode);
for (auto liveness : expected_liveness) {

View File

@ -252,7 +252,7 @@ TEST_F(DecompressionOptimizerTest, TypedStateValues) {
Node* constant_2 =
graph()->NewNode(common()->HeapConstant(heap_constants[j]));
graph()->SetEnd(graph()->NewNode(
common()->FrameState(BailoutId::None(),
common()->FrameState(BytecodeOffset::None(),
OutputFrameStateCombine::Ignore(), nullptr),
typed_state_values, typed_state_values, typed_state_values,
constant_2, UndefinedConstant(), graph()->start()));

View File

@ -96,8 +96,8 @@ Node* GraphTest::EmptyFrameState() {
FrameStateType::kInterpretedFunction, 0, 0,
Handle<SharedFunctionInfo>());
return graph()->NewNode(
common()->FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(),
function_info),
common()->FrameState(BytecodeOffset::None(),
OutputFrameStateCombine::Ignore(), function_info),
state_values, state_values, state_values, NumberConstant(0),
UndefinedConstant(), graph()->start());
}

View File

@ -54,7 +54,7 @@ class JSCreateLoweringTest : public TypedGraphTest {
graph()->NewNode(common()->StateValues(0, SparseInputMask::Dense()));
return graph()->NewNode(
common()->FrameState(
BailoutId::None(), OutputFrameStateCombine::Ignore(),
BytecodeOffset::None(), OutputFrameStateCombine::Ignore(),
common()->CreateFrameStateFunctionInfo(
FrameStateType::kInterpretedFunction, 1, 0, shared)),
state_values, state_values, state_values, NumberConstant(0),

View File

@ -51,7 +51,7 @@ TEST_F(TestWithNativeContext, AddCodeToEmptyCache) {
Handle<NativeContext> native_context(function->native_context(), isolate);
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
Handle<Code> code(function->code(), isolate);
BailoutId bailout_id(1);
BytecodeOffset bailout_id(1);
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
bailout_id);
@ -88,14 +88,14 @@ TEST_F(TestWithNativeContext, GrowCodeCache) {
int bailout_id = 0;
for (bailout_id = 0; bailout_id < kInitialEntries; bailout_id++) {
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
}
Handle<OSROptimizedCodeCache> osr_cache(
native_context->GetOSROptimizedCodeCache(), isolate);
EXPECT_EQ(osr_cache->length(), kInitialLength);
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
osr_cache = Handle<OSROptimizedCodeCache>(
native_context->GetOSROptimizedCodeCache(), isolate);
EXPECT_EQ(osr_cache->length(), kInitialLength * 2);
@ -131,7 +131,7 @@ TEST_F(TestWithNativeContext, FindCachedEntry) {
int bailout_id = 0;
for (bailout_id = 0; bailout_id < kInitialEntries; bailout_id++) {
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
}
i::ScopedVector<char> source1(1024);
@ -140,24 +140,25 @@ TEST_F(TestWithNativeContext, FindCachedEntry) {
Handle<SharedFunctionInfo> shared1(function1->shared(), isolate);
Handle<Code> code1(function1->code(), isolate);
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared1, code1,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
Handle<OSROptimizedCodeCache> osr_cache(
native_context->GetOSROptimizedCodeCache(), isolate);
EXPECT_EQ(osr_cache->GetOptimizedCode(shared, BailoutId(0), isolate), *code);
EXPECT_EQ(osr_cache->GetOptimizedCode(shared, BytecodeOffset(0), isolate),
*code);
EXPECT_EQ(
osr_cache->GetOptimizedCode(shared1, BailoutId(bailout_id), isolate),
osr_cache->GetOptimizedCode(shared1, BytecodeOffset(bailout_id), isolate),
*code1);
RunJS("%DeoptimizeFunction(f1)");
EXPECT_TRUE(
osr_cache->GetOptimizedCode(shared1, BailoutId(bailout_id), isolate)
osr_cache->GetOptimizedCode(shared1, BytecodeOffset(bailout_id), isolate)
.is_null());
osr_cache->Set(OSROptimizedCodeCache::kCachedCodeOffset,
HeapObjectReference::ClearedValue(isolate));
EXPECT_TRUE(
osr_cache->GetOptimizedCode(shared, BailoutId(0), isolate).is_null());
EXPECT_TRUE(osr_cache->GetOptimizedCode(shared, BytecodeOffset(0), isolate)
.is_null());
}
TEST_F(TestWithNativeContext, MaxCapacityCache) {
@ -177,7 +178,7 @@ TEST_F(TestWithNativeContext, MaxCapacityCache) {
// Add max_capacity - 1 entries.
for (bailout_id = 0; bailout_id < kMaxEntries - 1; bailout_id++) {
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
}
Handle<OSROptimizedCodeCache> osr_cache(
native_context->GetOSROptimizedCodeCache(), isolate);
@ -190,7 +191,7 @@ TEST_F(TestWithNativeContext, MaxCapacityCache) {
Handle<SharedFunctionInfo> shared1(function1->shared(), isolate);
Handle<Code> code1(function1->code(), isolate);
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared1, code1,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
osr_cache = Handle<OSROptimizedCodeCache>(
native_context->GetOSROptimizedCodeCache(), isolate);
EXPECT_EQ(osr_cache->length(), kMaxLength);
@ -215,7 +216,7 @@ TEST_F(TestWithNativeContext, MaxCapacityCache) {
Handle<Code> code2(function2->code(), isolate);
bailout_id++;
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared2, code2,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
osr_cache = Handle<OSROptimizedCodeCache>(
native_context->GetOSROptimizedCodeCache(), isolate);
EXPECT_EQ(osr_cache->length(), kMaxLength);
@ -249,7 +250,7 @@ TEST_F(TestWithNativeContext, ReuseClearedEntry) {
int bailout_id = 0;
for (bailout_id = 0; bailout_id < num_entries; bailout_id++) {
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
}
Handle<OSROptimizedCodeCache> osr_cache(
native_context->GetOSROptimizedCodeCache(), isolate);
@ -268,7 +269,7 @@ TEST_F(TestWithNativeContext, ReuseClearedEntry) {
Handle<SharedFunctionInfo> shared1(function1->shared(), isolate);
Handle<Code> code1(function1->code(), isolate);
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared1, code1,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
osr_cache = Handle<OSROptimizedCodeCache>(
native_context->GetOSROptimizedCodeCache(), isolate);
EXPECT_EQ(osr_cache->length(), expected_length);
@ -292,7 +293,7 @@ TEST_F(TestWithNativeContext, ReuseClearedEntry) {
Handle<Code> code2(function2->code(), isolate);
bailout_id++;
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared2, code2,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
osr_cache = Handle<OSROptimizedCodeCache>(
native_context->GetOSROptimizedCodeCache(), isolate);
EXPECT_EQ(osr_cache->length(), expected_length);
@ -335,10 +336,10 @@ TEST_F(TestWithNativeContext, EvictDeoptedEntriesNoCompact) {
for (bailout_id = 0; bailout_id < num_entries; bailout_id++) {
if (bailout_id == deopt_id1 || bailout_id == deopt_id2) {
OSROptimizedCodeCache::AddOptimizedCode(
native_context, deopt_shared, deopt_code, BailoutId(bailout_id));
native_context, deopt_shared, deopt_code, BytecodeOffset(bailout_id));
} else {
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
}
}
Handle<OSROptimizedCodeCache> osr_cache(
@ -392,10 +393,10 @@ TEST_F(TestWithNativeContext, EvictDeoptedEntriesCompact) {
for (bailout_id = 0; bailout_id < num_entries; bailout_id++) {
if (bailout_id % 2 == 0) {
OSROptimizedCodeCache::AddOptimizedCode(
native_context, deopt_shared, deopt_code, BailoutId(bailout_id));
native_context, deopt_shared, deopt_code, BytecodeOffset(bailout_id));
} else {
OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code,
BailoutId(bailout_id));
BytecodeOffset(bailout_id));
}
}
Handle<OSROptimizedCodeCache> osr_cache(