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

Unified Diff: runtime/vm/object.cc

Issue 11040058: Compress deoptimization information by sharing common suffixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Ditto. Created 8 years, 2 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/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index adf5d909e2170af6fae50648033b66f0f870aebf..3a8a21291b9131a64bc9c3241a0a20e9ef793b10 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -6822,6 +6822,47 @@ intptr_t DeoptInfo::Instruction(intptr_t index) const {
}
+intptr_t DeoptInfo::TranslationLength() const {
+ intptr_t length = Length();
+ if (Instruction(length - 1) != DeoptInstr::kSuffix) return length;
+
+ // If the last command is a suffix, add in the length of the suffix and
+ // do not count the suffix command as a translation command.
+ intptr_t ignored = 0;
+ intptr_t suffix_length =
+ DeoptInstr::DecodeSuffix(FromIndex(length - 1), &ignored);
+ return length + suffix_length - 1;
+}
+
+
+void DeoptInfo::ToInstructions(const Array& table,
+ GrowableArray<DeoptInstr*>* instructions) const {
+ ASSERT(instructions->is_empty());
+ Smi& offset = Smi::Handle();
+ DeoptInfo& info = DeoptInfo::Handle(raw());
+ Smi& reason = Smi::Handle();
+ intptr_t index = 0;
+ intptr_t length = TranslationLength();
+ while (index < length) {
+ intptr_t instruction = info.Instruction(index);
+ intptr_t from_index = info.FromIndex(index);
+ if (instruction == DeoptInstr::kSuffix) {
+ // Suffix instructions cause us to 'jump' to another translation,
+ // changing info, length and index.
+ intptr_t info_number = 0;
+ intptr_t suffix_length =
+ DeoptInstr::DecodeSuffix(from_index, &info_number);
+ DeoptTable::GetEntry(table, info_number, &offset, &info, &reason);
+ length = info.TranslationLength();
+ index = length - suffix_length;
+ } else {
+ instructions->Add(DeoptInstr::Create(instruction, from_index));
+ ++index;
+ }
+ }
+}
+
+
const char* DeoptInfo::ToCString() const {
if (Length() == 0) {
return "No DeoptInfo";
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698