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

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

Issue 593363003: Expands the use of Immediate and Operand wrappers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 __ Comment("InstantiatedTypeWithArgumentsTest"); 248 __ Comment("InstantiatedTypeWithArgumentsTest");
249 ASSERT(type.IsInstantiated()); 249 ASSERT(type.IsInstantiated());
250 const Class& type_class = Class::ZoneHandle(type.type_class()); 250 const Class& type_class = Class::ZoneHandle(type.type_class());
251 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass()); 251 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass());
252 const Register kInstanceReg = R0; 252 const Register kInstanceReg = R0;
253 Error& malformed_error = Error::Handle(); 253 Error& malformed_error = Error::Handle();
254 const Type& int_type = Type::Handle(Type::IntType()); 254 const Type& int_type = Type::Handle(Type::IntType());
255 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error); 255 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error);
256 // Malformed type should have been handled at graph construction time. 256 // Malformed type should have been handled at graph construction time.
257 ASSERT(smi_is_ok || malformed_error.IsNull()); 257 ASSERT(smi_is_ok || malformed_error.IsNull());
258 __ tsti(kInstanceReg, kSmiTagMask); 258 __ tsti(kInstanceReg, Immediate(kSmiTagMask));
259 if (smi_is_ok) { 259 if (smi_is_ok) {
260 __ b(is_instance_lbl, EQ); 260 __ b(is_instance_lbl, EQ);
261 } else { 261 } else {
262 __ b(is_not_instance_lbl, EQ); 262 __ b(is_not_instance_lbl, EQ);
263 } 263 }
264 const intptr_t num_type_args = type_class.NumTypeArguments(); 264 const intptr_t num_type_args = type_class.NumTypeArguments();
265 const intptr_t num_type_params = type_class.NumTypeParameters(); 265 const intptr_t num_type_params = type_class.NumTypeParameters();
266 const intptr_t from_index = num_type_args - num_type_params; 266 const intptr_t from_index = num_type_args - num_type_params;
267 const TypeArguments& type_arguments = 267 const TypeArguments& type_arguments =
268 TypeArguments::ZoneHandle(type.arguments()); 268 TypeArguments::ZoneHandle(type.arguments());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 intptr_t token_pos, 334 intptr_t token_pos,
335 const AbstractType& type, 335 const AbstractType& type,
336 Label* is_instance_lbl, 336 Label* is_instance_lbl,
337 Label* is_not_instance_lbl) { 337 Label* is_not_instance_lbl) {
338 __ Comment("InstantiatedTypeNoArgumentsTest"); 338 __ Comment("InstantiatedTypeNoArgumentsTest");
339 ASSERT(type.IsInstantiated()); 339 ASSERT(type.IsInstantiated());
340 const Class& type_class = Class::Handle(type.type_class()); 340 const Class& type_class = Class::Handle(type.type_class());
341 ASSERT(type_class.NumTypeArguments() == 0); 341 ASSERT(type_class.NumTypeArguments() == 0);
342 342
343 const Register kInstanceReg = R0; 343 const Register kInstanceReg = R0;
344 __ tsti(kInstanceReg, kSmiTagMask); 344 __ tsti(kInstanceReg, Immediate(kSmiTagMask));
345 // If instance is Smi, check directly. 345 // If instance is Smi, check directly.
346 const Class& smi_class = Class::Handle(Smi::Class()); 346 const Class& smi_class = Class::Handle(Smi::Class());
347 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), 347 if (smi_class.IsSubtypeOf(TypeArguments::Handle(),
348 type_class, 348 type_class,
349 TypeArguments::Handle(), 349 TypeArguments::Handle(),
350 NULL)) { 350 NULL)) {
351 __ b(is_instance_lbl, EQ); 351 __ b(is_instance_lbl, EQ);
352 } else { 352 } else {
353 __ b(is_not_instance_lbl, EQ); 353 __ b(is_not_instance_lbl, EQ);
354 } 354 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 R2, R1, TypeArguments::type_at_offset(type_param.index()), PP); 444 R2, R1, TypeArguments::type_at_offset(type_param.index()), PP);
445 // R2: concrete type of type. 445 // R2: concrete type of type.
446 // Check if type argument is dynamic. 446 // Check if type argument is dynamic.
447 __ CompareObject(R2, Type::ZoneHandle(Type::DynamicType()), PP); 447 __ CompareObject(R2, Type::ZoneHandle(Type::DynamicType()), PP);
448 __ b(is_instance_lbl, EQ); 448 __ b(is_instance_lbl, EQ);
449 __ CompareObject(R2, Type::ZoneHandle(Type::ObjectType()), PP); 449 __ CompareObject(R2, Type::ZoneHandle(Type::ObjectType()), PP);
450 __ b(is_instance_lbl, EQ); 450 __ b(is_instance_lbl, EQ);
451 451
452 // For Smi check quickly against int and num interfaces. 452 // For Smi check quickly against int and num interfaces.
453 Label not_smi; 453 Label not_smi;
454 __ tsti(R0, kSmiTagMask); // Value is Smi? 454 __ tsti(R0, Immediate(kSmiTagMask)); // Value is Smi?
455 __ b(&not_smi, NE); 455 __ b(&not_smi, NE);
456 __ CompareObject(R2, Type::ZoneHandle(Type::IntType()), PP); 456 __ CompareObject(R2, Type::ZoneHandle(Type::IntType()), PP);
457 __ b(is_instance_lbl, EQ); 457 __ b(is_instance_lbl, EQ);
458 __ CompareObject(R2, Type::ZoneHandle(Type::Number()), PP); 458 __ CompareObject(R2, Type::ZoneHandle(Type::Number()), PP);
459 __ b(is_instance_lbl, EQ); 459 __ b(is_instance_lbl, EQ);
460 // Smi must be handled in runtime. 460 // Smi must be handled in runtime.
461 Label fall_through; 461 Label fall_through;
462 __ b(&fall_through); 462 __ b(&fall_through);
463 463
464 __ Bind(&not_smi); 464 __ Bind(&not_smi);
465 // R1: instantiator type arguments. 465 // R1: instantiator type arguments.
466 // R0: instance. 466 // R0: instance.
467 const Register kInstanceReg = R0; 467 const Register kInstanceReg = R0;
468 const Register kTypeArgumentsReg = R1; 468 const Register kTypeArgumentsReg = R1;
469 const Register kTempReg = kNoRegister; 469 const Register kTempReg = kNoRegister;
470 const SubtypeTestCache& type_test_cache = 470 const SubtypeTestCache& type_test_cache =
471 SubtypeTestCache::ZoneHandle( 471 SubtypeTestCache::ZoneHandle(
472 GenerateCallSubtypeTestStub(kTestTypeThreeArgs, 472 GenerateCallSubtypeTestStub(kTestTypeThreeArgs,
473 kInstanceReg, 473 kInstanceReg,
474 kTypeArgumentsReg, 474 kTypeArgumentsReg,
475 kTempReg, 475 kTempReg,
476 is_instance_lbl, 476 is_instance_lbl,
477 is_not_instance_lbl)); 477 is_not_instance_lbl));
478 __ Bind(&fall_through); 478 __ Bind(&fall_through);
479 return type_test_cache.raw(); 479 return type_test_cache.raw();
480 } 480 }
481 if (type.IsType()) { 481 if (type.IsType()) {
482 const Register kInstanceReg = R0; 482 const Register kInstanceReg = R0;
483 const Register kTypeArgumentsReg = R1; 483 const Register kTypeArgumentsReg = R1;
484 __ tsti(kInstanceReg, kSmiTagMask); // Is instance Smi? 484 __ tsti(kInstanceReg, Immediate(kSmiTagMask)); // Is instance Smi?
485 __ b(is_not_instance_lbl, EQ); 485 __ b(is_not_instance_lbl, EQ);
486 __ ldr(kTypeArgumentsReg, Address(SP)); // Instantiator type args. 486 __ ldr(kTypeArgumentsReg, Address(SP)); // Instantiator type args.
487 // Uninstantiated type class is known at compile time, but the type 487 // Uninstantiated type class is known at compile time, but the type
488 // arguments are determined at runtime by the instantiator. 488 // arguments are determined at runtime by the instantiator.
489 const Register kTempReg = kNoRegister; 489 const Register kTempReg = kNoRegister;
490 return GenerateCallSubtypeTestStub(kTestTypeThreeArgs, 490 return GenerateCallSubtypeTestStub(kTestTypeThreeArgs,
491 kInstanceReg, 491 kInstanceReg,
492 kTypeArgumentsReg, 492 kTypeArgumentsReg,
493 kTempReg, 493 kTempReg,
494 is_instance_lbl, 494 is_instance_lbl,
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1767 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1768 __ PopDouble(reg); 1768 __ PopDouble(reg);
1769 } 1769 }
1770 1770
1771 1771
1772 #undef __ 1772 #undef __
1773 1773
1774 } // namespace dart 1774 } // namespace dart
1775 1775
1776 #endif // defined TARGET_ARCH_ARM64 1776 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698