summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/assembler.h17
-rw-r--r--compiler/utils/scoped_arena_allocator.cc1
-rw-r--r--compiler/utils/x86/assembler_x86.cc10
-rw-r--r--compiler/utils/x86/assembler_x86.h1
4 files changed, 29 insertions, 0 deletions
diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h
index 72ebdd3741..c23fd440dc 100644
--- a/compiler/utils/assembler.h
+++ b/compiler/utils/assembler.h
@@ -52,6 +52,23 @@ namespace x86_64 {
class X86_64Assembler;
}
+class ExternalLabel {
+ public:
+ ExternalLabel(const char* name, uword address)
+ : name_(name), address_(address) {
+ DCHECK(name != nullptr);
+ }
+
+ const char* name() const { return name_; }
+ uword address() const {
+ return address_;
+ }
+
+ private:
+ const char* name_;
+ const uword address_;
+};
+
class Label {
public:
Label() : position_(0) {}
diff --git a/compiler/utils/scoped_arena_allocator.cc b/compiler/utils/scoped_arena_allocator.cc
index a78d28792b..bd78eaef0d 100644
--- a/compiler/utils/scoped_arena_allocator.cc
+++ b/compiler/utils/scoped_arena_allocator.cc
@@ -99,6 +99,7 @@ void* ArenaStack::AllocValgrind(size_t bytes, ArenaAllocKind kind) {
}
CurrentStats()->RecordAlloc(bytes, kind);
top_ptr_ = ptr + rounded_bytes;
+ VALGRIND_MAKE_MEM_UNDEFINED(ptr, bytes);
VALGRIND_MAKE_MEM_NOACCESS(ptr + bytes, rounded_bytes - bytes);
return ptr;
}
diff --git a/compiler/utils/x86/assembler_x86.cc b/compiler/utils/x86/assembler_x86.cc
index d242c17c8f..ebbb43a442 100644
--- a/compiler/utils/x86/assembler_x86.cc
+++ b/compiler/utils/x86/assembler_x86.cc
@@ -54,6 +54,16 @@ void X86Assembler::call(Label* label) {
}
+void X86Assembler::call(const ExternalLabel& label) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ intptr_t call_start = buffer_.GetPosition();
+ EmitUint8(0xE8);
+ EmitInt32(label.address());
+ static const intptr_t kCallExternalLabelSize = 5;
+ DCHECK_EQ((buffer_.GetPosition() - call_start), kCallExternalLabelSize);
+}
+
+
void X86Assembler::pushl(Register reg) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitUint8(0x50 + reg);
diff --git a/compiler/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h
index 879f4ec795..f906a6f7c7 100644
--- a/compiler/utils/x86/assembler_x86.h
+++ b/compiler/utils/x86/assembler_x86.h
@@ -227,6 +227,7 @@ class X86Assembler FINAL : public Assembler {
void call(Register reg);
void call(const Address& address);
void call(Label* label);
+ void call(const ExternalLabel& label);
void pushl(Register reg);
void pushl(const Address& address);