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

Unified Diff: runtime/vm/instructions_x64.cc

Issue 22825023: Uses an object pool on x64 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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_x64.h ('k') | runtime/vm/instructions_x64_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/instructions_x64.cc
===================================================================
--- runtime/vm/instructions_x64.cc (revision 27291)
+++ runtime/vm/instructions_x64.cc (working copy)
@@ -11,6 +11,13 @@
namespace dart {
+intptr_t InstructionPattern::IndexFromPPLoad(uword start) {
+ int32_t offset = *reinterpret_cast<int32_t*>(start);
+ offset += kHeapObjectTag;
+ return (offset - Array::data_offset()) / kWordSize;
+}
+
+
bool InstructionPattern::TestBytesWith(const int* data, int num_bytes) const {
ASSERT(data != NULL);
const uint8_t* byte_array = reinterpret_cast<const uint8_t*>(start_);
@@ -24,13 +31,13 @@
}
-uword CallOrJumpPattern::TargetAddress() const {
+uword CallPattern::TargetAddress() const {
ASSERT(IsValid());
return *reinterpret_cast<uword*>(start() + 2);
}
-void CallOrJumpPattern::SetTargetAddress(uword target) const {
+void CallPattern::SetTargetAddress(uword target) const {
ASSERT(IsValid());
*reinterpret_cast<uword*>(start() + 2) = target;
CPU::FlushICache(start() + 2, kWordSize);
@@ -46,11 +53,27 @@
}
+uword JumpPattern::TargetAddress() const {
+ ASSERT(IsValid());
+ int index = InstructionPattern::IndexFromPPLoad(start() + 3);
+ return reinterpret_cast<uword>(object_pool_.At(index));
+}
+
+
+void JumpPattern::SetTargetAddress(uword target) const {
+ ASSERT(IsValid());
+ int index = InstructionPattern::IndexFromPPLoad(start() + 3);
+ const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(target));
+ object_pool_.SetAt(index, smi);
+ // No need to flush the instruction cache, since the code is not modified.
+}
+
+
const int* JumpPattern::pattern() const {
- // movq $target, TMP
- // jmpq TMP
+ // 00: 4d 8b 9d imm32 mov R11, [R13 + off]
+ // 07: 41 ff e3 jmpq R11
static const int kJumpPattern[kLengthInBytes] =
- {0x49, 0xBB, -1, -1, -1, -1, -1, -1, -1, -1, 0x41, 0xFF, 0xE3};
+ {0x4D, 0x8B, -1, -1, -1, -1, -1, 0x41, 0xFF, 0xE3};
return kJumpPattern;
}
« no previous file with comments | « runtime/vm/instructions_x64.h ('k') | runtime/vm/instructions_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698