Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1482)

Unified Diff: runtime/vm/deopt_instructions.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/disassembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/deopt_instructions.cc
diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc
index fa90ec270e3a57f4b3f0095a4b8e73b4b759ac60..0367a054db17b58a3a11596051ac90b638e29cbd 100644
--- a/runtime/vm/deopt_instructions.cc
+++ b/runtime/vm/deopt_instructions.cc
@@ -24,7 +24,6 @@ DEFINE_FLAG(bool,
DECLARE_FLAG(bool, trace_deoptimization);
DECLARE_FLAG(bool, trace_deoptimization_verbose);
-
DeoptContext::DeoptContext(const StackFrame* frame,
const Code& code,
DestFrameOptions dest_options,
@@ -132,7 +131,6 @@ DeoptContext::DeoptContext(const StackFrame* frame,
}
}
-
DeoptContext::~DeoptContext() {
// Delete memory for source frame and registers.
if (source_frame_is_allocated_) {
@@ -183,7 +181,6 @@ DeoptContext::~DeoptContext() {
#endif // !PRODUCT
}
-
void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) {
visitor->VisitPointer(reinterpret_cast<RawObject**>(&object_pool_));
visitor->VisitPointer(reinterpret_cast<RawObject**>(&deopt_info_));
@@ -198,7 +195,6 @@ void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) {
}
}
-
intptr_t DeoptContext::DestStackAdjustment() const {
return dest_frame_size_ - kDartFrameFixedSize - num_args_
#if !defined(TARGET_ARCH_DBC)
@@ -207,7 +203,6 @@ intptr_t DeoptContext::DestStackAdjustment() const {
- kParamEndSlotFromFp;
}
-
intptr_t DeoptContext::GetSourceFp() const {
#if !defined(TARGET_ARCH_DBC)
return source_frame_[source_frame_size_ - 1 - num_args_ -
@@ -218,7 +213,6 @@ intptr_t DeoptContext::GetSourceFp() const {
#endif
}
-
intptr_t DeoptContext::GetSourcePp() const {
#if !defined(TARGET_ARCH_DBC)
return source_frame_[source_frame_size_ - 1 - num_args_ -
@@ -230,7 +224,6 @@ intptr_t DeoptContext::GetSourcePp() const {
#endif
}
-
intptr_t DeoptContext::GetSourcePc() const {
#if !defined(TARGET_ARCH_DBC)
return source_frame_[source_frame_size_ - num_args_ + kSavedPcSlotFromSp];
@@ -240,17 +233,14 @@ intptr_t DeoptContext::GetSourcePc() const {
#endif
}
-
intptr_t DeoptContext::GetCallerFp() const {
return caller_fp_;
}
-
void DeoptContext::SetCallerFp(intptr_t caller_fp) {
caller_fp_ = caller_fp;
}
-
static bool IsObjectInstruction(DeoptInstr::Kind kind) {
switch (kind) {
case DeoptInstr::kConstant:
@@ -284,7 +274,6 @@ static bool IsObjectInstruction(DeoptInstr::Kind kind) {
return false;
}
-
void DeoptContext::FillDestFrame() {
const Code& code = Code::Handle(code_);
const TypedData& deopt_info = TypedData::Handle(deopt_info_);
@@ -344,7 +333,6 @@ void DeoptContext::FillDestFrame() {
}
}
-
intptr_t* DeoptContext::CatchEntryState(intptr_t num_vars) {
const Code& code = Code::Handle(code_);
const TypedData& deopt_info = TypedData::Handle(deopt_info_);
@@ -380,7 +368,6 @@ intptr_t* DeoptContext::CatchEntryState(intptr_t num_vars) {
return state;
}
-
static void FillDeferredSlots(DeoptContext* deopt_context,
DeferredSlot** slot_list) {
DeferredSlot* slot = *slot_list;
@@ -396,7 +383,6 @@ static void FillDeferredSlots(DeoptContext* deopt_context,
}
}
-
// Materializes all deferred objects. Returns the total number of
// artificial arguments used during deoptimization.
intptr_t DeoptContext::MaterializeDeferredObjects() {
@@ -438,7 +424,6 @@ intptr_t DeoptContext::MaterializeDeferredObjects() {
return deopt_arg_count;
}
-
RawArray* DeoptContext::DestFrameAsArray() {
ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_);
const Array& dest_array = Array::Handle(zone(), Array::New(dest_frame_size_));
@@ -450,7 +435,6 @@ RawArray* DeoptContext::DestFrameAsArray() {
return dest_array.raw();
}
-
// Deoptimization instruction creating return address using function and
// deopt-id stored at 'object_table_index'.
class DeoptRetAddressInstr : public DeoptInstr {
@@ -499,7 +483,6 @@ class DeoptRetAddressInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptRetAddressInstr);
};
-
// Deoptimization instruction moving a constant stored at 'object_table_index'.
class DeoptConstantInstr : public DeoptInstr {
public:
@@ -533,7 +516,6 @@ class DeoptConstantInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptConstantInstr);
};
-
// Deoptimization instruction moving value from optimized frame at
// 'source_index' to specified slots in the unoptimized frame.
// 'source_index' represents the slot index of the frame (0 being
@@ -567,7 +549,6 @@ class DeoptWordInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptWordInstr);
};
-
class DeoptIntegerInstrBase : public DeoptInstr {
public:
DeoptIntegerInstrBase() {}
@@ -589,7 +570,6 @@ class DeoptIntegerInstrBase : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptIntegerInstrBase);
};
-
class DeoptMintPairInstr : public DeoptIntegerInstrBase {
public:
explicit DeoptMintPairInstr(intptr_t source_index)
@@ -628,7 +608,6 @@ class DeoptMintPairInstr : public DeoptIntegerInstrBase {
DISALLOW_COPY_AND_ASSIGN(DeoptMintPairInstr);
};
-
template <DeoptInstr::Kind K, typename T>
class DeoptIntInstr : public DeoptIntegerInstrBase {
public:
@@ -653,12 +632,10 @@ class DeoptIntInstr : public DeoptIntegerInstrBase {
DISALLOW_COPY_AND_ASSIGN(DeoptIntInstr);
};
-
typedef DeoptIntInstr<DeoptInstr::kUint32, uint32_t> DeoptUint32Instr;
typedef DeoptIntInstr<DeoptInstr::kInt32, int32_t> DeoptInt32Instr;
typedef DeoptIntInstr<DeoptInstr::kMint, int64_t> DeoptMintInstr;
-
template <DeoptInstr::Kind K, typename Type, typename RawObjectType>
class DeoptFpuInstr : public DeoptInstr {
public:
@@ -740,7 +717,6 @@ class DeoptPcMarkerInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptPcMarkerInstr);
};
-
// Deoptimization instruction creating a pool pointer for the code of
// function at 'object_table_index'.
class DeoptPpInstr : public DeoptInstr {
@@ -770,7 +746,6 @@ class DeoptPpInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptPpInstr);
};
-
// Deoptimization instruction copying the caller saved FP from optimized frame.
class DeoptCallerFpInstr : public DeoptInstr {
public:
@@ -789,7 +764,6 @@ class DeoptCallerFpInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptCallerFpInstr);
};
-
// Deoptimization instruction copying the caller saved PP from optimized frame.
class DeoptCallerPpInstr : public DeoptInstr {
public:
@@ -806,7 +780,6 @@ class DeoptCallerPpInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptCallerPpInstr);
};
-
// Deoptimization instruction copying the caller return address from optimized
// frame.
class DeoptCallerPcInstr : public DeoptInstr {
@@ -824,7 +797,6 @@ class DeoptCallerPcInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptCallerPcInstr);
};
-
// Write reference to a materialized object with the given index into the
// stack slot.
class DeoptMaterializedObjectRefInstr : public DeoptInstr {
@@ -851,7 +823,6 @@ class DeoptMaterializedObjectRefInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptMaterializedObjectRefInstr);
};
-
// Materialize object with the given number of fields.
// Arguments for materialization (class and field-value pairs) are pushed
// to the expression stack of the bottom-most frame.
@@ -880,7 +851,6 @@ class DeoptMaterializeObjectInstr : public DeoptInstr {
DISALLOW_COPY_AND_ASSIGN(DeoptMaterializeObjectInstr);
};
-
uword DeoptInstr::GetRetAddress(DeoptInstr* instr,
const ObjectPool& object_table,
Code* code) {
@@ -909,7 +879,6 @@ uword DeoptInstr::GetRetAddress(DeoptInstr* instr,
return res;
}
-
DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) {
Kind kind = static_cast<Kind>(kind_as_int);
switch (kind) {
@@ -954,7 +923,6 @@ DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) {
return NULL;
}
-
const char* DeoptInstr::KindToCString(Kind kind) {
switch (kind) {
case kWord:
@@ -997,7 +965,6 @@ const char* DeoptInstr::KindToCString(Kind kind) {
return NULL;
}
-
class DeoptInfoBuilder::TrieNode : public ZoneAllocated {
public:
// Construct the root node representing the implicit "shared" terminator
@@ -1029,7 +996,6 @@ class DeoptInfoBuilder::TrieNode : public ZoneAllocated {
GrowableArray<TrieNode*> children_;
};
-
DeoptInfoBuilder::DeoptInfoBuilder(Zone* zone,
const intptr_t num_args,
Assembler* assembler)
@@ -1042,12 +1008,10 @@ DeoptInfoBuilder::DeoptInfoBuilder(Zone* zone,
frame_start_(-1),
materializations_() {}
-
intptr_t DeoptInfoBuilder::FindOrAddObjectInTable(const Object& obj) const {
return assembler_->object_pool_wrapper().FindObject(obj);
}
-
intptr_t DeoptInfoBuilder::CalculateStackIndex(
const Location& source_loc) const {
return source_loc.stack_index() < 0
@@ -1055,7 +1019,6 @@ intptr_t DeoptInfoBuilder::CalculateStackIndex(
: source_loc.stack_index() + num_args_ + kDartFrameFixedSize;
}
-
CpuRegisterSource DeoptInfoBuilder::ToCpuRegisterSource(const Location& loc) {
if (loc.IsRegister()) {
return CpuRegisterSource(CpuRegisterSource::kRegister, loc.reg());
@@ -1066,7 +1029,6 @@ CpuRegisterSource DeoptInfoBuilder::ToCpuRegisterSource(const Location& loc) {
}
}
-
FpuRegisterSource DeoptInfoBuilder::ToFpuRegisterSource(
const Location& loc,
Location::Kind stack_slot_kind) {
@@ -1094,7 +1056,6 @@ void DeoptInfoBuilder::AddReturnAddress(const Function& function,
DeoptRetAddressInstr(object_table_index, deopt_id));
}
-
void DeoptInfoBuilder::AddPcMarker(const Function& function,
intptr_t dest_index) {
intptr_t object_table_index = FindOrAddObjectInTable(function);
@@ -1102,14 +1063,12 @@ void DeoptInfoBuilder::AddPcMarker(const Function& function,
instructions_.Add(new (zone()) DeoptPcMarkerInstr(object_table_index));
}
-
void DeoptInfoBuilder::AddPp(const Function& function, intptr_t dest_index) {
intptr_t object_table_index = FindOrAddObjectInTable(function);
ASSERT(dest_index == FrameSize());
instructions_.Add(new (zone()) DeoptPpInstr(object_table_index));
}
-
void DeoptInfoBuilder::AddCopy(Value* value,
const Location& source_loc,
const intptr_t dest_index) {
@@ -1183,32 +1142,27 @@ void DeoptInfoBuilder::AddCopy(Value* value,
instructions_.Add(deopt_instr);
}
-
void DeoptInfoBuilder::AddCallerFp(intptr_t dest_index) {
ASSERT(dest_index == FrameSize());
instructions_.Add(new (zone()) DeoptCallerFpInstr());
}
-
void DeoptInfoBuilder::AddCallerPp(intptr_t dest_index) {
ASSERT(dest_index == FrameSize());
instructions_.Add(new (zone()) DeoptCallerPpInstr());
}
-
void DeoptInfoBuilder::AddCallerPc(intptr_t dest_index) {
ASSERT(dest_index == FrameSize());
instructions_.Add(new (zone()) DeoptCallerPcInstr());
}
-
void DeoptInfoBuilder::AddConstant(const Object& obj, intptr_t dest_index) {
ASSERT(dest_index == FrameSize());
intptr_t object_table_index = FindOrAddObjectInTable(obj);
instructions_.Add(new (zone()) DeoptConstantInstr(object_table_index));
}
-
void DeoptInfoBuilder::AddMaterialization(MaterializeObjectInstr* mat) {
const intptr_t index = FindMaterialization(mat);
if (index >= 0) {
@@ -1237,7 +1191,6 @@ void DeoptInfoBuilder::AddMaterialization(MaterializeObjectInstr* mat) {
}
}
-
intptr_t DeoptInfoBuilder::EmitMaterializationArguments(intptr_t dest_index) {
ASSERT(dest_index == kDartFrameFixedSize);
for (intptr_t i = 0; i < materializations_.length(); i++) {
@@ -1257,7 +1210,6 @@ intptr_t DeoptInfoBuilder::EmitMaterializationArguments(intptr_t dest_index) {
return dest_index;
}
-
intptr_t DeoptInfoBuilder::FindMaterialization(
MaterializeObjectInstr* mat) const {
for (intptr_t i = 0; i < materializations_.length(); i++) {
@@ -1268,14 +1220,12 @@ intptr_t DeoptInfoBuilder::FindMaterialization(
return -1;
}
-
static uint8_t* ZoneReAlloc(uint8_t* ptr,
intptr_t old_size,
intptr_t new_size) {
return Thread::Current()->zone()->Realloc<uint8_t>(ptr, old_size, new_size);
}
-
RawTypedData* DeoptInfoBuilder::CreateDeoptInfo(const Array& deopt_table) {
intptr_t length = instructions_.length();
@@ -1292,7 +1242,6 @@ RawTypedData* DeoptInfoBuilder::CreateDeoptInfo(const Array& deopt_table) {
}
}
-
// Allocate space for the translation. If the shared suffix is longer
// than one instruction, we replace it with a single suffix instruction.
const bool use_suffix = suffix_length > 1;
@@ -1344,7 +1293,6 @@ RawTypedData* DeoptInfoBuilder::CreateDeoptInfo(const Array& deopt_table) {
return deopt_info.raw();
}
-
intptr_t DeoptTable::SizeFor(intptr_t length) {
return length * kEntrySize;
}
@@ -1361,13 +1309,11 @@ void DeoptTable::SetEntry(const Array& table,
table.SetAt(i + 2, reason);
}
-
intptr_t DeoptTable::GetLength(const Array& table) {
ASSERT((table.Length() % kEntrySize) == 0);
return table.Length() / kEntrySize;
}
-
void DeoptTable::GetEntry(const Array& table,
intptr_t index,
Smi* offset,
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/disassembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698