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

Unified Diff: runtime/vm/intrinsifier_x64.cc

Issue 11087087: Apply John's change (Issue 11077007: Intrinsify Float64 array access on ia32 and x64.). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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/intrinsifier_ia32.cc ('k') | tests/standalone/float_array_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_x64.cc
===================================================================
--- runtime/vm/intrinsifier_x64.cc (revision 13556)
+++ runtime/vm/intrinsifier_x64.cc (working copy)
@@ -585,6 +585,54 @@
}
+bool Intrinsifier::Float64Array_getIndexed(Assembler* assembler) {
+ Label fall_through;
+ TestByteArrayIndex(assembler, &fall_through);
+ // After TestByteArrayIndex:
+ // * RAX has the base address of the byte array.
+ // * R12 has the index into the array.
+ // R12 contains the SMI index which is shifted left by 1.
+ // This shift means we only multiply the index by 4 not 8 (sizeof double).
+ // Load double precision float into XMM7.
+ __ movsd(XMM7, FieldAddress(RAX, R12, TIMES_4,
+ Float64Array::data_offset()));
+ // Allocate a double instance.
+ const Class& double_class = Class::Handle(
+ Isolate::Current()->object_store()->double_class());
+ AssemblerMacros::TryAllocate(assembler,
+ double_class,
+ &fall_through,
+ Assembler::kNearJump, RAX);
+ // Store XMM7 into double instance.
+ __ movsd(FieldAddress(RAX, Double::value_offset()), XMM7);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
+bool Intrinsifier::Float64Array_setIndexed(Assembler* assembler) {
+ Label fall_through;
+ TestByteArraySetIndex(assembler, &fall_through);
+ // After TestByteArraySetIndex:
+ // * RAX has the base address of the byte array.
+ // * R12 has the index into the array.
+ // R12 contains the SMI index which is shifted by 1.
+ // This shift means we only multiply the index by 4 not 8 (sizeof double).
+ __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value.
+ // If RDX is not an instance of double, jump to fall through.
+ __ CompareClassId(RDX, kDoubleCid);
+ __ j(NOT_EQUAL, &fall_through);
+ // Load double value into XMM7.
+ __ movsd(XMM7, FieldAddress(RDX, Double::value_offset()));
+ // Store into array.
+ __ movsd(FieldAddress(RAX, R12, TIMES_4, Float64Array::data_offset()), XMM7);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
// Tests if two top most arguments are smis, jumps to label not_smi if not.
// Topmost argument is in RAX.
static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) {
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | tests/standalone/float_array_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698