Index: runtime/vm/intrinsifier_ia32.cc |
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc |
index 2c2e8d3ada7ae00623cb6f239b3efd40536e3553..a81575f3d3c53eafca6fb569f56650d2c1fad41e 100644 |
--- a/runtime/vm/intrinsifier_ia32.cc |
+++ b/runtime/vm/intrinsifier_ia32.cc |
@@ -564,11 +564,51 @@ bool Intrinsifier::Uint16Array_getIndexed(Assembler* assembler) { |
bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) { |
+ Label fall_through; |
+ TestByteArrayIndex(assembler, &fall_through); |
+ __ movl(EAX, FieldAddress(EAX, |
+ EBX, |
+ TIMES_2, |
+ Int32Array::data_offset())); |
+ // Copy EBX into EAX. |
+ // We destroy EBX while testing if EAX can fit inside a Smi. |
+ __ movl(EBX, EAX); |
+ // Verify that the signed value in EBX can be stored in a Smi. |
srdjan
2012/10/12 22:52:48
Quicker way is to test with:
__ testl(EAX
Florian Schneider
2012/10/15 14:29:17
For signed ints it should be
__ cmpl(EAX, Immedi
|
+ __ shll(EBX, Immediate(0x1)); |
+ __ j(OVERFLOW, &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); |
+ __ movl(EAX, FieldAddress(EAX, |
+ EBX, |
+ TIMES_2, |
+ Uint32Array::data_offset())); |
+ // Copy EBX into EAX. |
+ // We destroy EBX while testing if EAX can fit inside a Smi. |
+ __ movl(EBX, EAX); |
+ // Verify that the unsigned value in EAX can be stored in a Smi. |
cshapiro
2012/10/12 22:33:52
Indentation...
|
+ __ shrl(EBX, Immediate(30)); |
cshapiro
2012/10/12 22:33:52
Please use the named constant kSmiBits instead of
|
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Won't fit Smi. |
srdjan
2012/10/12 22:52:48
I believe quicker test for unsigned is:
__ testl(
|
+ __ SmiTag(EAX); |
+ __ ret(); |
+ __ Bind(&fall_through); |
+ return false; |
+} |
+ |
+ |
+bool Intrinsifier::Int64Array_getIndexed(Assembler* assembler) { |
srdjan
2012/10/12 22:52:48
You could add here code that checks if the result
|
+ return false; |
+} |
+ |
+ |
+bool Intrinsifier::Uint64Array_getIndexed(Assembler* assembler) { |
return false; |
} |