| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // update. Array length is always a Smi. | 231 // update. Array length is always a Smi. |
| 232 static bool Array_setIndexed(Assembler* assembler) { | 232 static bool Array_setIndexed(Assembler* assembler) { |
| 233 Label fall_through; | 233 Label fall_through; |
| 234 if (FLAG_enable_type_checks) { | 234 if (FLAG_enable_type_checks) { |
| 235 const intptr_t type_args_field_offset = | 235 const intptr_t type_args_field_offset = |
| 236 ComputeObjectArrayTypeArgumentsOffset(); | 236 ComputeObjectArrayTypeArgumentsOffset(); |
| 237 // Inline simple tests (Smi, null), fallthrough if not positive. | 237 // Inline simple tests (Smi, null), fallthrough if not positive. |
| 238 const Immediate raw_null = | 238 const Immediate raw_null = |
| 239 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 239 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 240 Label checked_ok; | 240 Label checked_ok; |
| 241 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value. | 241 __ movl(EDI, Address(ESP, + 1 * kWordSize)); // Value. |
| 242 __ cmpl(EAX, raw_null); | 242 // Null value is valid for any type. |
| 243 __ cmpl(EDI, raw_null); |
| 243 __ j(EQUAL, &checked_ok, Assembler::kNearJump); | 244 __ j(EQUAL, &checked_ok, Assembler::kNearJump); |
| 244 __ testl(EAX, Immediate(kSmiTagMask)); | |
| 245 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi value. | |
| 246 | 245 |
| 247 __ movl(EBX, Address(ESP, + 3 * kWordSize)); // Array. | 246 __ movl(EBX, Address(ESP, + 3 * kWordSize)); // Array. |
| 248 __ movl(EBX, FieldAddress(EBX, type_args_field_offset)); | 247 __ movl(EBX, FieldAddress(EBX, type_args_field_offset)); |
| 249 // EBX: Type arguments of array. | 248 // EBX: Type arguments of array. |
| 250 __ movl(EAX, FieldAddress(EBX, Object::class_offset())); | 249 __ movl(EAX, FieldAddress(EBX, Object::class_offset())); |
| 251 // Check if it's Dynamic, int, or num. | 250 // Check if it's Dynamic. |
| 252 __ cmpl(EAX, raw_null); // Dynamic? | 251 __ cmpl(EAX, raw_null); |
| 253 __ j(EQUAL, &checked_ok, Assembler::kNearJump); | 252 __ j(EQUAL, &checked_ok, Assembler::kNearJump); |
| 254 // For now handle only TypeArguments and bail out if InstantiatedTypeArgs. | 253 // For now handle only TypeArguments and bail out if InstantiatedTypeArgs. |
| 255 __ CompareObject(EAX, Object::ZoneHandle(Object::type_arguments_class())); | 254 __ CompareObject(EAX, Object::ZoneHandle(Object::type_arguments_class())); |
| 256 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); | 255 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 257 // Get type at index 0. | 256 // Get type at index 0. |
| 258 __ movl(EAX, FieldAddress(EBX, TypeArguments::type_at_offset(0))); | 257 __ movl(EAX, FieldAddress(EBX, TypeArguments::type_at_offset(0))); |
| 259 __ CompareObject(EAX, Type::ZoneHandle(Type::DynamicType())); | 258 __ CompareObject(EAX, Type::ZoneHandle(Type::DynamicType())); |
| 260 __ j(EQUAL, &checked_ok, Assembler::kNearJump); | 259 __ j(EQUAL, &checked_ok, Assembler::kNearJump); |
| 260 // Check for int and num. |
| 261 __ testl(EDI, Immediate(kSmiTagMask)); // Value is Smi? |
| 262 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi value. |
| 261 __ CompareObject(EAX, Type::ZoneHandle(Type::IntInterface())); | 263 __ CompareObject(EAX, Type::ZoneHandle(Type::IntInterface())); |
| 262 __ j(EQUAL, &checked_ok, Assembler::kNearJump); | 264 __ j(EQUAL, &checked_ok, Assembler::kNearJump); |
| 263 __ CompareObject(EAX, Type::ZoneHandle(Type::NumberInterface())); | 265 __ CompareObject(EAX, Type::ZoneHandle(Type::NumberInterface())); |
| 264 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); | 266 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 265 __ Bind(&checked_ok); | 267 __ Bind(&checked_ok); |
| 266 } | 268 } |
| 267 __ movl(EBX, Address(ESP, + 2 * kWordSize)); // Index. | 269 __ movl(EBX, Address(ESP, + 2 * kWordSize)); // Index. |
| 268 __ testl(EBX, Immediate(kSmiTagMask)); | 270 __ testl(EBX, Immediate(kSmiTagMask)); |
| 269 // Index not Smi. | 271 // Index not Smi. |
| 270 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); | 272 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 } \ | 1289 } \ |
| 1288 | 1290 |
| 1289 INTRINSIC_LIST(FIND_INTRINSICS); | 1291 INTRINSIC_LIST(FIND_INTRINSICS); |
| 1290 #undef FIND_INTRINSICS | 1292 #undef FIND_INTRINSICS |
| 1291 return false; | 1293 return false; |
| 1292 } | 1294 } |
| 1293 | 1295 |
| 1294 } // namespace dart | 1296 } // namespace dart |
| 1295 | 1297 |
| 1296 #endif // defined TARGET_ARCH_IA32 | 1298 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |