| OLD | NEW |
| 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 "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 try_index(), | 814 try_index(), |
| 815 kAllocateObjectWithBoundsCheckRuntimeEntry); | 815 kAllocateObjectWithBoundsCheckRuntimeEntry); |
| 816 // Pop instantiator type arguments, type arguments, class, and | 816 // Pop instantiator type arguments, type arguments, class, and |
| 817 // source location. | 817 // source location. |
| 818 __ Drop(4); | 818 __ Drop(4); |
| 819 __ popq(result); // Pop new instance. | 819 __ popq(result); // Pop new instance. |
| 820 } | 820 } |
| 821 | 821 |
| 822 | 822 |
| 823 LocationSummary* LoadVMFieldComp::MakeLocationSummary() const { | 823 LocationSummary* LoadVMFieldComp::MakeLocationSummary() const { |
| 824 return LocationSummary::Make(1, Location::RequiresRegister()); | 824 return LocationSummary::Make(1, Location::SameAsFirstInput()); |
| 825 } | 825 } |
| 826 | 826 |
| 827 | 827 |
| 828 void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 828 void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 829 Register obj = locs()->in(0).reg(); | 829 Register obj = locs()->in(0).reg(); |
| 830 Register result = locs()->out().reg(); | 830 Register result = locs()->out().reg(); |
| 831 | 831 |
| 832 __ movq(result, FieldAddress(obj, offset_in_bytes())); | 832 __ movq(result, FieldAddress(obj, offset_in_bytes())); |
| 833 } | 833 } |
| 834 | 834 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 // Instantiate non-null type arguments. | 878 // Instantiate non-null type arguments. |
| 879 if (type_arguments().IsUninstantiatedIdentity()) { | 879 if (type_arguments().IsUninstantiatedIdentity()) { |
| 880 Label type_arguments_uninstantiated; | 880 Label type_arguments_uninstantiated; |
| 881 // Check if the instantiator type argument vector is a TypeArguments of a | 881 // Check if the instantiator type argument vector is a TypeArguments of a |
| 882 // matching length and, if so, use it as the instantiated type_arguments. | 882 // matching length and, if so, use it as the instantiated type_arguments. |
| 883 // No need to check the instantiator ('instantiator_reg') for null here, | 883 // No need to check the instantiator ('instantiator_reg') for null here, |
| 884 // because a null instantiator will have the wrong class (Null instead of | 884 // because a null instantiator will have the wrong class (Null instead of |
| 885 // TypeArguments). | 885 // TypeArguments). |
| 886 __ CompareClassId(instantiator_reg, kTypeArguments); | 886 __ CompareClassId(instantiator_reg, kTypeArguments); |
| 887 __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump); | 887 __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump); |
| 888 Immediate arguments_length = | |
| 889 Immediate(Smi::RawValue(type_arguments().Length())); | |
| 890 __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()), | 888 __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()), |
| 891 arguments_length); | 889 Immediate(Smi::RawValue(len))); |
| 892 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 890 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
| 893 __ Bind(&type_arguments_uninstantiated); | 891 __ Bind(&type_arguments_uninstantiated); |
| 894 } | 892 } |
| 895 // A runtime call to instantiate the type arguments is required. | 893 // A runtime call to instantiate the type arguments is required. |
| 896 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 894 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 897 __ PushObject(type_arguments()); | 895 __ PushObject(type_arguments()); |
| 898 __ pushq(instantiator_reg); // Push instantiator type arguments. | 896 __ pushq(instantiator_reg); // Push instantiator type arguments. |
| 899 compiler->GenerateCallRuntime(cid(), | 897 compiler->GenerateCallRuntime(cid(), |
| 900 token_index(), | 898 token_index(), |
| 901 try_index(), | 899 try_index(), |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } else { | 1426 } else { |
| 1429 UNREACHABLE(); | 1427 UNREACHABLE(); |
| 1430 } | 1428 } |
| 1431 } | 1429 } |
| 1432 | 1430 |
| 1433 } // namespace dart | 1431 } // namespace dart |
| 1434 | 1432 |
| 1435 #undef __ | 1433 #undef __ |
| 1436 | 1434 |
| 1437 #endif // defined TARGET_ARCH_X64 | 1435 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |