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

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

Issue 2865603003: Revert "Void is not required to be `null` anymore." (Closed)
Patch Set: 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_compiler_mips.cc ('k') | runtime/vm/flow_graph_type_propagator.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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // optional function type arguments in RCX. 526 // optional function type arguments in RCX.
527 // Note that this inlined code must be followed by the runtime_call code, as it 527 // Note that this inlined code must be followed by the runtime_call code, as it
528 // may fall through to it. Otherwise, this inline code will jump to the label 528 // may fall through to it. Otherwise, this inline code will jump to the label
529 // is_instance or to the label is_not_instance. 529 // is_instance or to the label is_not_instance.
530 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( 530 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
531 TokenPosition token_pos, 531 TokenPosition token_pos,
532 const AbstractType& type, 532 const AbstractType& type,
533 Label* is_instance_lbl, 533 Label* is_instance_lbl,
534 Label* is_not_instance_lbl) { 534 Label* is_not_instance_lbl) {
535 __ Comment("InlineInstanceof"); 535 __ Comment("InlineInstanceof");
536 if (type.IsVoidType()) {
537 // A non-null value is returned from a void function, which will result in a
538 // type error. A null value is handled prior to executing this inline code.
539 return SubtypeTestCache::null();
540 }
536 if (type.IsInstantiated()) { 541 if (type.IsInstantiated()) {
537 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); 542 const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
538 // A class equality check is only applicable with a dst type (not a 543 // A class equality check is only applicable with a dst type (not a
539 // function type) of a non-parameterized class or with a raw dst type of 544 // function type) of a non-parameterized class or with a raw dst type of
540 // a parameterized class. 545 // a parameterized class.
541 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { 546 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) {
542 return GenerateInstantiatedTypeWithArgumentsTest( 547 return GenerateInstantiatedTypeWithArgumentsTest(
543 token_pos, type, is_instance_lbl, is_not_instance_lbl); 548 token_pos, type, is_instance_lbl, is_not_instance_lbl);
544 // Fall through to runtime call. 549 // Fall through to runtime call.
545 } 550 }
(...skipping 22 matching lines...) Expand all
568 // - RAX: object. 573 // - RAX: object.
569 // - RDX: instantiator type arguments or raw_null. 574 // - RDX: instantiator type arguments or raw_null.
570 // - RCX: function type arguments or raw_null. 575 // - RCX: function type arguments or raw_null.
571 // Returns: 576 // Returns:
572 // - true or false in RAX. 577 // - true or false in RAX.
573 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, 578 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos,
574 intptr_t deopt_id, 579 intptr_t deopt_id,
575 const AbstractType& type, 580 const AbstractType& type,
576 LocationSummary* locs) { 581 LocationSummary* locs) {
577 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); 582 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
578 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType()); 583 ASSERT(!type.IsObjectType() && !type.IsDynamicType());
579 584
580 __ pushq(RDX); // Store instantiator type arguments. 585 __ pushq(RDX); // Store instantiator type arguments.
581 __ pushq(RCX); // Store function type arguments. 586 __ pushq(RCX); // Store function type arguments.
582 587
583 Label is_instance, is_not_instance; 588 Label is_instance, is_not_instance;
584 // If type is instantiated and non-parameterized, we can inline code 589 // If type is instantiated and non-parameterized, we can inline code
585 // checking whether the tested instance is a Smi. 590 // checking whether the tested instance is a Smi.
586 if (type.IsInstantiated()) { 591 if (type.IsInstantiated()) {
587 // A null object is only an instance of Null, Object, void and dynamic. 592 // A null object is only an instance of Null, Object, and dynamic.
588 // Object void and dynamic have already been checked above (if the type is 593 // Object and dynamic have already been checked above (if the type is
589 // instantiated). So we can return false here if the instance is null, 594 // instantiated). So we can return false here if the instance is null,
590 // unless the type is Null (and if the type is instantiated). 595 // unless the type is Null (and if the type is instantiated).
591 // We can only inline this null check if the type is instantiated at compile 596 // We can only inline this null check if the type is instantiated at compile
592 // time, since an uninstantiated type at compile time could be Null, Object, 597 // time, since an uninstantiated type at compile time could be Null, Object,
593 // or dynamic at run time. 598 // or dynamic at run time.
594 __ CompareObject(RAX, Object::null_object()); 599 __ CompareObject(RAX, Object::null_object());
595 __ j(EQUAL, type.IsNullType() ? &is_instance : &is_not_instance); 600 __ j(EQUAL, type.IsNullType() ? &is_instance : &is_not_instance);
596 } 601 }
597 602
598 // Generate inline instanceof test. 603 // Generate inline instanceof test.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, 652 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos,
648 intptr_t deopt_id, 653 intptr_t deopt_id,
649 const AbstractType& dst_type, 654 const AbstractType& dst_type,
650 const String& dst_name, 655 const String& dst_name,
651 LocationSummary* locs) { 656 LocationSummary* locs) {
652 ASSERT(!token_pos.IsClassifying()); 657 ASSERT(!token_pos.IsClassifying());
653 ASSERT(!dst_type.IsNull()); 658 ASSERT(!dst_type.IsNull());
654 ASSERT(dst_type.IsFinalized()); 659 ASSERT(dst_type.IsFinalized());
655 // Assignable check is skipped in FlowGraphBuilder, not here. 660 // Assignable check is skipped in FlowGraphBuilder, not here.
656 ASSERT(dst_type.IsMalformedOrMalbounded() || 661 ASSERT(dst_type.IsMalformedOrMalbounded() ||
657 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() && 662 (!dst_type.IsDynamicType() && !dst_type.IsObjectType()));
658 !dst_type.IsVoidType()));
659 __ pushq(RDX); // Store instantiator type arguments. 663 __ pushq(RDX); // Store instantiator type arguments.
660 __ pushq(RCX); // Store function type arguments. 664 __ pushq(RCX); // Store function type arguments.
661 // A null object is always assignable and is returned as result. 665 // A null object is always assignable and is returned as result.
662 Label is_assignable, runtime_call; 666 Label is_assignable, runtime_call;
663 __ CompareObject(RAX, Object::null_object()); 667 __ CompareObject(RAX, Object::null_object());
664 __ j(EQUAL, &is_assignable); 668 __ j(EQUAL, &is_assignable);
665 669
666 // Generate throw new TypeError() if the type is malformed or malbounded. 670 // Generate throw new TypeError() if the type is malformed or malbounded.
667 if (dst_type.IsMalformedOrMalbounded()) { 671 if (dst_type.IsMalformedOrMalbounded()) {
668 __ PushObject(Object::null_object()); // Make room for the result. 672 __ PushObject(Object::null_object()); // Make room for the result.
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 __ movups(reg, Address(RSP, 0)); 1724 __ movups(reg, Address(RSP, 0));
1721 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); 1725 __ AddImmediate(RSP, Immediate(kFpuRegisterSize));
1722 } 1726 }
1723 1727
1724 1728
1725 #undef __ 1729 #undef __
1726 1730
1727 } // namespace dart 1731 } // namespace dart
1728 1732
1729 #endif // defined TARGET_ARCH_X64 1733 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698