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

Unified Diff: runtime/vm/assembler_x64.cc

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 4 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/assembler_x64.h ('k') | runtime/vm/assembler_x64_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_x64.cc
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc
index 19027799f840326cc862ce1e583f7e550b3c147d..74f0ece47c0c84998778529804a2df1febb6e8e3 100644
--- a/runtime/vm/assembler_x64.cc
+++ b/runtime/vm/assembler_x64.cc
@@ -28,6 +28,7 @@ Assembler::Assembler(bool use_far_branches)
constant_pool_allowed_(false) {
// Far branching mode is only needed and implemented for MIPS and ARM.
ASSERT(!use_far_branches);
+ MonomorphicCheckedEntry();
}
@@ -3321,6 +3322,45 @@ void Assembler::LeaveStubFrame() {
}
+void Assembler::NoMonomorphicCheckedEntry() {
+ buffer_.Reset();
+ for (intptr_t i = 0; i < Instructions::kCheckedEntryOffset; i++) {
+ int3();
+ }
+ ASSERT(CodeSize() == Instructions::kCheckedEntryOffset);
+}
+
+
+// RDI receiver, RBX guarded cid as Smi
+void Assembler::MonomorphicCheckedEntry() {
+ Label immediate, have_cid, miss;
+ Bind(&miss);
+ movq(CODE_REG, Address(THR, Thread::monomorphic_miss_stub_offset()));
+ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset()));
+ jmp(RCX);
+
+ Bind(&immediate);
+ movq(R10, Immediate(kSmiCid));
+ jmp(&have_cid, kNearJump);
+
+ Comment("MonomorphicCheckedEntry");
+ ASSERT(CodeSize() == Instructions::kCheckedEntryOffset);
+ SmiUntag(RBX);
+ testq(RDI, Immediate(kSmiTagMask));
+ j(ZERO, &immediate, kNearJump);
+
+ LoadClassId(R10, RDI);
+
+ Bind(&have_cid);
+ cmpq(R10, RBX);
+ j(NOT_EQUAL, &miss, Assembler::kNearJump);
+
+ // Fall through to unchecked entry.
+ ASSERT(CodeSize() == Instructions::kUncheckedEntryOffset);
+ ASSERT((CodeSize() & kSmiTagMask) == kSmiTag);
+}
+
+
#ifndef PRODUCT
void Assembler::MaybeTraceAllocation(intptr_t cid,
Label* trace,
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/assembler_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698