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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 11139004: Intrinsify natural word size typed array getters on IA32 and X64 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Codereview 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.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_ia32.cc
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc
index 7760a931109937c73def80400eaa0f8edcb0bac1..834cf5f02b2cc32ab35487e77794b72da76574ae 100644
--- a/runtime/vm/intrinsifier_ia32.cc
+++ b/runtime/vm/intrinsifier_ia32.cc
@@ -564,11 +564,55 @@ bool Intrinsifier::Uint16Array_getIndexed(Assembler* assembler) {
bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) {
+ Label fall_through;
+ TestByteArrayIndex(assembler, &fall_through);
+ // After TestByteArrayIndex:
+ // * EAX has the base address of the byte array.
+ // * EBX has the index into the array.
+ // EBX contains the SMI index which is shifted left by 1.
+ // This shift means we only multiply the index by 2 not 4 (sizeof Int32).
+ __ movl(EAX, FieldAddress(EAX,
+ EBX,
+ TIMES_2,
+ Int32Array::data_offset()));
+ // Verify that the signed value in EAX can fit inside a Smi.
+ __ cmpl(EAX, Immediate(0xC0000000));
+ __ j(NEGATIVE, &fall_through, Assembler::kNearJump); // Won't fit Smi.
+ __ SmiTag(EAX);
+ __ ret();
+ __ Bind(&fall_through);
return false;
}
bool Intrinsifier::Uint32Array_getIndexed(Assembler* assembler) {
+ Label fall_through;
+ TestByteArrayIndex(assembler, &fall_through);
+ // After TestByteArrayIndex:
+ // * EAX has the base address of the byte array.
+ // * EBX has the index into the array.
+ // EBX contains the SMI index which is shifted left by 1.
+ // This shift means we only multiply the index by 2 not 4 (sizeof Uint32).
+ __ movl(EAX, FieldAddress(EAX,
+ EBX,
+ TIMES_2,
+ Uint32Array::data_offset()));
+ // Verify that the unsigned value in EAX can be stored in a Smi.
+ __ testl(EAX, Immediate(0xC0000000));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Won't fit Smi.
+ __ SmiTag(EAX);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
+bool Intrinsifier::Int64Array_getIndexed(Assembler* assembler) {
+ return false;
+}
+
+
+bool Intrinsifier::Uint64Array_getIndexed(Assembler* assembler) {
return false;
}
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698