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

Unified Diff: runtime/vm/object.h

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . 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
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 6be932d22d556de1438fe9effe6492c2a118db16..77099904572ea038bd216bed6f55f6a2eac69619 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3960,13 +3960,48 @@ class Instructions : public Object {
public:
intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize().
- uword EntryPoint() const {
- return EntryPoint(raw());
+ uword PayloadStart() const {
+ return PayloadStart(raw());
}
- static uword EntryPoint(RawInstructions* instr) {
+ uword UncheckedEntryPoint() const {
+ return UncheckedEntryPoint(raw());
+ }
+ uword CheckedEntryPoint() const {
+ return CheckedEntryPoint(raw());
+ }
+ static uword PayloadStart(RawInstructions* instr) {
return reinterpret_cast<uword>(instr->ptr()) + HeaderSize();
}
+#if defined(TARGET_ARCH_IA32)
+ static const intptr_t kCheckedEntryOffset = 0;
+ static const intptr_t kUncheckedEntryOffset = 0;
+#elif defined(TARGET_ARCH_X64)
+ static const intptr_t kCheckedEntryOffset = 15;
+ static const intptr_t kUncheckedEntryOffset = 52;
+#elif defined(TARGET_ARCH_ARM)
+ static const intptr_t kCheckedEntryOffset = 3*4;
Florian Schneider 2016/08/10 02:32:14 n*Instr::kInstrSize on ARM, ARM64, and MIPS.
rmacnak 2016/08/11 00:17:49 Done.
+ static const intptr_t kUncheckedEntryOffset = 9*4;
+#elif defined(TARGET_ARCH_ARM64)
+ static const intptr_t kCheckedEntryOffset = 6*4;
+ static const intptr_t kUncheckedEntryOffset = 12*4;
+#elif defined(TARGET_ARCH_MIPS)
+ static const intptr_t kCheckedEntryOffset = 4*4;
+ static const intptr_t kUncheckedEntryOffset = 14*4;
+#elif defined(TARGET_ARCH_DBC)
+ static const intptr_t kCheckedEntryOffset = 0;
+ static const intptr_t kUncheckedEntryOffset = 0;
+#else
+#error Missing entry offsets for current architecture
+#endif
+
+ static uword UncheckedEntryPoint(RawInstructions* instr) {
+ return PayloadStart(instr) + kUncheckedEntryOffset;
+ }
+ static uword CheckedEntryPoint(RawInstructions* instr) {
+ return PayloadStart(instr) + kCheckedEntryOffset;
+ }
+
static const intptr_t kMaxElements = (kMaxInt32 -
(sizeof(RawInstructions) +
sizeof(RawObject) +
@@ -3993,7 +4028,7 @@ class Instructions : public Object {
static RawInstructions* FromEntryPoint(uword entry_point) {
Florian Schneider 2016/08/10 02:32:14 rename to FromUncheckedEntryPoint?
rmacnak 2016/08/11 00:17:49 Done.
return reinterpret_cast<RawInstructions*>(
- entry_point - HeaderSize() + kHeapObjectTag);
+ entry_point - HeaderSize() - kUncheckedEntryOffset + kHeapObjectTag);
}
bool Equals(const Instructions& other) const {
@@ -4445,6 +4480,9 @@ class Code : public Object {
static intptr_t entry_point_offset() {
return OFFSET_OF(RawCode, entry_point_);
}
+ static intptr_t checked_entry_point_offset() {
+ return OFFSET_OF(RawCode, checked_entry_point_);
+ }
RawObjectPool* object_pool() const { return raw_ptr()->object_pool_; }
static intptr_t object_pool_offset() {
@@ -4464,8 +4502,14 @@ class Code : public Object {
}
void set_is_alive(bool value) const;
- uword EntryPoint() const {
- return Instructions::Handle(instructions()).EntryPoint();
+ uword PayloadStart() const {
+ return Instructions::PayloadStart(instructions());
+ }
+ uword UncheckedEntryPoint() const {
+ return Instructions::UncheckedEntryPoint(instructions());
+ }
+ uword CheckedEntryPoint() const {
+ return Instructions::CheckedEntryPoint(instructions());
}
intptr_t Size() const {
const Instructions& instr = Instructions::Handle(instructions());
@@ -4476,7 +4520,7 @@ class Code : public Object {
}
bool ContainsInstructionAt(uword addr) const {
const Instructions& instr = Instructions::Handle(instructions());
- const uword offset = addr - instr.EntryPoint();
+ const uword offset = addr - instr.PayloadStart();
return offset < static_cast<uword>(instr.size());
}

Powered by Google App Engine
This is Rietveld 408576698