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

Unified Diff: runtime/vm/assembler_x64.cc

Issue 869533003: VM: Emit compacter code for x64 branches to external labels. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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
===================================================================
--- runtime/vm/assembler_x64.cc (revision 43070)
+++ runtime/vm/assembler_x64.cc (working copy)
@@ -8,6 +8,7 @@
#include "vm/assembler.h"
#include "vm/cpu.h"
#include "vm/heap.h"
+#include "vm/instructions.h"
#include "vm/locations.h"
#include "vm/memory_region.h"
#include "vm/runtime_entry.h"
@@ -2558,6 +2559,14 @@
}
+void Assembler::jmp(const Address& dst) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ EmitOperandREX(4, dst, REX_NONE);
+ EmitUint8(0xFF);
+ EmitOperand(4, dst);
+}
+
+
void Assembler::jmp(Label* label, bool near) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
if (VerifiedMemory::enabled()) {
@@ -2599,15 +2608,18 @@
void Assembler::JmpPatchable(const ExternalLabel* label, Register pp) {
ASSERT(allow_constant_pool());
intptr_t call_start = buffer_.GetPosition();
- LoadExternalLabel(TMP, label, kPatchable, pp);
- jmp(TMP);
- ASSERT((buffer_.GetPosition() - call_start) == kJmpExternalLabelSize);
+ const int32_t offset =
+ Array::element_offset(FindExternalLabel(label, kPatchable));
+ // Patchable jumps always use a 32-bit immediate encoding.
+ jmp(Address::AddressBaseImm32(pp, offset - kHeapObjectTag));
+ ASSERT((buffer_.GetPosition() - call_start) == JumpPattern::kLengthInBytes);
}
void Assembler::Jmp(const ExternalLabel* label, Register pp) {
- LoadExternalLabel(TMP, label, kNotPatchable, pp);
- jmp(TMP);
+ const int32_t offset =
+ Array::element_offset(FindExternalLabel(label, kNotPatchable));
+ jmp(Address(pp, offset - kHeapObjectTag));
}
« 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