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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_compiler_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // optional function type arguments in RCX. 531 // optional function type arguments in RCX.
532 // Note that this inlined code must be followed by the runtime_call code, as it 532 // Note that this inlined code must be followed by the runtime_call code, as it
533 // may fall through to it. Otherwise, this inline code will jump to the label 533 // may fall through to it. Otherwise, this inline code will jump to the label
534 // is_instance or to the label is_not_instance. 534 // is_instance or to the label is_not_instance.
535 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( 535 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
536 TokenPosition token_pos, 536 TokenPosition token_pos,
537 const AbstractType& type, 537 const AbstractType& type,
538 Label* is_instance_lbl, 538 Label* is_instance_lbl,
539 Label* is_not_instance_lbl) { 539 Label* is_not_instance_lbl) {
540 __ Comment("InlineInstanceof"); 540 __ Comment("InlineInstanceof");
541 if (type.IsVoidType()) {
542 // A non-null value is returned from a void function, which will result in a
543 // type error. A null value is handled prior to executing this inline code.
544 return SubtypeTestCache::null();
545 }
546 if (type.IsInstantiated()) { 541 if (type.IsInstantiated()) {
547 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); 542 const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
548 // 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
549 // 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
550 // a parameterized class. 545 // a parameterized class.
551 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { 546 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) {
552 return GenerateInstantiatedTypeWithArgumentsTest( 547 return GenerateInstantiatedTypeWithArgumentsTest(
553 token_pos, type, is_instance_lbl, is_not_instance_lbl); 548 token_pos, type, is_instance_lbl, is_not_instance_lbl);
554 // Fall through to runtime call. 549 // Fall through to runtime call.
555 } 550 }
(...skipping 22 matching lines...) Expand all
578 // - EAX: object. 573 // - EAX: object.
579 // - EDX: instantiator type arguments or raw_null. 574 // - EDX: instantiator type arguments or raw_null.
580 // - ECX: function type arguments or raw_null. 575 // - ECX: function type arguments or raw_null.
581 // Returns: 576 // Returns:
582 // - true or false in EAX. 577 // - true or false in EAX.
583 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, 578 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos,
584 intptr_t deopt_id, 579 intptr_t deopt_id,
585 const AbstractType& type, 580 const AbstractType& type,
586 LocationSummary* locs) { 581 LocationSummary* locs) {
587 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); 582 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
588 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); 583 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType());
589 584
590 __ pushl(EDX); // Store instantiator type arguments. 585 __ pushl(EDX); // Store instantiator type arguments.
591 __ pushl(ECX); // Store function type arguments. 586 __ pushl(ECX); // Store function type arguments.
592 587
593 const Immediate& raw_null = 588 const Immediate& raw_null =
594 Immediate(reinterpret_cast<intptr_t>(Object::null())); 589 Immediate(reinterpret_cast<intptr_t>(Object::null()));
595 Label is_instance, is_not_instance; 590 Label is_instance, is_not_instance;
596 // If type is instantiated and non-parameterized, we can inline code 591 // If type is instantiated and non-parameterized, we can inline code
597 // checking whether the tested instance is a Smi. 592 // checking whether the tested instance is a Smi.
598 if (type.IsInstantiated()) { 593 if (type.IsInstantiated()) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, 654 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos,
660 intptr_t deopt_id, 655 intptr_t deopt_id,
661 const AbstractType& dst_type, 656 const AbstractType& dst_type,
662 const String& dst_name, 657 const String& dst_name,
663 LocationSummary* locs) { 658 LocationSummary* locs) {
664 ASSERT(!token_pos.IsClassifying()); 659 ASSERT(!token_pos.IsClassifying());
665 ASSERT(!dst_type.IsNull()); 660 ASSERT(!dst_type.IsNull());
666 ASSERT(dst_type.IsFinalized()); 661 ASSERT(dst_type.IsFinalized());
667 // Assignable check is skipped in FlowGraphBuilder, not here. 662 // Assignable check is skipped in FlowGraphBuilder, not here.
668 ASSERT(dst_type.IsMalformedOrMalbounded() || 663 ASSERT(dst_type.IsMalformedOrMalbounded() ||
669 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); 664 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
665 !dst_type.IsVoidType()));
670 __ pushl(EDX); // Store instantiator type arguments. 666 __ pushl(EDX); // Store instantiator type arguments.
671 __ pushl(ECX); // Store function type arguments. 667 __ pushl(ECX); // Store function type arguments.
672 // A null object is always assignable and is returned as result. 668 // A null object is always assignable and is returned as result.
673 const Immediate& raw_null = 669 const Immediate& raw_null =
674 Immediate(reinterpret_cast<intptr_t>(Object::null())); 670 Immediate(reinterpret_cast<intptr_t>(Object::null()));
675 Label is_assignable, runtime_call; 671 Label is_assignable, runtime_call;
676 __ cmpl(EAX, raw_null); 672 __ cmpl(EAX, raw_null);
677 __ j(EQUAL, &is_assignable); 673 __ j(EQUAL, &is_assignable);
678 674
679 // Generate throw new TypeError() if the type is malformed or malbounded. 675 // Generate throw new TypeError() if the type is malformed or malbounded.
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 __ movups(reg, Address(ESP, 0)); 1729 __ movups(reg, Address(ESP, 0));
1734 __ addl(ESP, Immediate(kFpuRegisterSize)); 1730 __ addl(ESP, Immediate(kFpuRegisterSize));
1735 } 1731 }
1736 1732
1737 1733
1738 #undef __ 1734 #undef __
1739 1735
1740 } // namespace dart 1736 } // namespace dart
1741 1737
1742 #endif // defined TARGET_ARCH_IA32 1738 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698