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);
......
This diff is collapsed.
...@@ -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