| OLD | NEW |
| 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 | 1840 |
| 1841 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 1841 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
| 1842 FlowGraphCompiler* compiler) { | 1842 FlowGraphCompiler* compiler) { |
| 1843 Register instantiator_reg = locs()->in(0).reg(); | 1843 Register instantiator_reg = locs()->in(0).reg(); |
| 1844 Register result_reg = locs()->out().reg(); | 1844 Register result_reg = locs()->out().reg(); |
| 1845 | 1845 |
| 1846 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 1846 // 'instantiator_reg' is the instantiator AbstractTypeArguments object |
| 1847 // (or null). | 1847 // (or null). |
| 1848 if (!type_arguments().IsUninstantiatedIdentity()) { | 1848 if (!type_arguments().IsUninstantiatedIdentity() && |
| 1849 !type_arguments().CanShareInstantiatorTypeArguments( |
| 1850 instantiator_class())) { |
| 1849 // If the instantiator is null and if the type argument vector | 1851 // If the instantiator is null and if the type argument vector |
| 1850 // instantiated from null becomes a vector of dynamic, then use null as | 1852 // instantiated from null becomes a vector of dynamic, then use null as |
| 1851 // the type arguments. | 1853 // the type arguments. |
| 1852 Label type_arguments_instantiated; | 1854 Label type_arguments_instantiated; |
| 1853 const intptr_t len = type_arguments().Length(); | 1855 const intptr_t len = type_arguments().Length(); |
| 1854 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1856 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 1855 const Immediate& raw_null = | 1857 const Immediate& raw_null = |
| 1856 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1858 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1857 __ cmpq(instantiator_reg, raw_null); | 1859 __ cmpq(instantiator_reg, raw_null); |
| 1858 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 1860 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1888 | 1890 |
| 1889 | 1891 |
| 1890 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( | 1892 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( |
| 1891 FlowGraphCompiler* compiler) { | 1893 FlowGraphCompiler* compiler) { |
| 1892 Register instantiator_reg = locs()->in(0).reg(); | 1894 Register instantiator_reg = locs()->in(0).reg(); |
| 1893 Register result_reg = locs()->out().reg(); | 1895 Register result_reg = locs()->out().reg(); |
| 1894 ASSERT(instantiator_reg == result_reg); | 1896 ASSERT(instantiator_reg == result_reg); |
| 1895 | 1897 |
| 1896 // instantiator_reg is the instantiator type argument vector, i.e. an | 1898 // instantiator_reg is the instantiator type argument vector, i.e. an |
| 1897 // AbstractTypeArguments object (or null). | 1899 // AbstractTypeArguments object (or null). |
| 1898 if (!type_arguments().IsUninstantiatedIdentity()) { | 1900 if (!type_arguments().IsUninstantiatedIdentity() && |
| 1901 !type_arguments().CanShareInstantiatorTypeArguments( |
| 1902 instantiator_class())) { |
| 1899 // If the instantiator is null and if the type argument vector | 1903 // If the instantiator is null and if the type argument vector |
| 1900 // instantiated from null becomes a vector of dynamic, then use null as | 1904 // instantiated from null becomes a vector of dynamic, then use null as |
| 1901 // the type arguments. | 1905 // the type arguments. |
| 1902 Label type_arguments_instantiated; | 1906 Label type_arguments_instantiated; |
| 1903 const intptr_t len = type_arguments().Length(); | 1907 const intptr_t len = type_arguments().Length(); |
| 1904 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1908 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 1905 const Immediate& raw_null = | 1909 const Immediate& raw_null = |
| 1906 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1910 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1907 __ cmpq(instantiator_reg, raw_null); | 1911 __ cmpq(instantiator_reg, raw_null); |
| 1908 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 1912 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1931 } | 1935 } |
| 1932 | 1936 |
| 1933 | 1937 |
| 1934 void ExtractConstructorInstantiatorInstr::EmitNativeCode( | 1938 void ExtractConstructorInstantiatorInstr::EmitNativeCode( |
| 1935 FlowGraphCompiler* compiler) { | 1939 FlowGraphCompiler* compiler) { |
| 1936 Register instantiator_reg = locs()->in(0).reg(); | 1940 Register instantiator_reg = locs()->in(0).reg(); |
| 1937 ASSERT(locs()->out().reg() == instantiator_reg); | 1941 ASSERT(locs()->out().reg() == instantiator_reg); |
| 1938 | 1942 |
| 1939 // instantiator_reg is the instantiator AbstractTypeArguments object | 1943 // instantiator_reg is the instantiator AbstractTypeArguments object |
| 1940 // (or null). | 1944 // (or null). |
| 1941 if (type_arguments().IsUninstantiatedIdentity()) { | 1945 if (type_arguments().IsUninstantiatedIdentity() || |
| 1946 type_arguments().CanShareInstantiatorTypeArguments( |
| 1947 instantiator_class())) { |
| 1942 // The instantiator was used in VisitExtractConstructorTypeArguments as the | 1948 // The instantiator was used in VisitExtractConstructorTypeArguments as the |
| 1943 // instantiated type arguments, no proper instantiator needed. | 1949 // instantiated type arguments, no proper instantiator needed. |
| 1944 __ movq(instantiator_reg, | 1950 __ movq(instantiator_reg, |
| 1945 Immediate(Smi::RawValue(StubCode::kNoInstantiator))); | 1951 Immediate(Smi::RawValue(StubCode::kNoInstantiator))); |
| 1946 } else { | 1952 } else { |
| 1947 // If the instantiator is null and if the type argument vector | 1953 // If the instantiator is null and if the type argument vector |
| 1948 // instantiated from null becomes a vector of dynamic, then use null as | 1954 // instantiated from null becomes a vector of dynamic, then use null as |
| 1949 // the type arguments and do not pass the instantiator. | 1955 // the type arguments and do not pass the instantiator. |
| 1950 const intptr_t len = type_arguments().Length(); | 1956 const intptr_t len = type_arguments().Length(); |
| 1951 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1957 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| (...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3809 PcDescriptors::kOther, | 3815 PcDescriptors::kOther, |
| 3810 locs()); | 3816 locs()); |
| 3811 __ Drop(2); // Discard type arguments and receiver. | 3817 __ Drop(2); // Discard type arguments and receiver. |
| 3812 } | 3818 } |
| 3813 | 3819 |
| 3814 } // namespace dart | 3820 } // namespace dart |
| 3815 | 3821 |
| 3816 #undef __ | 3822 #undef __ |
| 3817 | 3823 |
| 3818 #endif // defined TARGET_ARCH_X64 | 3824 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |