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

Unified Diff: runtime/vm/object.h

Issue 1054393003: Compress deopt instructions in memory using variable length encoding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: landing Created 5 years, 8 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/growable_array.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 12fc18d330ac0e76cb5a751d42bbbf876d6a0d20..43308c10d945532af5d50effdca7a800687b008a 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3542,81 +3542,38 @@ class ExceptionHandlers : public Object {
// field-value pairs) are added as artificial slots to the expression stack
// of the bottom-most frame. They are removed from the stack at the very end
// of deoptimization by the deoptimization stub.
-class DeoptInfo : public Object {
- private:
- // Describes the layout of deopt info data. The index of a deopt-info entry
- // is implicitly the target slot in which the value is written into.
- enum {
- kInstruction = 0,
- kFromIndex,
- kNumberOfEntries,
- };
-
+class DeoptInfo : public AllStatic {
public:
- // The number of instructions.
- intptr_t Length() const;
-
- // The number of real (non-suffix) instructions needed to execute the
- // deoptimization translation.
- intptr_t TranslationLength() const;
-
// Size of the frame part of the translation not counting kMaterializeObject
// instructions in the prefix.
- intptr_t FrameSize() const;
+ static intptr_t FrameSize(const TypedData& packed);
// Returns the number of kMaterializeObject instructions in the prefix.
- intptr_t NumMaterializations() const;
-
- static RawDeoptInfo* New(intptr_t num_commands);
-
- static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize);
- static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
-
- static intptr_t InstanceSize() {
- ASSERT(sizeof(RawDeoptInfo) ==
- OFFSET_OF_RETURNED_VALUE(RawDeoptInfo, data));
- return 0;
- }
-
- static intptr_t InstanceSize(intptr_t len) {
- ASSERT(0 <= len && len <= kMaxElements);
- return RoundedAllocationSize(sizeof(RawDeoptInfo) +
- (len * kBytesPerElement));
- }
-
- // 'index' corresponds to target, to-index.
- void SetAt(intptr_t index,
- intptr_t instr_kind,
- intptr_t from_index) const;
-
- intptr_t Instruction(intptr_t index) const;
- intptr_t FromIndex(intptr_t index) const;
- intptr_t ToIndex(intptr_t index) const {
- return index;
- }
+ static intptr_t NumMaterializations(const GrowableArray<DeoptInstr*>&);
// Unpack the entire translation into an array of deoptimization
// instructions. This copies any shared suffixes into the array.
- void ToInstructions(const Array& table,
- GrowableArray<DeoptInstr*>* instructions) const;
+ static void Unpack(const Array& table,
+ const TypedData& packed,
+ GrowableArray<DeoptInstr*>* instructions);
+ // Size of the frame part of the translation not counting kMaterializeObject
+ // instructions in the prefix.
+ static const char* ToCString(const Array& table,
+ const TypedData& packed);
// Returns true iff decompression yields the same instructions as the
// original.
- bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original,
- const Array& deopt_table) const;
+ static bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original,
+ const Array& deopt_table,
+ const TypedData& packed);
- private:
- intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
- ASSERT((index >=0) && (index < Length()));
- intptr_t data_index = (index * kNumberOfEntries) + entry_offset;
- return &UnsafeMutableNonPointer(raw_ptr()->data())[data_index];
- }
- void SetLength(intptr_t value) const;
-
- FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object);
- friend class Class;
+ private:
+ static void UnpackInto(const Array& table,
+ const TypedData& packed,
+ GrowableArray<DeoptInstr*>* instructions,
+ intptr_t length);
};
@@ -4012,7 +3969,7 @@ class Code : public Object {
return raw_ptr()->static_calls_target_table_;
}
- RawDeoptInfo* GetDeoptInfoAtPc(uword pc,
+ RawTypedData* GetDeoptInfoAtPc(uword pc,
ICData::DeoptReasonId* deopt_reason,
uint32_t* deopt_flags) const;
« no previous file with comments | « runtime/vm/growable_array.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698