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

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

Issue 1674383002: Keep a trail while checking upper bounds in the VM in order to properly handle (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 4 years, 10 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 const AbstractType& type, 263 const AbstractType& type,
264 Label* is_instance_lbl, 264 Label* is_instance_lbl,
265 Label* is_not_instance_lbl) { 265 Label* is_not_instance_lbl) {
266 __ Comment("InstantiatedTypeWithArgumentsTest"); 266 __ Comment("InstantiatedTypeWithArgumentsTest");
267 ASSERT(type.IsInstantiated()); 267 ASSERT(type.IsInstantiated());
268 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); 268 const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
269 ASSERT(type.IsFunctionType() || (type_class.NumTypeArguments() > 0)); 269 ASSERT(type.IsFunctionType() || (type_class.NumTypeArguments() > 0));
270 const Register kInstanceReg = R0; 270 const Register kInstanceReg = R0;
271 Error& bound_error = Error::Handle(zone()); 271 Error& bound_error = Error::Handle(zone());
272 const Type& int_type = Type::Handle(zone(), Type::IntType()); 272 const Type& int_type = Type::Handle(zone(), Type::IntType());
273 const bool smi_is_ok = int_type.IsSubtypeOf(type, &bound_error, Heap::kOld); 273 const bool smi_is_ok =
274 int_type.IsSubtypeOf(type, &bound_error, NULL, Heap::kOld);
274 // Malformed type should have been handled at graph construction time. 275 // Malformed type should have been handled at graph construction time.
275 ASSERT(smi_is_ok || bound_error.IsNull()); 276 ASSERT(smi_is_ok || bound_error.IsNull());
276 __ tsti(kInstanceReg, Immediate(kSmiTagMask)); 277 __ tsti(kInstanceReg, Immediate(kSmiTagMask));
277 if (smi_is_ok) { 278 if (smi_is_ok) {
278 __ b(is_instance_lbl, EQ); 279 __ b(is_instance_lbl, EQ);
279 } else { 280 } else {
280 __ b(is_not_instance_lbl, EQ); 281 __ b(is_not_instance_lbl, EQ);
281 } 282 }
282 // A function type test requires checking the function signature. 283 // A function type test requires checking the function signature.
283 if (!type.IsFunctionType()) { 284 if (!type.IsFunctionType()) {
(...skipping 19 matching lines...) Expand all
303 } 304 }
304 // If one type argument only, check if type argument is Object or dynamic. 305 // If one type argument only, check if type argument is Object or dynamic.
305 if (type_arguments.Length() == 1) { 306 if (type_arguments.Length() == 1) {
306 const AbstractType& tp_argument = AbstractType::ZoneHandle( 307 const AbstractType& tp_argument = AbstractType::ZoneHandle(
307 zone(), type_arguments.TypeAt(0)); 308 zone(), type_arguments.TypeAt(0));
308 ASSERT(!tp_argument.IsMalformed()); 309 ASSERT(!tp_argument.IsMalformed());
309 if (tp_argument.IsType()) { 310 if (tp_argument.IsType()) {
310 ASSERT(tp_argument.HasResolvedTypeClass()); 311 ASSERT(tp_argument.HasResolvedTypeClass());
311 // Check if type argument is dynamic or Object. 312 // Check if type argument is dynamic or Object.
312 const Type& object_type = Type::Handle(zone(), Type::ObjectType()); 313 const Type& object_type = Type::Handle(zone(), Type::ObjectType());
313 if (object_type.IsSubtypeOf(tp_argument, NULL, Heap::kOld)) { 314 if (object_type.IsSubtypeOf(tp_argument, NULL, NULL, Heap::kOld)) {
314 // Instance class test only necessary. 315 // Instance class test only necessary.
315 return GenerateSubtype1TestCacheLookup( 316 return GenerateSubtype1TestCacheLookup(
316 token_pos, type_class, is_instance_lbl, is_not_instance_lbl); 317 token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
317 } 318 }
318 } 319 }
319 } 320 }
320 } 321 }
321 // Regular subtype test cache involving instance's type arguments. 322 // Regular subtype test cache involving instance's type arguments.
322 const Register kTypeArgumentsReg = kNoRegister; 323 const Register kTypeArgumentsReg = kNoRegister;
323 const Register kTempReg = kNoRegister; 324 const Register kTempReg = kNoRegister;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 ASSERT(type_class.NumTypeArguments() == 0); 364 ASSERT(type_class.NumTypeArguments() == 0);
364 365
365 const Register kInstanceReg = R0; 366 const Register kInstanceReg = R0;
366 __ tsti(kInstanceReg, Immediate(kSmiTagMask)); 367 __ tsti(kInstanceReg, Immediate(kSmiTagMask));
367 // If instance is Smi, check directly. 368 // If instance is Smi, check directly.
368 const Class& smi_class = Class::Handle(zone(), Smi::Class()); 369 const Class& smi_class = Class::Handle(zone(), Smi::Class());
369 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()), 370 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()),
370 type_class, 371 type_class,
371 TypeArguments::Handle(zone()), 372 TypeArguments::Handle(zone()),
372 NULL, 373 NULL,
374 NULL,
373 Heap::kOld)) { 375 Heap::kOld)) {
374 __ b(is_instance_lbl, EQ); 376 __ b(is_instance_lbl, EQ);
375 } else { 377 } else {
376 __ b(is_not_instance_lbl, EQ); 378 __ b(is_not_instance_lbl, EQ);
377 } 379 }
378 // Compare if the classes are equal. 380 // Compare if the classes are equal.
379 const Register kClassIdReg = R2; 381 const Register kClassIdReg = R2;
380 __ LoadClassId(kClassIdReg, kInstanceReg); 382 __ LoadClassId(kClassIdReg, kInstanceReg);
381 __ CompareImmediate(kClassIdReg, type_class.id()); 383 __ CompareImmediate(kClassIdReg, type_class.id());
382 __ b(is_instance_lbl, EQ); 384 __ b(is_instance_lbl, EQ);
383 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted 385 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted
384 // interfaces. 386 // interfaces.
385 // Bool interface can be implemented only by core class Bool. 387 // Bool interface can be implemented only by core class Bool.
386 if (type.IsBoolType()) { 388 if (type.IsBoolType()) {
387 __ CompareImmediate(kClassIdReg, kBoolCid); 389 __ CompareImmediate(kClassIdReg, kBoolCid);
388 __ b(is_instance_lbl, EQ); 390 __ b(is_instance_lbl, EQ);
389 __ b(is_not_instance_lbl); 391 __ b(is_not_instance_lbl);
390 return false; 392 return false;
391 } 393 }
392 if (type.IsDartFunctionType()) { 394 if (type.IsDartFunctionType()) {
393 // Check if instance is a closure. 395 // Check if instance is a closure.
394 __ CompareImmediate(kClassIdReg, kClosureCid); 396 __ CompareImmediate(kClassIdReg, kClosureCid);
395 __ b(is_instance_lbl, EQ); 397 __ b(is_instance_lbl, EQ);
396 } 398 }
397 // Custom checking for numbers (Smi, Mint, Bigint and Double). 399 // Custom checking for numbers (Smi, Mint, Bigint and Double).
398 // Note that instance is not Smi (checked above). 400 // Note that instance is not Smi (checked above).
399 if (type.IsSubtypeOf( 401 if (type.IsSubtypeOf(
400 Type::Handle(zone(), Type::Number()), NULL, Heap::kOld)) { 402 Type::Handle(zone(), Type::Number()), NULL, NULL, Heap::kOld)) {
401 GenerateNumberTypeCheck( 403 GenerateNumberTypeCheck(
402 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); 404 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl);
403 return false; 405 return false;
404 } 406 }
405 if (type.IsStringType()) { 407 if (type.IsStringType()) {
406 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); 408 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl);
407 return false; 409 return false;
408 } 410 }
409 // Otherwise fallthrough. 411 // Otherwise fallthrough.
410 return true; 412 return true;
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1876 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1875 __ PopDouble(reg); 1877 __ PopDouble(reg);
1876 } 1878 }
1877 1879
1878 1880
1879 #undef __ 1881 #undef __
1880 1882
1881 } // namespace dart 1883 } // namespace dart
1882 1884
1883 #endif // defined TARGET_ARCH_ARM64 1885 #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