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

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: 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/instructions_mips_test.cc ('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 6be932d22d556de1438fe9effe6492c2a118db16..e7fea7361703e3f4d90e712d112d5059244f59b3 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 = 23;
+ static const intptr_t kUncheckedEntryOffset = 44;
+#elif defined(TARGET_ARCH_ARM)
+ static const intptr_t kCheckedEntryOffset = 3 * Instr::kInstrSize;
+ static const intptr_t kUncheckedEntryOffset = 9 * Instr::kInstrSize;
+#elif defined(TARGET_ARCH_ARM64)
+ static const intptr_t kCheckedEntryOffset = 6 * Instr::kInstrSize;
+ static const intptr_t kUncheckedEntryOffset = 12 * Instr::kInstrSize;
+#elif defined(TARGET_ARCH_MIPS)
+ static const intptr_t kCheckedEntryOffset = 4 * Instr::kInstrSize;
+ static const intptr_t kUncheckedEntryOffset = 14 * Instr::kInstrSize;
+#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) +
@@ -3991,9 +4026,9 @@ class Instructions : public Object {
return Utils::RoundUp(sizeof(RawInstructions), alignment);
}
- static RawInstructions* FromEntryPoint(uword entry_point) {
+ static RawInstructions* FromUncheckedEntryPoint(uword entry_point) {
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());
}
« no previous file with comments | « runtime/vm/instructions_mips_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698