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

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

Issue 18054022: Fix 11574: Smi is a subtype of parametrizable Compare. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( 218 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
219 intptr_t token_pos, 219 intptr_t token_pos,
220 const AbstractType& type, 220 const AbstractType& type,
221 Label* is_instance_lbl, 221 Label* is_instance_lbl,
222 Label* is_not_instance_lbl) { 222 Label* is_not_instance_lbl) {
223 __ Comment("InstantiatedTypeWithArgumentsTest"); 223 __ Comment("InstantiatedTypeWithArgumentsTest");
224 ASSERT(type.IsInstantiated()); 224 ASSERT(type.IsInstantiated());
225 const Class& type_class = Class::ZoneHandle(type.type_class()); 225 const Class& type_class = Class::ZoneHandle(type.type_class());
226 ASSERT(type_class.HasTypeArguments()); 226 ASSERT(type_class.HasTypeArguments());
227 const Register kInstanceReg = R0; 227 const Register kInstanceReg = R0;
228 // A Smi object cannot be the instance of a parameterized class. 228 Error& malformed_error = Error::Handle();
229 const Type& int_type = Type::Handle(Type::IntType());
230 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error);
231 // Malforrmed type should have been handled at graph construction time.
232 ASSERT(smi_is_ok || malformed_error.IsNull());
229 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask)); 233 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask));
230 __ b(is_not_instance_lbl, EQ); 234 if (smi_is_ok) {
235 __ b(is_instance_lbl, EQ);
236 } else {
237 __ b(is_not_instance_lbl, EQ);
238 }
231 const AbstractTypeArguments& type_arguments = 239 const AbstractTypeArguments& type_arguments =
232 AbstractTypeArguments::ZoneHandle(type.arguments()); 240 AbstractTypeArguments::ZoneHandle(type.arguments());
233 const bool is_raw_type = type_arguments.IsNull() || 241 const bool is_raw_type = type_arguments.IsNull() ||
234 type_arguments.IsRaw(type_arguments.Length()); 242 type_arguments.IsRaw(type_arguments.Length());
235 if (is_raw_type) { 243 if (is_raw_type) {
236 const Register kClassIdReg = R2; 244 const Register kClassIdReg = R2;
237 // dynamic type argument, check only classes. 245 // dynamic type argument, check only classes.
238 __ LoadClassId(kClassIdReg, kInstanceReg); 246 __ LoadClassId(kClassIdReg, kInstanceReg);
239 __ CompareImmediate(kClassIdReg, type_class.id()); 247 __ CompareImmediate(kClassIdReg, type_class.id());
240 __ b(is_instance_lbl, EQ); 248 __ b(is_instance_lbl, EQ);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } else { 503 } else {
496 __ b(is_not_instance_lbl, EQ); 504 __ b(is_not_instance_lbl, EQ);
497 __ CompareClassId(kInstanceReg, type_cid, R3); 505 __ CompareClassId(kInstanceReg, type_cid, R3);
498 __ b(is_instance_lbl, EQ); 506 __ b(is_instance_lbl, EQ);
499 } 507 }
500 __ b(is_not_instance_lbl); 508 __ b(is_not_instance_lbl);
501 return SubtypeTestCache::null(); 509 return SubtypeTestCache::null();
502 } 510 }
503 if (type.IsInstantiated()) { 511 if (type.IsInstantiated()) {
504 const Class& type_class = Class::ZoneHandle(type.type_class()); 512 const Class& type_class = Class::ZoneHandle(type.type_class());
505 // A Smi object cannot be the instance of a parameterized class.
506 // A class equality check is only applicable with a dst type of a 513 // A class equality check is only applicable with a dst type of a
507 // non-parameterized class or with a raw dst type of a parameterized class. 514 // non-parameterized class or with a raw dst type of a parameterized class.
508 if (type_class.HasTypeArguments()) { 515 if (type_class.HasTypeArguments()) {
509 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, 516 return GenerateInstantiatedTypeWithArgumentsTest(token_pos,
510 type, 517 type,
511 is_instance_lbl, 518 is_instance_lbl,
512 is_not_instance_lbl); 519 is_not_instance_lbl);
513 // Fall through to runtime call. 520 // Fall through to runtime call.
514 } 521 }
515 const bool has_fall_through = 522 const bool has_fall_through =
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1761 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1755 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); 1762 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex));
1756 } 1763 }
1757 1764
1758 1765
1759 #undef __ 1766 #undef __
1760 1767
1761 } // namespace dart 1768 } // namespace dart
1762 1769
1763 #endif // defined TARGET_ARCH_ARM 1770 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698