Commit 652a3e13 authored by Georgia Kouveli's avatar Georgia Kouveli Committed by Commit Bot

Merge deoptimization type enums

Replace all uses of Deoptimizer::BailoutType and CodeEventListener::DeoptKind
with DeoptimizeKind from src/globals.h.

Change-Id: I5b9002583a69bc43d995cacc7619b018e5a70727
Reviewed-on: https://chromium-review.googlesource.com/1097331
Commit-Queue: Georgia Kouveli <georgia.kouveli@arm.com>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53695}
parent 249d0ea4
...@@ -86,7 +86,7 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -86,7 +86,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ JumpIfSmi(r1, &context_check); __ JumpIfSmi(r1, &context_check);
__ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ mov(r1, Operand(type())); // bailout type, __ mov(r1, Operand(static_cast<int>(deopt_kind())));
// r2: bailout id already loaded. // r2: bailout id already loaded.
// r3: code address or 0 already loaded. // r3: code address or 0 already loaded.
__ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta. __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta.
......
...@@ -155,7 +155,7 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -155,7 +155,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ Tst(x1, kSmiTagMask); __ Tst(x1, kSmiTagMask);
__ CzeroX(x0, eq); __ CzeroX(x0, eq);
__ Mov(x1, type()); __ Mov(x1, static_cast<int>(deopt_kind()));
// Following arguments are already loaded: // Following arguments are already loaded:
// - x2: bailout id // - x2: bailout id
// - x3: code object address // - x3: code object address
......
...@@ -601,8 +601,8 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT ...@@ -601,8 +601,8 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
os << " (" << reinterpret_cast<const void*>(target_address()) << ")"; os << " (" << reinterpret_cast<const void*>(target_address()) << ")";
} else if (IsRuntimeEntry(rmode_) && isolate->deoptimizer_data() != nullptr) { } else if (IsRuntimeEntry(rmode_) && isolate->deoptimizer_data() != nullptr) {
// Depotimization bailouts are stored as runtime entries. // Depotimization bailouts are stored as runtime entries.
int id = Deoptimizer::GetDeoptimizationId( int id = Deoptimizer::GetDeoptimizationId(isolate, target_address(),
isolate, target_address(), Deoptimizer::EAGER); DeoptimizeKind::kEager);
if (id != Deoptimizer::kNotDeoptimizationEntry) { if (id != Deoptimizer::kNotDeoptimizationEntry) {
os << " (deoptimization bailout " << id << ")"; os << " (deoptimization bailout " << id << ")";
} }
......
...@@ -88,8 +88,7 @@ class CodeEventListener { ...@@ -88,8 +88,7 @@ class CodeEventListener {
virtual void CodeMovingGCEvent() = 0; virtual void CodeMovingGCEvent() = 0;
virtual void CodeDisableOptEvent(AbstractCode* code, virtual void CodeDisableOptEvent(AbstractCode* code,
SharedFunctionInfo* shared) = 0; SharedFunctionInfo* shared) = 0;
enum DeoptKind { kSoft, kLazy, kEager }; virtual void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc,
virtual void CodeDeoptEvent(Code* code, DeoptKind kind, Address pc,
int fp_to_sp_delta) = 0; int fp_to_sp_delta) = 0;
virtual bool is_listening_to_code_events() { return false; } virtual bool is_listening_to_code_events() { return false; }
...@@ -165,7 +164,7 @@ class CodeEventDispatcher { ...@@ -165,7 +164,7 @@ class CodeEventDispatcher {
void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared) { void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared) {
CODE_EVENT_DISPATCH(CodeDisableOptEvent(code, shared)); CODE_EVENT_DISPATCH(CodeDisableOptEvent(code, shared));
} }
void CodeDeoptEvent(Code* code, CodeEventListener::DeoptKind kind, Address pc, void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta) { int fp_to_sp_delta) {
CODE_EVENT_DISPATCH(CodeDeoptEvent(code, kind, pc, fp_to_sp_delta)); CODE_EVENT_DISPATCH(CodeDeoptEvent(code, kind, pc, fp_to_sp_delta));
} }
......
...@@ -116,26 +116,10 @@ void CodeGenerator::CreateFrameAccessState(Frame* frame) { ...@@ -116,26 +116,10 @@ void CodeGenerator::CreateFrameAccessState(Frame* frame) {
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, SourcePosition pos) { int deoptimization_id, SourcePosition pos) {
DeoptimizeKind deopt_kind = GetDeoptimizationKind(deoptimization_id); DeoptimizeKind deopt_kind = GetDeoptimizationKind(deoptimization_id);
Deoptimizer::BailoutType bailout_type;
switch (deopt_kind) {
case DeoptimizeKind::kSoft: {
bailout_type = Deoptimizer::SOFT;
break;
}
case DeoptimizeKind::kEager: {
bailout_type = Deoptimizer::EAGER;
break;
}
case DeoptimizeKind::kLazy: {
bailout_type = Deoptimizer::LAZY;
break;
}
default: { UNREACHABLE(); }
}
DeoptimizeReason deoptimization_reason = DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id); GetDeoptimizationReason(deoptimization_id);
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
tasm()->isolate(), deoptimization_id, bailout_type); tasm()->isolate(), deoptimization_id, deopt_kind);
if (deopt_entry == kNullAddress) return kTooManyDeoptimizationBailouts; if (deopt_entry == kNullAddress) return kTooManyDeoptimizationBailouts;
if (info()->is_source_positions_enabled()) { if (info()->is_source_positions_enabled()) {
tasm()->RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); tasm()->RecordDeoptReason(deoptimization_reason, pos, deoptimization_id);
......
...@@ -131,24 +131,31 @@ class FrameWriter { ...@@ -131,24 +131,31 @@ class FrameWriter {
}; };
DeoptimizerData::DeoptimizerData(Heap* heap) : heap_(heap), current_(nullptr) { DeoptimizerData::DeoptimizerData(Heap* heap) : heap_(heap), current_(nullptr) {
for (int i = 0; i <= Deoptimizer::kLastBailoutType; ++i) { for (int i = 0; i <= DeoptimizerData::kLastDeoptimizeKind; ++i) {
deopt_entry_code_[i] = nullptr; deopt_entry_code_[i] = nullptr;
} }
Code** start = &deopt_entry_code_[0]; Code** start = &deopt_entry_code_[0];
Code** end = &deopt_entry_code_[Deoptimizer::kLastBailoutType + 1]; Code** end = &deopt_entry_code_[DeoptimizerData::kLastDeoptimizeKind + 1];
heap_->RegisterStrongRoots(reinterpret_cast<Object**>(start), heap_->RegisterStrongRoots(reinterpret_cast<Object**>(start),
reinterpret_cast<Object**>(end)); reinterpret_cast<Object**>(end));
} }
DeoptimizerData::~DeoptimizerData() { DeoptimizerData::~DeoptimizerData() {
for (int i = 0; i <= Deoptimizer::kLastBailoutType; ++i) { for (int i = 0; i <= DeoptimizerData::kLastDeoptimizeKind; ++i) {
deopt_entry_code_[i] = nullptr; deopt_entry_code_[i] = nullptr;
} }
Code** start = &deopt_entry_code_[0]; Code** start = &deopt_entry_code_[0];
heap_->UnregisterStrongRoots(reinterpret_cast<Object**>(start)); heap_->UnregisterStrongRoots(reinterpret_cast<Object**>(start));
} }
Code* DeoptimizerData::deopt_entry_code(DeoptimizeKind kind) {
return deopt_entry_code_[static_cast<int>(kind)];
}
void DeoptimizerData::set_deopt_entry_code(DeoptimizeKind kind, Code* code) {
deopt_entry_code_[static_cast<int>(kind)] = code;
}
Code* Deoptimizer::FindDeoptimizingCode(Address addr) { Code* Deoptimizer::FindDeoptimizingCode(Address addr) {
if (function_->IsHeapObject()) { if (function_->IsHeapObject()) {
...@@ -169,13 +176,10 @@ Code* Deoptimizer::FindDeoptimizingCode(Address addr) { ...@@ -169,13 +176,10 @@ Code* Deoptimizer::FindDeoptimizingCode(Address addr) {
// We rely on this function not causing a GC. It is called from generated code // We rely on this function not causing a GC. It is called from generated code
// without having a real stack frame in place. // without having a real stack frame in place.
Deoptimizer* Deoptimizer::New(JSFunction* function, Deoptimizer* Deoptimizer::New(JSFunction* function, DeoptimizeKind kind,
BailoutType type, unsigned bailout_id, Address from,
unsigned bailout_id, int fp_to_sp_delta, Isolate* isolate) {
Address from, Deoptimizer* deoptimizer = new Deoptimizer(isolate, function, kind,
int fp_to_sp_delta,
Isolate* isolate) {
Deoptimizer* deoptimizer = new Deoptimizer(isolate, function, type,
bailout_id, from, fp_to_sp_delta); bailout_id, from, fp_to_sp_delta);
CHECK_NULL(isolate->deoptimizer_data()->current_); CHECK_NULL(isolate->deoptimizer_data()->current_);
isolate->deoptimizer_data()->current_ = deoptimizer; isolate->deoptimizer_data()->current_ = deoptimizer;
...@@ -226,11 +230,10 @@ DeoptimizedFrameInfo* Deoptimizer::DebuggerInspectableFrame( ...@@ -226,11 +230,10 @@ DeoptimizedFrameInfo* Deoptimizer::DebuggerInspectableFrame(
return info; return info;
} }
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, int count,
int count, DeoptimizeKind kind) {
BailoutType type) {
NoRootArrayScope no_root_array(masm); NoRootArrayScope no_root_array(masm);
TableEntryGenerator generator(masm, type, count); TableEntryGenerator generator(masm, kind, count);
generator.Generate(); generator.Generate();
} }
...@@ -457,41 +460,26 @@ void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer) { ...@@ -457,41 +460,26 @@ void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer) {
deoptimizer->DoComputeOutputFrames(); deoptimizer->DoComputeOutputFrames();
} }
const char* Deoptimizer::MessageFor(DeoptimizeKind kind) {
const char* Deoptimizer::MessageFor(BailoutType type) { switch (kind) {
switch (type) { case DeoptimizeKind::kEager:
case EAGER: return "eager"; return "eager";
case SOFT: return "soft"; case DeoptimizeKind::kSoft:
case LAZY: return "lazy"; return "soft";
case DeoptimizeKind::kLazy:
return "lazy";
} }
FATAL("Unsupported deopt type"); FATAL("Unsupported deopt kind");
return nullptr; return nullptr;
} }
namespace {
CodeEventListener::DeoptKind DeoptKindOfBailoutType(
Deoptimizer::BailoutType bailout_type) {
switch (bailout_type) {
case Deoptimizer::EAGER:
return CodeEventListener::kEager;
case Deoptimizer::SOFT:
return CodeEventListener::kSoft;
case Deoptimizer::LAZY:
return CodeEventListener::kLazy;
}
UNREACHABLE();
}
} // namespace
Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function, Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function,
BailoutType type, unsigned bailout_id, Address from, DeoptimizeKind kind, unsigned bailout_id, Address from,
int fp_to_sp_delta) int fp_to_sp_delta)
: isolate_(isolate), : isolate_(isolate),
function_(function), function_(function),
bailout_id_(bailout_id), bailout_id_(bailout_id),
bailout_type_(type), deopt_kind_(kind),
from_(from), from_(from),
fp_to_sp_delta_(fp_to_sp_delta), fp_to_sp_delta_(fp_to_sp_delta),
deoptimizing_throw_(false), deoptimizing_throw_(false),
...@@ -531,7 +519,7 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function, ...@@ -531,7 +519,7 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function,
// increment the function's deopt count so that we can avoid optimising // increment the function's deopt count so that we can avoid optimising
// functions that deopt too often. // functions that deopt too often.
if (bailout_type_ == Deoptimizer::SOFT) { if (deopt_kind_ == DeoptimizeKind::kSoft) {
// Soft deopts shouldn't count against the overall deoptimization count // Soft deopts shouldn't count against the overall deoptimization count
// that can eventually lead to disabling optimization for a function. // that can eventually lead to disabling optimization for a function.
isolate->counters()->soft_deopts_executed()->Increment(); isolate->counters()->soft_deopts_executed()->Increment();
...@@ -542,8 +530,7 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function, ...@@ -542,8 +530,7 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction* function,
if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
compiled_code_->set_deopt_already_counted(true); compiled_code_->set_deopt_already_counted(true);
PROFILE(isolate_, PROFILE(isolate_,
CodeDeoptEvent(compiled_code_, DeoptKindOfBailoutType(type), from_, CodeDeoptEvent(compiled_code_, kind, from_, fp_to_sp_delta_));
fp_to_sp_delta_));
} }
unsigned size = ComputeInputFrameSize(); unsigned size = ComputeInputFrameSize();
int parameter_count = int parameter_count =
...@@ -599,23 +586,21 @@ void Deoptimizer::DeleteFrameDescriptions() { ...@@ -599,23 +586,21 @@ void Deoptimizer::DeleteFrameDescriptions() {
} }
Address Deoptimizer::GetDeoptimizationEntry(Isolate* isolate, int id, Address Deoptimizer::GetDeoptimizationEntry(Isolate* isolate, int id,
BailoutType type) { DeoptimizeKind kind) {
CHECK_GE(id, 0); CHECK_GE(id, 0);
if (id >= kMaxNumberOfEntries) return kNullAddress; if (id >= kMaxNumberOfEntries) return kNullAddress;
DeoptimizerData* data = isolate->deoptimizer_data(); DeoptimizerData* data = isolate->deoptimizer_data();
CHECK_LE(type, kLastBailoutType); CHECK_LE(kind, DeoptimizerData::kLastDeoptimizeKind);
CHECK_NOT_NULL(data->deopt_entry_code_[type]); CHECK_NOT_NULL(data->deopt_entry_code(kind));
Code* code = data->deopt_entry_code_[type]; Code* code = data->deopt_entry_code(kind);
return code->raw_instruction_start() + (id * table_entry_size_); return code->raw_instruction_start() + (id * table_entry_size_);
} }
int Deoptimizer::GetDeoptimizationId(Isolate* isolate, Address addr,
int Deoptimizer::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
Address addr,
BailoutType type) {
DeoptimizerData* data = isolate->deoptimizer_data(); DeoptimizerData* data = isolate->deoptimizer_data();
CHECK_LE(type, kLastBailoutType); CHECK_LE(kind, DeoptimizerData::kLastDeoptimizeKind);
Code* code = data->deopt_entry_code_[type]; Code* code = data->deopt_entry_code(kind);
if (code == nullptr) return kNotDeoptimizationEntry; if (code == nullptr) return kNotDeoptimizationEntry;
Address start = code->raw_instruction_start(); Address start = code->raw_instruction_start();
if (addr < start || if (addr < start ||
...@@ -627,7 +612,6 @@ int Deoptimizer::GetDeoptimizationId(Isolate* isolate, ...@@ -627,7 +612,6 @@ int Deoptimizer::GetDeoptimizationId(Isolate* isolate,
return static_cast<int>(addr - start) / table_entry_size_; return static_cast<int>(addr - start) / table_entry_size_;
} }
int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) { int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) {
int length = 0; int length = 0;
// Count all entries in the deoptimizing code list of every context. // Count all entries in the deoptimizing code list of every context.
...@@ -708,14 +692,15 @@ void Deoptimizer::DoComputeOutputFrames() { ...@@ -708,14 +692,15 @@ void Deoptimizer::DoComputeOutputFrames() {
if (trace_scope_ != nullptr) { if (trace_scope_ != nullptr) {
timer.Start(); timer.Start();
PrintF(trace_scope_->file(), "[deoptimizing (DEOPT %s): begin ", PrintF(trace_scope_->file(), "[deoptimizing (DEOPT %s): begin ",
MessageFor(bailout_type_)); MessageFor(deopt_kind_));
PrintFunctionName(); PrintFunctionName();
PrintF(trace_scope_->file(), PrintF(trace_scope_->file(),
" (opt #%d) @%d, FP to SP delta: %d, caller sp: " V8PRIxPTR_FMT " (opt #%d) @%d, FP to SP delta: %d, caller sp: " V8PRIxPTR_FMT
"]\n", "]\n",
input_data->OptimizationId()->value(), bailout_id_, fp_to_sp_delta_, input_data->OptimizationId()->value(), bailout_id_, fp_to_sp_delta_,
caller_frame_top_); caller_frame_top_);
if (bailout_type_ == EAGER || bailout_type_ == SOFT) { if (deopt_kind_ == DeoptimizeKind::kEager ||
deopt_kind_ == DeoptimizeKind::kSoft) {
compiled_code_->PrintDeoptLocation( compiled_code_->PrintDeoptLocation(
trace_scope_->file(), " ;;; deoptimize at ", from_); trace_scope_->file(), " ;;; deoptimize at ", from_);
} }
...@@ -804,7 +789,7 @@ void Deoptimizer::DoComputeOutputFrames() { ...@@ -804,7 +789,7 @@ void Deoptimizer::DoComputeOutputFrames() {
double ms = timer.Elapsed().InMillisecondsF(); double ms = timer.Elapsed().InMillisecondsF();
int index = output_count_ - 1; // Index of the topmost frame. int index = output_count_ - 1; // Index of the topmost frame.
PrintF(trace_scope_->file(), "[deoptimizing (%s): end ", PrintF(trace_scope_->file(), "[deoptimizing (%s): end ",
MessageFor(bailout_type_)); MessageFor(deopt_kind_));
PrintFunctionName(); PrintFunctionName();
PrintF(trace_scope_->file(), PrintF(trace_scope_->file(),
" @%d => node=%d, pc=" V8PRIxPTR_FMT ", caller sp=" V8PRIxPTR_FMT " @%d => node=%d, pc=" V8PRIxPTR_FMT ", caller sp=" V8PRIxPTR_FMT
...@@ -1017,7 +1002,8 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame, ...@@ -1017,7 +1002,8 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame,
// simulating what normal handlers do upon completion of the operation. // simulating what normal handlers do upon completion of the operation.
Builtins* builtins = isolate_->builtins(); Builtins* builtins = isolate_->builtins();
Code* dispatch_builtin = Code* dispatch_builtin =
(!is_topmost || (bailout_type_ == LAZY)) && !goto_catch_handler (!is_topmost || (deopt_kind_ == DeoptimizeKind::kLazy)) &&
!goto_catch_handler
? builtins->builtin(Builtins::kInterpreterEnterBytecodeAdvance) ? builtins->builtin(Builtins::kInterpreterEnterBytecodeAdvance)
: builtins->builtin(Builtins::kInterpreterEnterBytecodeDispatch); : builtins->builtin(Builtins::kInterpreterEnterBytecodeDispatch);
output_frame->SetPc( output_frame->SetPc(
...@@ -1157,8 +1143,8 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame, ...@@ -1157,8 +1143,8 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
bool is_topmost = (output_count_ - 1 == frame_index); bool is_topmost = (output_count_ - 1 == frame_index);
// The construct frame could become topmost only if we inlined a constructor // The construct frame could become topmost only if we inlined a constructor
// call which does a tail call (otherwise the tail callee's frame would be // call which does a tail call (otherwise the tail callee's frame would be
// the topmost one). So it could only be the LAZY case. // the topmost one). So it could only be the DeoptimizeKind::kLazy case.
CHECK(!is_topmost || bailout_type_ == LAZY); CHECK(!is_topmost || deopt_kind_ == DeoptimizeKind::kLazy);
Builtins* builtins = isolate_->builtins(); Builtins* builtins = isolate_->builtins();
Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
...@@ -1323,7 +1309,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame, ...@@ -1323,7 +1309,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
// Set the continuation for the topmost frame. // Set the continuation for the topmost frame.
if (is_topmost) { if (is_topmost) {
Builtins* builtins = isolate_->builtins(); Builtins* builtins = isolate_->builtins();
DCHECK_EQ(LAZY, bailout_type_); DCHECK_EQ(DeoptimizeKind::kLazy, deopt_kind_);
Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized); Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized);
output_frame->SetContinuation( output_frame->SetContinuation(
static_cast<intptr_t>(continuation->InstructionStart())); static_cast<intptr_t>(continuation->InstructionStart()));
...@@ -1465,7 +1451,8 @@ void Deoptimizer::DoComputeBuiltinContinuation( ...@@ -1465,7 +1451,8 @@ void Deoptimizer::DoComputeBuiltinContinuation(
const bool is_bottommost = (0 == frame_index); const bool is_bottommost = (0 == frame_index);
const bool is_topmost = (output_count_ - 1 == frame_index); const bool is_topmost = (output_count_ - 1 == frame_index);
const bool must_handle_result = !is_topmost || bailout_type_ == LAZY; const bool must_handle_result =
!is_topmost || deopt_kind_ == DeoptimizeKind::kLazy;
const RegisterConfiguration* config(RegisterConfiguration::Default()); const RegisterConfiguration* config(RegisterConfiguration::Default());
const int allocatable_register_count = const int allocatable_register_count =
...@@ -1813,14 +1800,15 @@ unsigned Deoptimizer::ComputeIncomingArgumentSize(SharedFunctionInfo* shared) { ...@@ -1813,14 +1800,15 @@ unsigned Deoptimizer::ComputeIncomingArgumentSize(SharedFunctionInfo* shared) {
} }
void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate, void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
BailoutType type) { DeoptimizeKind kind) {
CHECK(type == EAGER || type == SOFT || type == LAZY); CHECK(kind == DeoptimizeKind::kEager || kind == DeoptimizeKind::kSoft ||
kind == DeoptimizeKind::kLazy);
DeoptimizerData* data = isolate->deoptimizer_data(); DeoptimizerData* data = isolate->deoptimizer_data();
if (data->deopt_entry_code_[type] != nullptr) return; if (data->deopt_entry_code(kind) != nullptr) return;
MacroAssembler masm(isolate, nullptr, 16 * KB, CodeObjectRequired::kYes); MacroAssembler masm(isolate, nullptr, 16 * KB, CodeObjectRequired::kYes);
masm.set_emit_debug_code(false); masm.set_emit_debug_code(false);
GenerateDeoptimizationEntries(&masm, kMaxNumberOfEntries, type); GenerateDeoptimizationEntries(&masm, kMaxNumberOfEntries, kind);
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
DCHECK(!RelocInfo::RequiresRelocation(desc)); DCHECK(!RelocInfo::RequiresRelocation(desc));
...@@ -1832,14 +1820,14 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate, ...@@ -1832,14 +1820,14 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
MaybeHandle<ByteArray>(), MaybeHandle<DeoptimizationData>(), kImmovable); MaybeHandle<ByteArray>(), MaybeHandle<DeoptimizationData>(), kImmovable);
CHECK(Heap::IsImmovable(*code)); CHECK(Heap::IsImmovable(*code));
CHECK_NULL(data->deopt_entry_code_[type]); CHECK_NULL(data->deopt_entry_code(kind));
data->deopt_entry_code_[type] = *code; data->set_deopt_entry_code(kind, *code);
} }
void Deoptimizer::EnsureCodeForMaxDeoptimizationEntries(Isolate* isolate) { void Deoptimizer::EnsureCodeForMaxDeoptimizationEntries(Isolate* isolate) {
EnsureCodeForDeoptimizationEntry(isolate, EAGER); EnsureCodeForDeoptimizationEntry(isolate, DeoptimizeKind::kEager);
EnsureCodeForDeoptimizationEntry(isolate, LAZY); EnsureCodeForDeoptimizationEntry(isolate, DeoptimizeKind::kLazy);
EnsureCodeForDeoptimizationEntry(isolate, SOFT); EnsureCodeForDeoptimizationEntry(isolate, DeoptimizeKind::kSoft);
} }
FrameDescription::FrameDescription(uint32_t frame_size, int parameter_count) FrameDescription::FrameDescription(uint32_t frame_size, int parameter_count)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "src/deoptimize-reason.h" #include "src/deoptimize-reason.h"
#include "src/feedback-vector.h" #include "src/feedback-vector.h"
#include "src/frame-constants.h" #include "src/frame-constants.h"
#include "src/globals.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/source-position.h" #include "src/source-position.h"
...@@ -392,8 +393,6 @@ class OptimizedFunctionVisitor BASE_EMBEDDED { ...@@ -392,8 +393,6 @@ class OptimizedFunctionVisitor BASE_EMBEDDED {
class Deoptimizer : public Malloced { class Deoptimizer : public Malloced {
public: public:
enum BailoutType { EAGER, LAZY, SOFT, kLastBailoutType = SOFT };
struct DeoptInfo { struct DeoptInfo {
DeoptInfo(SourcePosition position, DeoptimizeReason deopt_reason, DeoptInfo(SourcePosition position, DeoptimizeReason deopt_reason,
int deopt_id) int deopt_id)
...@@ -413,41 +412,38 @@ class Deoptimizer : public Malloced { ...@@ -413,41 +412,38 @@ class Deoptimizer : public Malloced {
struct JumpTableEntry : public ZoneObject { struct JumpTableEntry : public ZoneObject {
inline JumpTableEntry(Address entry, const DeoptInfo& deopt_info, inline JumpTableEntry(Address entry, const DeoptInfo& deopt_info,
Deoptimizer::BailoutType type, bool frame) DeoptimizeKind kind, bool frame)
: label(), : label(),
address(entry), address(entry),
deopt_info(deopt_info), deopt_info(deopt_info),
bailout_type(type), deopt_kind(kind),
needs_frame(frame) {} needs_frame(frame) {}
bool IsEquivalentTo(const JumpTableEntry& other) const { bool IsEquivalentTo(const JumpTableEntry& other) const {
return address == other.address && bailout_type == other.bailout_type && return address == other.address && deopt_kind == other.deopt_kind &&
needs_frame == other.needs_frame; needs_frame == other.needs_frame;
} }
Label label; Label label;
Address address; Address address;
DeoptInfo deopt_info; DeoptInfo deopt_info;
Deoptimizer::BailoutType bailout_type; DeoptimizeKind deopt_kind;
bool needs_frame; bool needs_frame;
}; };
static const char* MessageFor(BailoutType type); static const char* MessageFor(DeoptimizeKind kind);
int output_count() const { return output_count_; } int output_count() const { return output_count_; }
Handle<JSFunction> function() const; Handle<JSFunction> function() const;
Handle<Code> compiled_code() const; Handle<Code> compiled_code() const;
BailoutType bailout_type() const { return bailout_type_; } DeoptimizeKind deopt_kind() const { return deopt_kind_; }
// Number of created JS frames. Not all created frames are necessarily JS. // Number of created JS frames. Not all created frames are necessarily JS.
int jsframe_count() const { return jsframe_count_; } int jsframe_count() const { return jsframe_count_; }
static Deoptimizer* New(JSFunction* function, static Deoptimizer* New(JSFunction* function, DeoptimizeKind kind,
BailoutType type, unsigned bailout_id, Address from, int fp_to_sp_delta,
unsigned bailout_id,
Address from,
int fp_to_sp_delta,
Isolate* isolate); Isolate* isolate);
static Deoptimizer* Grab(Isolate* isolate); static Deoptimizer* Grab(Isolate* isolate);
...@@ -478,10 +474,9 @@ class Deoptimizer : public Malloced { ...@@ -478,10 +474,9 @@ class Deoptimizer : public Malloced {
static void ComputeOutputFrames(Deoptimizer* deoptimizer); static void ComputeOutputFrames(Deoptimizer* deoptimizer);
static Address GetDeoptimizationEntry(Isolate* isolate, int id, static Address GetDeoptimizationEntry(Isolate* isolate, int id,
BailoutType type); DeoptimizeKind kind);
static int GetDeoptimizationId(Isolate* isolate, static int GetDeoptimizationId(Isolate* isolate, Address addr,
Address addr, DeoptimizeKind kind);
BailoutType type);
// Code generation support. // Code generation support.
static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } static int input_offset() { return OFFSET_OF(Deoptimizer, input_); }
...@@ -501,14 +496,14 @@ class Deoptimizer : public Malloced { ...@@ -501,14 +496,14 @@ class Deoptimizer : public Malloced {
// Generators for the deoptimization entry code. // Generators for the deoptimization entry code.
class TableEntryGenerator BASE_EMBEDDED { class TableEntryGenerator BASE_EMBEDDED {
public: public:
TableEntryGenerator(MacroAssembler* masm, BailoutType type, int count) TableEntryGenerator(MacroAssembler* masm, DeoptimizeKind kind, int count)
: masm_(masm), type_(type), count_(count) {} : masm_(masm), deopt_kind_(kind), count_(count) {}
void Generate(); void Generate();
protected: protected:
MacroAssembler* masm() const { return masm_; } MacroAssembler* masm() const { return masm_; }
BailoutType type() const { return type_; } DeoptimizeKind deopt_kind() const { return deopt_kind_; }
Isolate* isolate() const { return masm_->isolate(); } Isolate* isolate() const { return masm_->isolate(); }
void GeneratePrologue(); void GeneratePrologue();
...@@ -517,12 +512,12 @@ class Deoptimizer : public Malloced { ...@@ -517,12 +512,12 @@ class Deoptimizer : public Malloced {
int count() const { return count_; } int count() const { return count_; }
MacroAssembler* masm_; MacroAssembler* masm_;
Deoptimizer::BailoutType type_; DeoptimizeKind deopt_kind_;
int count_; int count_;
}; };
static void EnsureCodeForDeoptimizationEntry(Isolate* isolate, static void EnsureCodeForDeoptimizationEntry(Isolate* isolate,
BailoutType type); DeoptimizeKind kind);
static void EnsureCodeForMaxDeoptimizationEntries(Isolate* isolate); static void EnsureCodeForMaxDeoptimizationEntries(Isolate* isolate);
Isolate* isolate() const { return isolate_; } Isolate* isolate() const { return isolate_; }
...@@ -535,7 +530,7 @@ class Deoptimizer : public Malloced { ...@@ -535,7 +530,7 @@ class Deoptimizer : public Malloced {
static const int kMinNumberOfEntries = 64; static const int kMinNumberOfEntries = 64;
static const int kMaxNumberOfEntries = 16384; static const int kMaxNumberOfEntries = 16384;
Deoptimizer(Isolate* isolate, JSFunction* function, BailoutType type, Deoptimizer(Isolate* isolate, JSFunction* function, DeoptimizeKind kind,
unsigned bailout_id, Address from, int fp_to_sp_delta); unsigned bailout_id, Address from, int fp_to_sp_delta);
Code* FindOptimizedCode(); Code* FindOptimizedCode();
void PrintFunctionName(); void PrintFunctionName();
...@@ -573,8 +568,8 @@ class Deoptimizer : public Malloced { ...@@ -573,8 +568,8 @@ class Deoptimizer : public Malloced {
static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo* shared); static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo* shared);
static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id); static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id);
static void GenerateDeoptimizationEntries( static void GenerateDeoptimizationEntries(MacroAssembler* masm, int count,
MacroAssembler* masm, int count, BailoutType type); DeoptimizeKind kind);
// Marks all the code in the given context for deoptimization. // Marks all the code in the given context for deoptimization.
static void MarkAllCodeForContext(Context* native_context); static void MarkAllCodeForContext(Context* native_context);
...@@ -595,7 +590,7 @@ class Deoptimizer : public Malloced { ...@@ -595,7 +590,7 @@ class Deoptimizer : public Malloced {
JSFunction* function_; JSFunction* function_;
Code* compiled_code_; Code* compiled_code_;
unsigned bailout_id_; unsigned bailout_id_;
BailoutType bailout_type_; DeoptimizeKind deopt_kind_;
Address from_; Address from_;
int fp_to_sp_delta_; int fp_to_sp_delta_;
bool deoptimizing_throw_; bool deoptimizing_throw_;
...@@ -846,7 +841,11 @@ class DeoptimizerData { ...@@ -846,7 +841,11 @@ class DeoptimizerData {
private: private:
Heap* heap_; Heap* heap_;
Code* deopt_entry_code_[Deoptimizer::kLastBailoutType + 1]; static const int kLastDeoptimizeKind =
static_cast<int>(DeoptimizeKind::kLastDeoptimizeKind);
Code* deopt_entry_code_[kLastDeoptimizeKind + 1];
Code* deopt_entry_code(DeoptimizeKind kind);
void set_deopt_entry_code(DeoptimizeKind kind, Code* code);
Deoptimizer* current_; Deoptimizer* current_;
......
...@@ -160,11 +160,13 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate, ...@@ -160,11 +160,13 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
// A runtime entry reloinfo might be a deoptimization bailout-> // A runtime entry reloinfo might be a deoptimization bailout->
Address addr = relocinfo->target_address(); Address addr = relocinfo->target_address();
int id = int id =
Deoptimizer::GetDeoptimizationId(isolate, addr, Deoptimizer::EAGER); Deoptimizer::GetDeoptimizationId(isolate, addr, DeoptimizeKind::kEager);
if (id == Deoptimizer::kNotDeoptimizationEntry) { if (id == Deoptimizer::kNotDeoptimizationEntry) {
id = Deoptimizer::GetDeoptimizationId(isolate, addr, Deoptimizer::LAZY); id = Deoptimizer::GetDeoptimizationId(isolate, addr,
DeoptimizeKind::kLazy);
if (id == Deoptimizer::kNotDeoptimizationEntry) { if (id == Deoptimizer::kNotDeoptimizationEntry) {
id = Deoptimizer::GetDeoptimizationId(isolate, addr, Deoptimizer::SOFT); id = Deoptimizer::GetDeoptimizationId(isolate, addr,
DeoptimizeKind::kSoft);
if (id == Deoptimizer::kNotDeoptimizationEntry) { if (id == Deoptimizer::kNotDeoptimizationEntry) {
out->AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); out->AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode));
} else { } else {
......
...@@ -373,8 +373,20 @@ constexpr int kNoSourcePosition = -1; ...@@ -373,8 +373,20 @@ constexpr int kNoSourcePosition = -1;
// This constant is used to indicate missing deoptimization information. // This constant is used to indicate missing deoptimization information.
constexpr int kNoDeoptimizationId = -1; constexpr int kNoDeoptimizationId = -1;
// Deoptimize bailout kind. // Deoptimize bailout kind:
enum class DeoptimizeKind : uint8_t { kEager, kSoft, kLazy }; // - Eager: a check failed in the optimized code and deoptimization happens
// immediately.
// - Lazy: the code has been marked as dependent on some assumption which
// is checked elsewhere and can trigger deoptimization the next time the
// code is executed.
// - Soft: similar to lazy deoptimization, but does not contribute to the
// total deopt count which can lead to disabling optimization for a function.
enum class DeoptimizeKind : uint8_t {
kEager,
kSoft,
kLazy,
kLastDeoptimizeKind = kLazy
};
inline size_t hash_value(DeoptimizeKind kind) { inline size_t hash_value(DeoptimizeKind kind) {
return static_cast<size_t>(kind); return static_cast<size_t>(kind);
} }
......
...@@ -72,7 +72,8 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -72,7 +72,8 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ mov(Operand(esp, 0 * kPointerSize), eax); // Function. __ mov(Operand(esp, 0 * kPointerSize), eax); // Function.
__ mov(Operand(esp, 1 * kPointerSize), Immediate(type())); // Bailout type. __ mov(Operand(esp, 1 * kPointerSize),
Immediate(static_cast<int>(deopt_kind())));
__ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id. __ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id.
__ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0. __ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0.
__ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta. __ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta.
......
...@@ -1045,7 +1045,7 @@ void Logger::SharedLibraryEvent(const std::string& library_path, ...@@ -1045,7 +1045,7 @@ void Logger::SharedLibraryEvent(const std::string& library_path,
msg.WriteToLogFile(); msg.WriteToLogFile();
} }
void Logger::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, void Logger::CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta) { int fp_to_sp_delta) {
if (!log_->IsEnabled()) return; if (!log_->IsEnabled()) return;
Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc); Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc);
...@@ -1066,17 +1066,7 @@ void Logger::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, ...@@ -1066,17 +1066,7 @@ void Logger::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc,
deopt_location << "<unknown>"; deopt_location << "<unknown>";
} }
msg << kNext << inlining_id << kNext << script_offset << kNext; msg << kNext << inlining_id << kNext << script_offset << kNext;
switch (kind) { msg << Deoptimizer::MessageFor(kind) << kNext;
case kLazy:
msg << "lazy" << kNext;
break;
case kSoft:
msg << "soft" << kNext;
break;
case kEager:
msg << "eager" << kNext;
break;
}
msg << deopt_location.str().c_str() << kNext msg << deopt_location.str().c_str() << kNext
<< DeoptimizeReasonToString(info.deopt_reason); << DeoptimizeReasonToString(info.deopt_reason);
msg.WriteToLogFile(); msg.WriteToLogFile();
......
...@@ -220,7 +220,7 @@ class Logger : public CodeEventListener { ...@@ -220,7 +220,7 @@ class Logger : public CodeEventListener {
void CodeNameEvent(Address addr, int pos, const char* code_name); void CodeNameEvent(Address addr, int pos, const char* code_name);
void CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta); int fp_to_sp_delta);
void ICEvent(const char* type, bool keyed, Map* map, Object* key, void ICEvent(const char* type, bool keyed, Map* map, Object* key,
...@@ -419,7 +419,7 @@ class CodeEventLogger : public CodeEventListener { ...@@ -419,7 +419,7 @@ class CodeEventLogger : public CodeEventListener {
void SetterCallbackEvent(Name* name, Address entry_point) override {} void SetterCallbackEvent(Name* name, Address entry_point) override {}
void SharedFunctionInfoMoveEvent(Address from, Address to) override {} void SharedFunctionInfoMoveEvent(Address from, Address to) override {}
void CodeMovingGCEvent() override {} void CodeMovingGCEvent() override {}
void CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta) override {} int fp_to_sp_delta) override {}
private: private:
...@@ -470,7 +470,7 @@ class ExternalCodeEventListener : public CodeEventListener { ...@@ -470,7 +470,7 @@ class ExternalCodeEventListener : public CodeEventListener {
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode* code,
SharedFunctionInfo* shared) override {} SharedFunctionInfo* shared) override {}
void CodeMovingGCEvent() override {} void CodeMovingGCEvent() override {}
void CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta) override {} int fp_to_sp_delta) override {}
void StartListening(CodeEventHandler* code_event_handler); void StartListening(CodeEventHandler* code_event_handler);
......
...@@ -84,7 +84,7 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -84,7 +84,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ JumpIfSmi(a1, &context_check); __ JumpIfSmi(a1, &context_check);
__ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ li(a1, Operand(type())); // Bailout type. __ li(a1, Operand(static_cast<int>(deopt_kind())));
// a2: bailout id already loaded. // a2: bailout id already loaded.
// a3: code address or 0 already loaded. // a3: code address or 0 already loaded.
__ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta. __ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta.
......
...@@ -84,7 +84,7 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -84,7 +84,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ JumpIfSmi(a1, &context_check); __ JumpIfSmi(a1, &context_check);
__ Ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); __ Ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ li(a1, Operand(type())); // Bailout type. __ li(a1, Operand(static_cast<int>(deopt_kind())));
// a2: bailout id already loaded. // a2: bailout id already loaded.
// a3: code address or 0 already loaded. // a3: code address or 0 already loaded.
// a4: already has fp-to-sp delta. // a4: already has fp-to-sp delta.
......
...@@ -83,7 +83,7 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -83,7 +83,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ JumpIfSmi(r4, &context_check); __ JumpIfSmi(r4, &context_check);
__ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ li(r4, Operand(type())); // bailout type, __ li(r4, Operand(static_cast<int>(deopt_kind())));
// r5: bailout id already loaded. // r5: bailout id already loaded.
// r6: code address or 0 already loaded. // r6: code address or 0 already loaded.
// r7: Fp-to-sp delta. // r7: Fp-to-sp delta.
......
...@@ -142,8 +142,8 @@ void ProfilerListener::CodeDisableOptEvent(AbstractCode* code, ...@@ -142,8 +142,8 @@ void ProfilerListener::CodeDisableOptEvent(AbstractCode* code,
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
} }
void ProfilerListener::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, void ProfilerListener::CodeDeoptEvent(Code* code, DeoptimizeKind kind,
int fp_to_sp_delta) { Address pc, int fp_to_sp_delta) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT); CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT);
CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_; CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_;
Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc); Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc);
......
...@@ -47,7 +47,7 @@ class ProfilerListener : public CodeEventListener { ...@@ -47,7 +47,7 @@ class ProfilerListener : public CodeEventListener {
void CodeMoveEvent(AbstractCode* from, Address to) override; void CodeMoveEvent(AbstractCode* from, Address to) override;
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode* code,
SharedFunctionInfo* shared) override; SharedFunctionInfo* shared) override;
void CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta) override; int fp_to_sp_delta) override;
void GetterCallbackEvent(Name* name, Address entry_point) override; void GetterCallbackEvent(Name* name, Address entry_point) override;
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; void RegExpCodeCreateEvent(AbstractCode* code, String* source) override;
......
...@@ -153,7 +153,7 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) { ...@@ -153,7 +153,7 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) {
TimerEventScope<TimerEventDeoptimizeCode> timer(isolate); TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
TRACE_EVENT0("v8", "V8.DeoptimizeCode"); TRACE_EVENT0("v8", "V8.DeoptimizeCode");
Handle<JSFunction> function = deoptimizer->function(); Handle<JSFunction> function = deoptimizer->function();
Deoptimizer::BailoutType type = deoptimizer->bailout_type(); DeoptimizeKind type = deoptimizer->deopt_kind();
// TODO(turbofan): We currently need the native context to materialize // TODO(turbofan): We currently need the native context to materialize
// the arguments object, but only to get to its map. // the arguments object, but only to get to its map.
...@@ -169,7 +169,7 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) { ...@@ -169,7 +169,7 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) {
isolate->set_context(Context::cast(top_frame->context())); isolate->set_context(Context::cast(top_frame->context()));
// Invalidate the underlying optimized code on non-lazy deopts. // Invalidate the underlying optimized code on non-lazy deopts.
if (type != Deoptimizer::LAZY) { if (type != DeoptimizeKind::kLazy) {
Deoptimizer::DeoptimizeFunction(*function); Deoptimizer::DeoptimizeFunction(*function);
} }
......
...@@ -79,7 +79,7 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -79,7 +79,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ JumpIfSmi(r3, &context_check); __ JumpIfSmi(r3, &context_check);
__ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ LoadImmP(r3, Operand(type())); // bailout type, __ LoadImmP(r3, Operand(static_cast<int>(deopt_kind())));
// r4: bailout id already loaded. // r4: bailout id already loaded.
// r5: code address or 0 already loaded. // r5: code address or 0 already loaded.
// r6: Fp-to-sp delta. // r6: Fp-to-sp delta.
......
...@@ -101,7 +101,7 @@ void Deoptimizer::TableEntryGenerator::Generate() { ...@@ -101,7 +101,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ movp(arg_reg_1, rax); __ movp(arg_reg_1, rax);
__ Set(arg_reg_2, type()); __ Set(arg_reg_2, static_cast<int>(deopt_kind()));
// Args 3 and 4 are already in the right registers. // Args 3 and 4 are already in the right registers.
// On windows put the arguments on the stack (PrepareCallCFunction // On windows put the arguments on the stack (PrepareCallCFunction
......
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