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

Side by Side Diff: runtime/vm/intrinsifier_ia32.cc

Issue 10447064: In generated code for ia32 don't load object's class directly from class_ field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 __ cmpl(EDI, raw_null); 197 __ cmpl(EDI, raw_null);
198 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 198 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
199 199
200 __ movl(EBX, Address(ESP, + 3 * kWordSize)); // Array. 200 __ movl(EBX, Address(ESP, + 3 * kWordSize)); // Array.
201 __ movl(EBX, FieldAddress(EBX, type_args_field_offset)); 201 __ movl(EBX, FieldAddress(EBX, type_args_field_offset));
202 // EBX: Type arguments of array. 202 // EBX: Type arguments of array.
203 __ cmpl(EBX, raw_null); 203 __ cmpl(EBX, raw_null);
204 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 204 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
205 // Check if it's Dynamic. 205 // Check if it's Dynamic.
206 // For now handle only TypeArguments and bail out if InstantiatedTypeArgs. 206 // For now handle only TypeArguments and bail out if InstantiatedTypeArgs.
207 __ movl(EAX, FieldAddress(EBX, Object::class_offset())); 207 __ CompareClassOfObject(EBX,
208 __ CompareObject(EAX, Object::ZoneHandle(Object::type_arguments_class())); 208 Class::Handle(Object::type_arguments_class()),
209 EAX);
209 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); 210 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
210 // Get type at index 0. 211 // Get type at index 0.
211 __ movl(EAX, FieldAddress(EBX, TypeArguments::type_at_offset(0))); 212 __ movl(EAX, FieldAddress(EBX, TypeArguments::type_at_offset(0)));
212 __ CompareObject(EAX, Type::ZoneHandle(Type::DynamicType())); 213 __ CompareObject(EAX, Type::ZoneHandle(Type::DynamicType()));
213 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 214 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
214 // Check for int and num. 215 // Check for int and num.
215 __ testl(EDI, Immediate(kSmiTagMask)); // Value is Smi? 216 __ testl(EDI, Immediate(kSmiTagMask)); // Value is Smi?
216 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi value. 217 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi value.
217 __ CompareObject(EAX, Type::ZoneHandle(Type::IntInterface())); 218 __ CompareObject(EAX, Type::ZoneHandle(Type::IntInterface()));
218 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 219 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 Label receiver_not_smi; 744 Label receiver_not_smi;
744 __ Bind(&check_for_mint); 745 __ Bind(&check_for_mint);
745 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Receiver. 746 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Receiver.
746 __ testl(EAX, Immediate(kSmiTagMask)); 747 __ testl(EAX, Immediate(kSmiTagMask));
747 __ j(NOT_ZERO, &receiver_not_smi); 748 __ j(NOT_ZERO, &receiver_not_smi);
748 749
749 // Note that an instance of Mint never contains a value that can be 750 // Note that an instance of Mint never contains a value that can be
750 // represented by Smi. 751 // represented by Smi.
751 // Left is Smi, return false if right is Mint, otherwise fall through. 752 // Left is Smi, return false if right is Mint, otherwise fall through.
752 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Right argument. 753 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Right argument.
753 __ movl(EAX, FieldAddress(EAX, Object::class_offset())); 754 __ CompareClassOfObject(EAX, Class::Handle(object_store->mint_class()), EAX);
754 __ CompareObject(EAX, Class::ZoneHandle(object_store->mint_class()));
755 __ j(NOT_EQUAL, &fall_through); 755 __ j(NOT_EQUAL, &fall_through);
756 __ LoadObject(EAX, bool_false); // Smi == Mint -> false. 756 __ LoadObject(EAX, bool_false); // Smi == Mint -> false.
757 __ ret(); 757 __ ret();
758 758
759 __ Bind(&receiver_not_smi); 759 __ Bind(&receiver_not_smi);
760 // EAX:: receiver. 760 // EAX:: receiver.
761 __ movl(EAX, FieldAddress(EAX, Object::class_offset())); 761 __ CompareClassOfObject(EAX, Class::Handle(object_store->mint_class()), EAX);
762 __ CompareObject(EAX, Class::ZoneHandle(object_store->mint_class()));
763 __ j(NOT_EQUAL, &fall_through); 762 __ j(NOT_EQUAL, &fall_through);
764 // Receiver is Mint, return false if right is Smi. 763 // Receiver is Mint, return false if right is Smi.
765 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Right argument. 764 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Right argument.
766 __ testl(EAX, Immediate(kSmiTagMask)); 765 __ testl(EAX, Immediate(kSmiTagMask));
767 __ j(NOT_ZERO, &fall_through); 766 __ j(NOT_ZERO, &fall_through);
768 __ LoadObject(EAX, bool_false); // Smi == Mint -> false. 767 __ LoadObject(EAX, bool_false); // Smi == Mint -> false.
769 __ ret(); 768 __ ret();
770 // TODO(srdjan): Implement Mint == Mint comparison. 769 // TODO(srdjan): Implement Mint == Mint comparison.
771 770
772 __ Bind(&fall_through); 771 __ Bind(&fall_through);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 820
822 // Check if the last argument is a double, jump to label 'is_smi' if smi 821 // Check if the last argument is a double, jump to label 'is_smi' if smi
823 // (easy to convert to double), otherwise jump to label 'not_double_smi', 822 // (easy to convert to double), otherwise jump to label 'not_double_smi',
824 // Returns the last argument in EAX. 823 // Returns the last argument in EAX.
825 static void TestLastArgumentIsDouble(Assembler* assembler, 824 static void TestLastArgumentIsDouble(Assembler* assembler,
826 Label* is_smi, 825 Label* is_smi,
827 Label* not_double_smi) { 826 Label* not_double_smi) {
828 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 827 __ movl(EAX, Address(ESP, + 1 * kWordSize));
829 __ testl(EAX, Immediate(kSmiTagMask)); 828 __ testl(EAX, Immediate(kSmiTagMask));
830 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi. 829 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi.
831 __ LoadObject(EBX, Class::ZoneHandle( 830 __ CompareClassOfObject(EAX, Class::Handle(
832 Isolate::Current()->object_store()->double_class())); 831 Isolate::Current()->object_store()->double_class()), EBX);
833 __ cmpl(EBX, FieldAddress(EAX, Object::class_offset()));
834 __ j(NOT_EQUAL, not_double_smi, Assembler::kNearJump); 832 __ j(NOT_EQUAL, not_double_smi, Assembler::kNearJump);
835 // Fall through if double. 833 // Fall through if double.
836 } 834 }
837 835
838 836
839 // Both arguments on stack, arg0 (left) is a double, arg1 (right) is of unknown 837 // Both arguments on stack, arg0 (left) is a double, arg1 (right) is of unknown
840 // type. Return true or false object in the register EAX. Any NaN argument 838 // type. Return true or false object in the register EAX. Any NaN argument
841 // returns false. Any non-double arg1 causes control flow to fall through to the 839 // returns false. Any non-double arg1 causes control flow to fall through to the
842 // slow case (compiled method body). 840 // slow case (compiled method body).
843 static bool CompareDoubles(Assembler* assembler, Condition true_condition) { 841 static bool CompareDoubles(Assembler* assembler, Condition true_condition) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 ObjectStore* object_store = Isolate::Current()->object_store(); 1244 ObjectStore* object_store = Isolate::Current()->object_store();
1247 Label fall_through; 1245 Label fall_through;
1248 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index. 1246 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
1249 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String. 1247 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String.
1250 __ testl(EBX, Immediate(kSmiTagMask)); 1248 __ testl(EBX, Immediate(kSmiTagMask));
1251 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. 1249 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
1252 // Range check. 1250 // Range check.
1253 __ cmpl(EBX, FieldAddress(EAX, String::length_offset())); 1251 __ cmpl(EBX, FieldAddress(EAX, String::length_offset()));
1254 // Runtime throws exception. 1252 // Runtime throws exception.
1255 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 1253 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
1256 __ movl(EDI, FieldAddress(EAX, Instance::class_offset())); 1254 __ CompareClassOfObject(EAX,
1257 __ CompareObject(EDI, 1255 Class::Handle(object_store->one_byte_string_class()),
1258 Class::ZoneHandle(object_store->one_byte_string_class())); 1256 EDI);
1259 __ j(NOT_EQUAL, &fall_through); 1257 __ j(NOT_EQUAL, &fall_through);
1260 __ SmiUntag(EBX); 1258 __ SmiUntag(EBX);
1261 __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, OneByteString::data_offset())); 1259 __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, OneByteString::data_offset()));
1262 __ SmiTag(EAX); 1260 __ SmiTag(EAX);
1263 __ ret(); 1261 __ ret();
1264 __ Bind(&fall_through); 1262 __ Bind(&fall_through);
1265 return false; 1263 return false;
1266 } 1264 }
1267 1265
1268 1266
(...skipping 24 matching lines...) Expand all
1293 __ Bind(&is_true); 1291 __ Bind(&is_true);
1294 __ LoadObject(EAX, bool_true); 1292 __ LoadObject(EAX, bool_true);
1295 __ ret(); 1293 __ ret();
1296 return true; 1294 return true;
1297 } 1295 }
1298 1296
1299 #undef __ 1297 #undef __
1300 } // namespace dart 1298 } // namespace dart
1301 1299
1302 #endif // defined TARGET_ARCH_IA32 1300 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698