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

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

Issue 2718513002: Void is not required to be `null` anymore. (Closed)
Patch Set: Update Kernel code. Created 3 years, 7 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 // optional function type arguments in R1. 525 // optional function type arguments in R1.
526 // Note that this inlined code must be followed by the runtime_call code, as it 526 // Note that this inlined code must be followed by the runtime_call code, as it
527 // may fall through to it. Otherwise, this inline code will jump to the label 527 // may fall through to it. Otherwise, this inline code will jump to the label
528 // is_instance or to the label is_not_instance. 528 // is_instance or to the label is_not_instance.
529 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( 529 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
530 TokenPosition token_pos, 530 TokenPosition token_pos,
531 const AbstractType& type, 531 const AbstractType& type,
532 Label* is_instance_lbl, 532 Label* is_instance_lbl,
533 Label* is_not_instance_lbl) { 533 Label* is_not_instance_lbl) {
534 __ Comment("InlineInstanceof"); 534 __ Comment("InlineInstanceof");
535 if (type.IsVoidType()) {
536 // A non-null value is returned from a void function, which will result in a
537 // type error. A null value is handled prior to executing this inline code.
538 return SubtypeTestCache::null();
539 }
540 if (type.IsInstantiated()) { 535 if (type.IsInstantiated()) {
541 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); 536 const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
542 // A class equality check is only applicable with a dst type (not a 537 // A class equality check is only applicable with a dst type (not a
543 // function type) of a non-parameterized class or with a raw dst type of 538 // function type) of a non-parameterized class or with a raw dst type of
544 // a parameterized class. 539 // a parameterized class.
545 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { 540 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) {
546 return GenerateInstantiatedTypeWithArgumentsTest( 541 return GenerateInstantiatedTypeWithArgumentsTest(
547 token_pos, type, is_instance_lbl, is_not_instance_lbl); 542 token_pos, type, is_instance_lbl, is_not_instance_lbl);
548 // Fall through to runtime call. 543 // Fall through to runtime call.
549 } 544 }
(...skipping 22 matching lines...) Expand all
572 // - R0: object. 567 // - R0: object.
573 // - R2: instantiator type arguments or raw_null. 568 // - R2: instantiator type arguments or raw_null.
574 // - R1: function type arguments or raw_null. 569 // - R1: function type arguments or raw_null.
575 // Returns: 570 // Returns:
576 // - true or false in R0. 571 // - true or false in R0.
577 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, 572 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos,
578 intptr_t deopt_id, 573 intptr_t deopt_id,
579 const AbstractType& type, 574 const AbstractType& type,
580 LocationSummary* locs) { 575 LocationSummary* locs) {
581 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); 576 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded());
582 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); 577 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType());
583 const Register kInstantiatorTypeArgumentsReg = R2; 578 const Register kInstantiatorTypeArgumentsReg = R2;
584 const Register kFunctionTypeArgumentsReg = R1; 579 const Register kFunctionTypeArgumentsReg = R1;
585 __ PushList((1 << kInstantiatorTypeArgumentsReg) | 580 __ PushList((1 << kInstantiatorTypeArgumentsReg) |
586 (1 << kFunctionTypeArgumentsReg)); 581 (1 << kFunctionTypeArgumentsReg));
587 Label is_instance, is_not_instance; 582 Label is_instance, is_not_instance;
588 // If type is instantiated and non-parameterized, we can inline code 583 // If type is instantiated and non-parameterized, we can inline code
589 // checking whether the tested instance is a Smi. 584 // checking whether the tested instance is a Smi.
590 if (type.IsInstantiated()) { 585 if (type.IsInstantiated()) {
591 // A null object is only an instance of Null, Object, and dynamic. 586 // A null object is only an instance of Null, Object, and dynamic.
592 // Object and dynamic have already been checked above (if the type is 587 // Object and dynamic have already been checked above (if the type is
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, 646 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos,
652 intptr_t deopt_id, 647 intptr_t deopt_id,
653 const AbstractType& dst_type, 648 const AbstractType& dst_type,
654 const String& dst_name, 649 const String& dst_name,
655 LocationSummary* locs) { 650 LocationSummary* locs) {
656 ASSERT(!token_pos.IsClassifying()); 651 ASSERT(!token_pos.IsClassifying());
657 ASSERT(!dst_type.IsNull()); 652 ASSERT(!dst_type.IsNull());
658 ASSERT(dst_type.IsFinalized()); 653 ASSERT(dst_type.IsFinalized());
659 // Assignable check is skipped in FlowGraphBuilder, not here. 654 // Assignable check is skipped in FlowGraphBuilder, not here.
660 ASSERT(dst_type.IsMalformedOrMalbounded() || 655 ASSERT(dst_type.IsMalformedOrMalbounded() ||
661 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); 656 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
657 !dst_type.IsVoidType()));
662 const Register kInstantiatorTypeArgumentsReg = R2; 658 const Register kInstantiatorTypeArgumentsReg = R2;
663 const Register kFunctionTypeArgumentsReg = R1; 659 const Register kFunctionTypeArgumentsReg = R1;
664 __ PushList((1 << kInstantiatorTypeArgumentsReg) | 660 __ PushList((1 << kInstantiatorTypeArgumentsReg) |
665 (1 << kFunctionTypeArgumentsReg)); 661 (1 << kFunctionTypeArgumentsReg));
666 // A null object is always assignable and is returned as result. 662 // A null object is always assignable and is returned as result.
667 Label is_assignable, runtime_call; 663 Label is_assignable, runtime_call;
668 __ CompareObject(R0, Object::null_object()); 664 __ CompareObject(R0, Object::null_object());
669 __ b(&is_assignable, EQ); 665 __ b(&is_assignable, EQ);
670 666
671 // Generate throw new TypeError() if the type is malformed or malbounded. 667 // Generate throw new TypeError() if the type is malformed or malbounded.
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 DRegister dreg = EvenDRegisterOf(reg); 1828 DRegister dreg = EvenDRegisterOf(reg);
1833 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1829 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1834 } 1830 }
1835 1831
1836 1832
1837 #undef __ 1833 #undef __
1838 1834
1839 } // namespace dart 1835 } // namespace dart
1840 1836
1841 #endif // defined TARGET_ARCH_ARM 1837 #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