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

Unified Diff: runtime/vm/intrinsifier_x64.cc

Issue 10451026: More intrinsification x64: array index load and store. (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
« runtime/vm/assembler_x64_test.cc ('K') | « runtime/vm/assembler_x64_test.cc ('k') | no next file » | 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 7962)
+++ runtime/vm/intrinsifier_x64.cc (working copy)
@@ -18,6 +18,8 @@
// RBX: IC Data
// R10: Arguments descriptor
// TOS: Return address
+// The RBX, R10 registers can be destroyed only if there is no slow-path (i.e.,
+// the methods returns true).
#define __ assembler->
@@ -40,6 +42,20 @@
bool Intrinsifier::Array_getIndexed(Assembler* assembler) {
+ Label fall_through;
+ __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index.
+ __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array.
+ __ testq(RCX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
+ // Range check.
+ __ cmpq(RCX, FieldAddress(RAX, Array::length_offset()));
+ // Runtime throws exception.
+ __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
+ // Note that EBX is Smi, i.e, times 2.
regis 2012/05/24 23:31:29 EBX?
+ ASSERT(kSmiTagShift == 1);
+ __ movq(RAX, FieldAddress(RAX, RCX, TIMES_4, sizeof(RawArray)));
+ __ ret();
+ __ Bind(&fall_through);
return false;
}
@@ -50,6 +66,28 @@
bool Intrinsifier::Array_setIndexed(Assembler* assembler) {
+ if (FLAG_enable_type_checks) {
+ return false;
+ }
+ __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value.
+ __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index.
+ __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array.
+ Label fall_through;
+ __ testq(RCX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
+ // Range check.
+ __ cmpq(RCX, FieldAddress(RAX, Array::length_offset()));
+ // Runtime throws exception.
+ __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
+ // Note that EBX is Smi, i.e, times 2.
regis 2012/05/24 23:31:29 EBX?
srdjan 2012/05/24 23:54:13 Done.
+ ASSERT(kSmiTagShift == 1);
+ // Destroy ECX as we will not continue in the function.
regis 2012/05/24 23:31:29 ECX?
srdjan 2012/05/24 23:54:13 Done.
+ __ StoreIntoObject(RAX,
+ FieldAddress(RAX, RCX, TIMES_4, sizeof(RawArray)),
+ RDX);
+ // Caller is responsible of preserving the value if necessary.
+ __ ret();
+ __ Bind(&fall_through);
return false;
}
« runtime/vm/assembler_x64_test.cc ('K') | « runtime/vm/assembler_x64_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698