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

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

Issue 10458031: In generated code for x64 don't load object's class directly from class_ field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "lib/error.h" 8 #include "lib/error.h"
9 #include "vm/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
10 #include "vm/locations.h" 10 #include "vm/locations.h"
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); 705 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
706 } 706 }
707 // Instantiate non-null type arguments. 707 // Instantiate non-null type arguments.
708 if (type_arguments().IsUninstantiatedIdentity()) { 708 if (type_arguments().IsUninstantiatedIdentity()) {
709 Label type_arguments_uninstantiated; 709 Label type_arguments_uninstantiated;
710 // Check if the instantiator type argument vector is a TypeArguments of a 710 // Check if the instantiator type argument vector is a TypeArguments of a
711 // matching length and, if so, use it as the instantiated type_arguments. 711 // matching length and, if so, use it as the instantiated type_arguments.
712 // No need to check the instantiator ('instantiator_reg') for null here, 712 // No need to check the instantiator ('instantiator_reg') for null here,
713 // because a null instantiator will have the wrong class (Null instead of 713 // because a null instantiator will have the wrong class (Null instead of
714 // TypeArguments). 714 // TypeArguments).
715 __ LoadObject(temp_reg, Class::ZoneHandle(Object::type_arguments_class())); 715 __ CompareClassOfObject(instantiator_reg,
716 __ cmpq(temp_reg, FieldAddress(instantiator_reg, Object::class_offset())); 716 Class::Handle(Object::type_arguments_class()),
717 temp_reg);
717 __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump); 718 __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump);
718 Immediate arguments_length = 719 Immediate arguments_length =
719 Immediate(Smi::RawValue(type_arguments().Length())); 720 Immediate(Smi::RawValue(type_arguments().Length()));
720 __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()), 721 __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()),
721 arguments_length); 722 arguments_length);
722 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); 723 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
723 __ Bind(&type_arguments_uninstantiated); 724 __ Bind(&type_arguments_uninstantiated);
724 } 725 }
725 // A runtime call to instantiate the type arguments is required. 726 // A runtime call to instantiate the type arguments is required.
726 __ PushObject(Object::ZoneHandle()); // Make room for the result. 727 __ PushObject(Object::ZoneHandle()); // Make room for the result.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 // TODO(regis): The following emitted code is duplicated in 795 // TODO(regis): The following emitted code is duplicated in
795 // VisitExtractConstructorTypeArguments above. The reason is that the code 796 // VisitExtractConstructorTypeArguments above. The reason is that the code
796 // is split between two computations, so that each one produces a 797 // is split between two computations, so that each one produces a
797 // single value, rather than producing a pair of values. 798 // single value, rather than producing a pair of values.
798 // If this becomes an issue, we should expose these tests at the IL level. 799 // If this becomes an issue, we should expose these tests at the IL level.
799 800
800 // Check if the instantiator type argument vector is a TypeArguments of a 801 // Check if the instantiator type argument vector is a TypeArguments of a
801 // matching length and, if so, use it as the instantiated type_arguments. 802 // matching length and, if so, use it as the instantiated type_arguments.
802 // No need to check the instantiator (RAX) for null here, because a null 803 // No need to check the instantiator (RAX) for null here, because a null
803 // instantiator will have the wrong class (Null instead of TypeArguments). 804 // instantiator will have the wrong class (Null instead of TypeArguments).
804 __ LoadObject(temp_reg, Class::ZoneHandle(Object::type_arguments_class())); 805 __ CompareClassOfObject(instantiator_reg,
805 __ cmpq(temp_reg, FieldAddress(instantiator_reg, Object::class_offset())); 806 Class::Handle(Object::type_arguments_class()),
807 temp_reg);
806 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 808 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
807 Immediate arguments_length = 809 Immediate arguments_length =
808 Immediate(Smi::RawValue(type_arguments().Length())); 810 Immediate(Smi::RawValue(type_arguments().Length()));
809 __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()), 811 __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()),
810 arguments_length); 812 arguments_length);
811 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 813 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
812 // The instantiator was used in VisitExtractConstructorTypeArguments as the 814 // The instantiator was used in VisitExtractConstructorTypeArguments as the
813 // instantiated type arguments, no proper instantiator needed. 815 // instantiated type arguments, no proper instantiator needed.
814 __ movq(instantiator_reg, 816 __ movq(instantiator_reg,
815 Immediate(Smi::RawValue(StubCode::kNoInstantiator))); 817 Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 if (locs()->out().reg() != RAX) { 967 if (locs()->out().reg() != RAX) {
966 __ movq(locs()->out().reg(), RAX); 968 __ movq(locs()->out().reg(), RAX);
967 } 969 }
968 } 970 }
969 971
970 } // namespace dart 972 } // namespace dart
971 973
972 #undef __ 974 #undef __
973 975
974 #endif // defined TARGET_ARCH_X64 976 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698