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

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

Issue 1377453005: Cleanups and preemptively pass Heap::kOld whenever subtype testing in compiler (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: sync Created 5 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm64.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 "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 const AbstractType& type, 258 const AbstractType& type,
259 Label* is_instance_lbl, 259 Label* is_instance_lbl,
260 Label* is_not_instance_lbl) { 260 Label* is_not_instance_lbl) {
261 __ Comment("InstantiatedTypeWithArgumentsTest"); 261 __ Comment("InstantiatedTypeWithArgumentsTest");
262 ASSERT(type.IsInstantiated()); 262 ASSERT(type.IsInstantiated());
263 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); 263 const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
264 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass()); 264 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass());
265 const Register kInstanceReg = R0; 265 const Register kInstanceReg = R0;
266 Error& malformed_error = Error::Handle(zone()); 266 Error& malformed_error = Error::Handle(zone());
267 const Type& int_type = Type::Handle(zone(), Type::IntType()); 267 const Type& int_type = Type::Handle(zone(), Type::IntType());
268 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error); 268 const bool smi_is_ok =
269 int_type.IsSubtypeOf(type, &malformed_error, Heap::kOld);
269 // Malformed type should have been handled at graph construction time. 270 // Malformed type should have been handled at graph construction time.
270 ASSERT(smi_is_ok || malformed_error.IsNull()); 271 ASSERT(smi_is_ok || malformed_error.IsNull());
271 __ tst(kInstanceReg, Operand(kSmiTagMask)); 272 __ tst(kInstanceReg, Operand(kSmiTagMask));
272 if (smi_is_ok) { 273 if (smi_is_ok) {
273 __ b(is_instance_lbl, EQ); 274 __ b(is_instance_lbl, EQ);
274 } else { 275 } else {
275 __ b(is_not_instance_lbl, EQ); 276 __ b(is_not_instance_lbl, EQ);
276 } 277 }
277 const intptr_t num_type_args = type_class.NumTypeArguments(); 278 const intptr_t num_type_args = type_class.NumTypeArguments();
278 const intptr_t num_type_params = type_class.NumTypeParameters(); 279 const intptr_t num_type_params = type_class.NumTypeParameters();
(...skipping 19 matching lines...) Expand all
298 } 299 }
299 // If one type argument only, check if type argument is Object or dynamic. 300 // If one type argument only, check if type argument is Object or dynamic.
300 if (type_arguments.Length() == 1) { 301 if (type_arguments.Length() == 1) {
301 const AbstractType& tp_argument = AbstractType::ZoneHandle( 302 const AbstractType& tp_argument = AbstractType::ZoneHandle(
302 zone(), type_arguments.TypeAt(0)); 303 zone(), type_arguments.TypeAt(0));
303 ASSERT(!tp_argument.IsMalformed()); 304 ASSERT(!tp_argument.IsMalformed());
304 if (tp_argument.IsType()) { 305 if (tp_argument.IsType()) {
305 ASSERT(tp_argument.HasResolvedTypeClass()); 306 ASSERT(tp_argument.HasResolvedTypeClass());
306 // Check if type argument is dynamic or Object. 307 // Check if type argument is dynamic or Object.
307 const Type& object_type = Type::Handle(zone(), Type::ObjectType()); 308 const Type& object_type = Type::Handle(zone(), Type::ObjectType());
308 if (object_type.IsSubtypeOf(tp_argument, NULL)) { 309 if (object_type.IsSubtypeOf(tp_argument, NULL, Heap::kOld)) {
309 // Instance class test only necessary. 310 // Instance class test only necessary.
310 return GenerateSubtype1TestCacheLookup( 311 return GenerateSubtype1TestCacheLookup(
311 token_pos, type_class, is_instance_lbl, is_not_instance_lbl); 312 token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
312 } 313 }
313 } 314 }
314 } 315 }
315 } 316 }
316 // Regular subtype test cache involving instance's type arguments. 317 // Regular subtype test cache involving instance's type arguments.
317 const Register kTypeArgumentsReg = kNoRegister; 318 const Register kTypeArgumentsReg = kNoRegister;
318 const Register kTempReg = kNoRegister; 319 const Register kTempReg = kNoRegister;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 const Class& type_class = Class::Handle(zone(), type.type_class()); 354 const Class& type_class = Class::Handle(zone(), type.type_class());
354 ASSERT(type_class.NumTypeArguments() == 0); 355 ASSERT(type_class.NumTypeArguments() == 0);
355 356
356 const Register kInstanceReg = R0; 357 const Register kInstanceReg = R0;
357 __ tst(kInstanceReg, Operand(kSmiTagMask)); 358 __ tst(kInstanceReg, Operand(kSmiTagMask));
358 // If instance is Smi, check directly. 359 // If instance is Smi, check directly.
359 const Class& smi_class = Class::Handle(zone(), Smi::Class()); 360 const Class& smi_class = Class::Handle(zone(), Smi::Class());
360 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()), 361 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()),
361 type_class, 362 type_class,
362 TypeArguments::Handle(zone()), 363 TypeArguments::Handle(zone()),
363 NULL)) { 364 NULL,
365 Heap::kOld)) {
364 __ b(is_instance_lbl, EQ); 366 __ b(is_instance_lbl, EQ);
365 } else { 367 } else {
366 __ b(is_not_instance_lbl, EQ); 368 __ b(is_not_instance_lbl, EQ);
367 } 369 }
368 // Compare if the classes are equal. 370 // Compare if the classes are equal.
369 const Register kClassIdReg = R2; 371 const Register kClassIdReg = R2;
370 __ LoadClassId(kClassIdReg, kInstanceReg); 372 __ LoadClassId(kClassIdReg, kInstanceReg);
371 __ CompareImmediate(kClassIdReg, type_class.id()); 373 __ CompareImmediate(kClassIdReg, type_class.id());
372 __ b(is_instance_lbl, EQ); 374 __ b(is_instance_lbl, EQ);
373 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted 375 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted
374 // interfaces. 376 // interfaces.
375 // Bool interface can be implemented only by core class Bool. 377 // Bool interface can be implemented only by core class Bool.
376 if (type.IsBoolType()) { 378 if (type.IsBoolType()) {
377 __ CompareImmediate(kClassIdReg, kBoolCid); 379 __ CompareImmediate(kClassIdReg, kBoolCid);
378 __ b(is_instance_lbl, EQ); 380 __ b(is_instance_lbl, EQ);
379 __ b(is_not_instance_lbl); 381 __ b(is_not_instance_lbl);
380 return false; 382 return false;
381 } 383 }
382 if (type.IsFunctionType()) { 384 if (type.IsFunctionType()) {
383 // Check if instance is a closure. 385 // Check if instance is a closure.
384 __ LoadClassById(R3, kClassIdReg); 386 __ LoadClassById(R3, kClassIdReg);
385 __ ldr(R3, FieldAddress(R3, Class::signature_function_offset())); 387 __ ldr(R3, FieldAddress(R3, Class::signature_function_offset()));
386 __ CompareObject(R3, Object::null_object()); 388 __ CompareObject(R3, Object::null_object());
387 __ b(is_instance_lbl, NE); 389 __ b(is_instance_lbl, NE);
388 } 390 }
389 // Custom checking for numbers (Smi, Mint, Bigint and Double). 391 // Custom checking for numbers (Smi, Mint, Bigint and Double).
390 // Note that instance is not Smi (checked above). 392 // Note that instance is not Smi (checked above).
391 if (type.IsSubtypeOf(Type::Handle(zone(), Type::Number()), NULL)) { 393 if (type.IsSubtypeOf(
394 Type::Handle(zone(), Type::Number()), NULL, Heap::kOld)) {
392 GenerateNumberTypeCheck( 395 GenerateNumberTypeCheck(
393 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); 396 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl);
394 return false; 397 return false;
395 } 398 }
396 if (type.IsStringType()) { 399 if (type.IsStringType()) {
397 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); 400 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl);
398 return false; 401 return false;
399 } 402 }
400 // Otherwise fallthrough. 403 // Otherwise fallthrough.
401 return true; 404 return true;
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 DRegister dreg = EvenDRegisterOf(reg); 1867 DRegister dreg = EvenDRegisterOf(reg);
1865 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1868 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1866 } 1869 }
1867 1870
1868 1871
1869 #undef __ 1872 #undef __
1870 1873
1871 } // namespace dart 1874 } // namespace dart
1872 1875
1873 #endif // defined TARGET_ARCH_ARM 1876 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698