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

Unified Diff: runtime/vm/assembler_x64.cc

Issue 10440099: Adding unary op optimizations. missing assembly operations/ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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/assembler_x64.cc
===================================================================
--- runtime/vm/assembler_x64.cc (revision 8118)
+++ runtime/vm/assembler_x64.cc (working copy)
@@ -535,6 +535,17 @@
}
+void Assembler::xorpd(XmmRegister dst, const Address& src) {
+ ASSERT(dst <= XMM7);
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ EmitUint8(0x66);
+ EmitOperandREX(0, src, REX_NONE);
+ EmitUint8(0x0F);
+ EmitUint8(0x57);
+ EmitOperand(dst & 7, src);
+}
+
+
void Assembler::xchgl(Register dst, Register src) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
Operand operand(src);
@@ -1063,6 +1074,14 @@
}
+void Assembler::notq(Register reg) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ EmitRegisterREX(reg, REX_W);
+ EmitUint8(0xF7);
+ EmitUint8(0xD0 | (reg & 7));
+}
+
+
void Assembler::enter(const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitUint8(0xC8);
@@ -1343,6 +1362,17 @@
}
+void Assembler::DoubleNegate(XmmRegister d) {
+ static const struct ALIGN16 {
+ uint64_t a;
+ uint64_t b;
+ } double_negate_constant =
+ {0x8000000000000000LL, 0x8000000000000000LL};
+ movq(TMP, Immediate(reinterpret_cast<intptr_t>(&double_negate_constant)));
+ xorpd(d, Address(TMP, 0));
+}
+
+
void Assembler::Stop(const char* message) {
int64_t message_address = reinterpret_cast<int64_t>(message);
if (FLAG_print_stop_message) {
@@ -1542,6 +1572,37 @@
}
+void Assembler::LoadClassId(Register result, Register object) {
+ ASSERT(RawObject::kClassTagBit == 16);
+ ASSERT(RawObject::kClassTagSize == 16);
Florian Schneider 2012/05/31 09:22:54 These two would be candidates for a compile-time a
srdjan 2012/05/31 20:02:44 This code is not part of the CL, just borrowed fro
+ const intptr_t class_id_offset = Object::tags_offset() +
+ RawObject::kClassTagBit / kBitsPerByte;
+ movzxw(result, FieldAddress(object, class_id_offset));
+}
+
+
+void Assembler::LoadClassById(Register result, Register class_id) {
+ ASSERT(result != class_id);
+ movq(result, FieldAddress(CTX, Context::isolate_offset()));
+ const intptr_t table_offset_in_isolate =
+ Isolate::class_table_offset() + ClassTable::table_offset();
+ movq(result, Address(result, table_offset_in_isolate));
+ movq(result, Address(result, class_id, TIMES_8, 0));
Florian Schneider 2012/05/31 09:22:54 Maybe add an assert: ASSERT(ClassTable::kEntrySize
srdjan 2012/05/31 20:02:44 Code is part of Slava's CL. CC-ing him
+}
+
+
+void Assembler::LoadClass(Register result, Register object) {
+ LoadClassId(TMP, object);
+ LoadClassById(result, TMP);
+}
+
+
+void Assembler::CompareClassId(Register object, intptr_t class_id) {
+ LoadClassId(TMP, object);
+ cmpl(TMP, Immediate(class_id));
+}
+
+
void Assembler::Comment(const char* format, ...) {
if (FLAG_code_comments) {
char buffer[1024];

Powered by Google App Engine
This is Rietveld 408576698