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

Unified Diff: runtime/vm/instructions_mips.cc

Issue 1418863003: Precompilation: Generate instance calls as IC calls that can switch to Megamoprhic calls. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/instructions_mips.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/instructions_mips.cc
diff --git a/runtime/vm/instructions_mips.cc b/runtime/vm/instructions_mips.cc
index dcca54fd949f042aa35a15f300ec31c444a1ae43..1c243efd25213576bb4a0dadb2277da59ebb7200 100644
--- a/runtime/vm/instructions_mips.cc
+++ b/runtime/vm/instructions_mips.cc
@@ -210,6 +210,46 @@ void CallPattern::InsertDeoptCallAt(uword pc, uword target_address) {
}
+SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code)
+ : object_pool_(ObjectPool::Handle(code.GetObjectPool())),
+ cache_pool_index_(-1),
+ stub_pool_index_(-1) {
+ ASSERT(code.ContainsInstructionAt(pc));
+ // Last instruction: jalr t1.
+ ASSERT(*(reinterpret_cast<uword*>(pc) - 1) == 0); // Delay slot.
+ ASSERT(*(reinterpret_cast<uword*>(pc) - 2) == 0x0120f809);
+
+ Register reg;
+ uword stub_load_end =
+ InstructionPattern::DecodeLoadWordFromPool(pc - 5 * Instr::kInstrSize,
+ &reg,
+ &stub_pool_index_);
+ ASSERT(reg == CODE_REG);
+ InstructionPattern::DecodeLoadWordFromPool(stub_load_end,
+ &reg,
+ &cache_pool_index_);
+ ASSERT(reg == S5);
+}
+
+
+RawObject* SwitchableCallPattern::cache() const {
+ return reinterpret_cast<RawCode*>(
+ object_pool_.ObjectAt(cache_pool_index_));
+}
+
+
+void SwitchableCallPattern::SetCache(const MegamorphicCache& cache) const {
+ ASSERT(Object::Handle(object_pool_.ObjectAt(cache_pool_index_)).IsICData());
+ object_pool_.SetObjectAt(cache_pool_index_, cache);
+}
+
+
+void SwitchableCallPattern::SetLookupStub(const Code& lookup_stub) const {
+ ASSERT(Object::Handle(object_pool_.ObjectAt(stub_pool_index_)).IsCode());
+ object_pool_.SetObjectAt(stub_pool_index_, lookup_stub);
+}
+
+
ReturnPattern::ReturnPattern(uword pc)
: pc_(pc) {
}
« no previous file with comments | « runtime/vm/instructions_mips.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698