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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm64.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_compiler_arm.cc ('k') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 const AbstractType& type, 250 const AbstractType& type,
251 Label* is_instance_lbl, 251 Label* is_instance_lbl,
252 Label* is_not_instance_lbl) { 252 Label* is_not_instance_lbl) {
253 __ Comment("InstantiatedTypeWithArgumentsTest"); 253 __ Comment("InstantiatedTypeWithArgumentsTest");
254 ASSERT(type.IsInstantiated()); 254 ASSERT(type.IsInstantiated());
255 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); 255 const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
256 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass()); 256 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass());
257 const Register kInstanceReg = R0; 257 const Register kInstanceReg = R0;
258 Error& malformed_error = Error::Handle(zone()); 258 Error& malformed_error = Error::Handle(zone());
259 const Type& int_type = Type::Handle(zone(), Type::IntType()); 259 const Type& int_type = Type::Handle(zone(), Type::IntType());
260 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error); 260 const bool smi_is_ok =
261 int_type.IsSubtypeOf(type, &malformed_error, Heap::kOld);
261 // Malformed type should have been handled at graph construction time. 262 // Malformed type should have been handled at graph construction time.
262 ASSERT(smi_is_ok || malformed_error.IsNull()); 263 ASSERT(smi_is_ok || malformed_error.IsNull());
263 __ tsti(kInstanceReg, Immediate(kSmiTagMask)); 264 __ tsti(kInstanceReg, Immediate(kSmiTagMask));
264 if (smi_is_ok) { 265 if (smi_is_ok) {
265 __ b(is_instance_lbl, EQ); 266 __ b(is_instance_lbl, EQ);
266 } else { 267 } else {
267 __ b(is_not_instance_lbl, EQ); 268 __ b(is_not_instance_lbl, EQ);
268 } 269 }
269 const intptr_t num_type_args = type_class.NumTypeArguments(); 270 const intptr_t num_type_args = type_class.NumTypeArguments();
270 const intptr_t num_type_params = type_class.NumTypeParameters(); 271 const intptr_t num_type_params = type_class.NumTypeParameters();
(...skipping 19 matching lines...) Expand all
290 } 291 }
291 // If one type argument only, check if type argument is Object or dynamic. 292 // If one type argument only, check if type argument is Object or dynamic.
292 if (type_arguments.Length() == 1) { 293 if (type_arguments.Length() == 1) {
293 const AbstractType& tp_argument = AbstractType::ZoneHandle( 294 const AbstractType& tp_argument = AbstractType::ZoneHandle(
294 zone(), type_arguments.TypeAt(0)); 295 zone(), type_arguments.TypeAt(0));
295 ASSERT(!tp_argument.IsMalformed()); 296 ASSERT(!tp_argument.IsMalformed());
296 if (tp_argument.IsType()) { 297 if (tp_argument.IsType()) {
297 ASSERT(tp_argument.HasResolvedTypeClass()); 298 ASSERT(tp_argument.HasResolvedTypeClass());
298 // Check if type argument is dynamic or Object. 299 // Check if type argument is dynamic or Object.
299 const Type& object_type = Type::Handle(zone(), Type::ObjectType()); 300 const Type& object_type = Type::Handle(zone(), Type::ObjectType());
300 if (object_type.IsSubtypeOf(tp_argument, NULL)) { 301 if (object_type.IsSubtypeOf(tp_argument, NULL, Heap::kOld)) {
301 // Instance class test only necessary. 302 // Instance class test only necessary.
302 return GenerateSubtype1TestCacheLookup( 303 return GenerateSubtype1TestCacheLookup(
303 token_pos, type_class, is_instance_lbl, is_not_instance_lbl); 304 token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
304 } 305 }
305 } 306 }
306 } 307 }
307 } 308 }
308 // Regular subtype test cache involving instance's type arguments. 309 // Regular subtype test cache involving instance's type arguments.
309 const Register kTypeArgumentsReg = kNoRegister; 310 const Register kTypeArgumentsReg = kNoRegister;
310 const Register kTempReg = kNoRegister; 311 const Register kTempReg = kNoRegister;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 const Class& type_class = Class::Handle(zone(), type.type_class()); 346 const Class& type_class = Class::Handle(zone(), type.type_class());
346 ASSERT(type_class.NumTypeArguments() == 0); 347 ASSERT(type_class.NumTypeArguments() == 0);
347 348
348 const Register kInstanceReg = R0; 349 const Register kInstanceReg = R0;
349 __ tsti(kInstanceReg, Immediate(kSmiTagMask)); 350 __ tsti(kInstanceReg, Immediate(kSmiTagMask));
350 // If instance is Smi, check directly. 351 // If instance is Smi, check directly.
351 const Class& smi_class = Class::Handle(zone(), Smi::Class()); 352 const Class& smi_class = Class::Handle(zone(), Smi::Class());
352 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()), 353 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()),
353 type_class, 354 type_class,
354 TypeArguments::Handle(zone()), 355 TypeArguments::Handle(zone()),
355 NULL)) { 356 NULL,
357 Heap::kOld)) {
356 __ b(is_instance_lbl, EQ); 358 __ b(is_instance_lbl, EQ);
357 } else { 359 } else {
358 __ b(is_not_instance_lbl, EQ); 360 __ b(is_not_instance_lbl, EQ);
359 } 361 }
360 // Compare if the classes are equal. 362 // Compare if the classes are equal.
361 const Register kClassIdReg = R2; 363 const Register kClassIdReg = R2;
362 __ LoadClassId(kClassIdReg, kInstanceReg); 364 __ LoadClassId(kClassIdReg, kInstanceReg);
363 __ CompareImmediate(kClassIdReg, type_class.id()); 365 __ CompareImmediate(kClassIdReg, type_class.id());
364 __ b(is_instance_lbl, EQ); 366 __ b(is_instance_lbl, EQ);
365 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted 367 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted
366 // interfaces. 368 // interfaces.
367 // Bool interface can be implemented only by core class Bool. 369 // Bool interface can be implemented only by core class Bool.
368 if (type.IsBoolType()) { 370 if (type.IsBoolType()) {
369 __ CompareImmediate(kClassIdReg, kBoolCid); 371 __ CompareImmediate(kClassIdReg, kBoolCid);
370 __ b(is_instance_lbl, EQ); 372 __ b(is_instance_lbl, EQ);
371 __ b(is_not_instance_lbl); 373 __ b(is_not_instance_lbl);
372 return false; 374 return false;
373 } 375 }
374 if (type.IsFunctionType()) { 376 if (type.IsFunctionType()) {
375 // Check if instance is a closure. 377 // Check if instance is a closure.
376 __ LoadClassById(R3, kClassIdReg); 378 __ LoadClassById(R3, kClassIdReg);
377 __ LoadFieldFromOffset(R3, R3, Class::signature_function_offset()); 379 __ LoadFieldFromOffset(R3, R3, Class::signature_function_offset());
378 __ CompareObject(R3, Object::null_object()); 380 __ CompareObject(R3, Object::null_object());
379 __ b(is_instance_lbl, NE); 381 __ b(is_instance_lbl, NE);
380 } 382 }
381 // Custom checking for numbers (Smi, Mint, Bigint and Double). 383 // Custom checking for numbers (Smi, Mint, Bigint and Double).
382 // Note that instance is not Smi (checked above). 384 // Note that instance is not Smi (checked above).
383 if (type.IsSubtypeOf(Type::Handle(zone(), Type::Number()), NULL)) { 385 if (type.IsSubtypeOf(
386 Type::Handle(zone(), Type::Number()), NULL, Heap::kOld)) {
384 GenerateNumberTypeCheck( 387 GenerateNumberTypeCheck(
385 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); 388 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl);
386 return false; 389 return false;
387 } 390 }
388 if (type.IsStringType()) { 391 if (type.IsStringType()) {
389 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); 392 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl);
390 return false; 393 return false;
391 } 394 }
392 // Otherwise fallthrough. 395 // Otherwise fallthrough.
393 return true; 396 return true;
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1821 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1819 __ PopDouble(reg); 1822 __ PopDouble(reg);
1820 } 1823 }
1821 1824
1822 1825
1823 #undef __ 1826 #undef __
1824 1827
1825 } // namespace dart 1828 } // namespace dart
1826 1829
1827 #endif // defined TARGET_ARCH_ARM64 1830 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698