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

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

Issue 2718513002: Void is not required to be `null` anymore. (Closed)
Patch Set: Fix more places in the VM. Created 3 years, 9 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
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // - preserved instance in R0 and optional instantiator type arguments in R1. 498 // - preserved instance in R0 and optional instantiator type arguments in R1.
499 // Note that this inlined code must be followed by the runtime_call code, as it 499 // Note that this inlined code must be followed by the runtime_call code, as it
500 // may fall through to it. Otherwise, this inline code will jump to the label 500 // may fall through to it. Otherwise, this inline code will jump to the label
501 // is_instance or to the label is_not_instance. 501 // is_instance or to the label is_not_instance.
502 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( 502 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
503 TokenPosition token_pos, 503 TokenPosition token_pos,
504 const AbstractType& type, 504 const AbstractType& type,
505 Label* is_instance_lbl, 505 Label* is_instance_lbl,
506 Label* is_not_instance_lbl) { 506 Label* is_not_instance_lbl) {
507 __ Comment("InlineInstanceof"); 507 __ Comment("InlineInstanceof");
508 if (type.IsVoidType()) {
509 // A non-null value is returned from a void function, which will result in a
510 // type error. A null value is handled prior to executing this inline code.
511 return SubtypeTestCache::null();
512 }
513 if (type.IsInstantiated()) { 508 if (type.IsInstantiated()) {
514 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); 509 const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
515 // A class equality check is only applicable with a dst type (not a 510 // A class equality check is only applicable with a dst type (not a
516 // function type) of a non-parameterized class or with a raw dst type of 511 // function type) of a non-parameterized class or with a raw dst type of
517 // a parameterized class. 512 // a parameterized class.
518 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { 513 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) {
519 return GenerateInstantiatedTypeWithArgumentsTest( 514 return GenerateInstantiatedTypeWithArgumentsTest(
520 token_pos, type, is_instance_lbl, is_not_instance_lbl); 515 token_pos, type, is_instance_lbl, is_not_instance_lbl);
521 // Fall through to runtime call. 516 // Fall through to runtime call.
522 } 517 }
(...skipping 22 matching lines...) Expand all
545 // - R0: object. 540 // - R0: object.
546 // - R1: instantiator type arguments or raw_null. 541 // - R1: instantiator type arguments or raw_null.
547 // Returns: 542 // Returns:
548 // - true or false in R0. 543 // - true or false in R0.
549 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, 544 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos,
550 intptr_t deopt_id, 545 intptr_t deopt_id,
551 const AbstractType& type, 546 const AbstractType& type,
552 bool negate_result, 547 bool negate_result,
553 LocationSummary* locs) { 548 LocationSummary* locs) {
554 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); 549 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded());
555 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); 550 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType());
556 551
557 // Preserve instantiator type arguments (R1). 552 // Preserve instantiator type arguments (R1).
558 __ Push(R1); 553 __ Push(R1);
559 554
560 Label is_instance, is_not_instance; 555 Label is_instance, is_not_instance;
561 // If type is instantiated and non-parameterized, we can inline code 556 // If type is instantiated and non-parameterized, we can inline code
562 // checking whether the tested instance is a Smi. 557 // checking whether the tested instance is a Smi.
563 if (type.IsInstantiated()) { 558 if (type.IsInstantiated()) {
564 // A null object is only an instance of Null, Object, and dynamic. 559 // A null object is only an instance of Null, Object, and dynamic.
565 // Object and dynamic have already been checked above (if the type is 560 // Object and dynamic have already been checked above (if the type is
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, 625 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos,
631 intptr_t deopt_id, 626 intptr_t deopt_id,
632 const AbstractType& dst_type, 627 const AbstractType& dst_type,
633 const String& dst_name, 628 const String& dst_name,
634 LocationSummary* locs) { 629 LocationSummary* locs) {
635 ASSERT(!TokenPosition(token_pos).IsClassifying()); 630 ASSERT(!TokenPosition(token_pos).IsClassifying());
636 ASSERT(!dst_type.IsNull()); 631 ASSERT(!dst_type.IsNull());
637 ASSERT(dst_type.IsFinalized()); 632 ASSERT(dst_type.IsFinalized());
638 // Assignable check is skipped in FlowGraphBuilder, not here. 633 // Assignable check is skipped in FlowGraphBuilder, not here.
639 ASSERT(dst_type.IsMalformedOrMalbounded() || 634 ASSERT(dst_type.IsMalformedOrMalbounded() ||
640 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); 635 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
636 !dst_type.IsVoidType()));
641 // Preserve instantiator type arguments (R1). 637 // Preserve instantiator type arguments (R1).
642 __ Push(R1); 638 __ Push(R1);
643 // A null object is always assignable and is returned as result. 639 // A null object is always assignable and is returned as result.
644 Label is_assignable, runtime_call; 640 Label is_assignable, runtime_call;
645 __ CompareObject(R0, Object::null_object()); 641 __ CompareObject(R0, Object::null_object());
646 __ b(&is_assignable, EQ); 642 __ b(&is_assignable, EQ);
647 643
648 // Generate throw new TypeError() if the type is malformed or malbounded. 644 // Generate throw new TypeError() if the type is malformed or malbounded.
649 if (dst_type.IsMalformedOrMalbounded()) { 645 if (dst_type.IsMalformedOrMalbounded()) {
650 __ PushObject(Object::null_object()); // Make room for the result. 646 __ PushObject(Object::null_object()); // Make room for the result.
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1845 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1850 __ PopDouble(reg); 1846 __ PopDouble(reg);
1851 } 1847 }
1852 1848
1853 1849
1854 #undef __ 1850 #undef __
1855 1851
1856 } // namespace dart 1852 } // namespace dart
1857 1853
1858 #endif // defined TARGET_ARCH_ARM64 1854 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698