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

Unified Diff: runtime/vm/instructions_x64.cc

Issue 1301963003: VM: Clean up and fix bugs in instructions patterns (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: s/Pattern::InstructionLength/Pattern::pattern_length_in_bytes/g Created 5 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/instructions_x64.cc
diff --git a/runtime/vm/instructions_x64.cc b/runtime/vm/instructions_x64.cc
index 51128dd23901b88e6fcec7c2b64b5a5b046c8ad4..83f427dbb5500c8eafc9d6ed699503c06bf79812 100644
--- a/runtime/vm/instructions_x64.cc
+++ b/runtime/vm/instructions_x64.cc
@@ -11,54 +11,27 @@
namespace dart {
-intptr_t InstructionPattern::IndexFromPPLoad(uword start) {
+intptr_t IndexFromPPLoad(uword start) {
int32_t offset = *reinterpret_cast<int32_t*>(start);
return ObjectPool::IndexFromOffset(offset);
}
-intptr_t InstructionPattern::OffsetFromPPIndex(intptr_t index) {
- intptr_t offset = ObjectPool::element_offset(index);
- return offset - kHeapObjectTag;
-}
-
-
-bool InstructionPattern::TestBytesWith(const int* data, int num_bytes) const {
- ASSERT(data != NULL);
- const uint8_t* byte_array = reinterpret_cast<const uint8_t*>(start_);
- for (int i = 0; i < num_bytes; i++) {
- // Skip comparison for data[i] < 0.
- if ((data[i] >= 0) && (byte_array[i] != (0xFF & data[i]))) {
- return false;
- }
- }
- return true;
-}
-
-
uword JumpPattern::TargetAddress() const {
ASSERT(IsValid());
- int index = InstructionPattern::IndexFromPPLoad(start() + 3);
+ int index = IndexFromPPLoad(start() + 3);
return object_pool_.RawValueAt(index);
}
void JumpPattern::SetTargetAddress(uword target) const {
ASSERT(IsValid());
- int index = InstructionPattern::IndexFromPPLoad(start() + 3);
+ int index = IndexFromPPLoad(start() + 3);
object_pool_.SetRawValueAt(index, target);
// No need to flush the instruction cache, since the code is not modified.
}
-const int* JumpPattern::pattern() const {
- // 07: 41 ff a7 imm32 jmpq [reg + off]
- static const int kJumpPattern[kLengthInBytes] =
- {0x41, 0xFF, -1, -1, -1, -1, -1};
- return kJumpPattern;
-}
-
-
void ShortCallPattern::SetTargetAddress(uword target) const {
ASSERT(IsValid());
*reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes;
@@ -66,30 +39,6 @@ void ShortCallPattern::SetTargetAddress(uword target) const {
}
-const int* ShortCallPattern::pattern() const {
- static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1};
- return kCallPattern;
-}
-
-
-const int* ReturnPattern::pattern() const {
- static const int kReturnPattern[kLengthInBytes] = { 0xC3 };
- return kReturnPattern;
-}
-
-
-const int* ProloguePattern::pattern() const {
- static const int kProloguePattern[kLengthInBytes] =
- { 0x55, 0x48, 0x89, 0xe5 };
- return kProloguePattern;
-}
-
-
-const int* SetFramePointerPattern::pattern() const {
- static const int kFramePointerPattern[kLengthInBytes] = { 0x48, 0x89, 0xe5 };
- return kFramePointerPattern;
-}
-
} // namespace dart
#endif // defined TARGET_ARCH_X64

Powered by Google App Engine
This is Rietveld 408576698