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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 11195007: Add value tests to intrinisics GrowableArray _setData and setLength. Thos are private native method… (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 | « no previous file | runtime/vm/intrinsifier_x64.cc » ('j') | runtime/vm/intrinsifier_x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_ia32.cc
===================================================================
--- runtime/vm/intrinsifier_ia32.cc (revision 13693)
+++ runtime/vm/intrinsifier_ia32.cc (working copy)
@@ -406,6 +406,8 @@
Label fall_through;
__ movl(EAX, Address(ESP, + 2 * kWordSize)); // Growable array.
__ movl(EBX, Address(ESP, + 1 * kWordSize)); // Length value.
+ __ testl(EBX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi length.
__ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset()));
__ cmpl(EBX, FieldAddress(EDI, Array::length_offset()));
__ j(ABOVE, &fall_through, Assembler::kNearJump);
@@ -422,13 +424,20 @@
if (FLAG_enable_type_checks) {
return false;
}
- __ movl(EAX, Address(ESP, + 2 * kWordSize));
- __ movl(EBX, Address(ESP, + 1 * kWordSize));
+ Label fall_through;
+ __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Data.
+ // Check that data is an ObjectArray.
+ __ testl(EBX, Immediate(kSmiTagMask));
+ __ j(ZERO, &fall_through, Assembler::kNearJump); // Data is Smi.
+ __ CompareClassId(EBX, kArrayCid, EAX);
+ __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
+ __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Growable array.
__ StoreIntoObject(EAX,
FieldAddress(EAX, GrowableObjectArray::data_offset()),
EBX);
__ ret();
- return true;
+ __ Bind(&fall_through);
+ return false;
}
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_x64.cc » ('j') | runtime/vm/intrinsifier_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698