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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 ASSERT(locs()->in(0).reg() == RBX); | 1773 ASSERT(locs()->in(0).reg() == RBX); |
1774 ASSERT(locs()->in(1).reg() == R10); | 1774 ASSERT(locs()->in(1).reg() == R10); |
1775 compiler->GenerateCall(token_pos(), | 1775 compiler->GenerateCall(token_pos(), |
1776 &StubCode::AllocateArrayLabel(), | 1776 &StubCode::AllocateArrayLabel(), |
1777 PcDescriptors::kOther, | 1777 PcDescriptors::kOther, |
1778 locs()); | 1778 locs()); |
1779 ASSERT(locs()->out().reg() == RAX); | 1779 ASSERT(locs()->out().reg() == RAX); |
1780 } | 1780 } |
1781 | 1781 |
1782 | 1782 |
1783 LocationSummary* | |
1784 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const { | |
1785 return MakeCallSummary(); | |
1786 } | |
1787 | |
1788 | |
1789 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( | |
1790 FlowGraphCompiler* compiler) { | |
1791 compiler->GenerateRuntimeCall(token_pos(), | |
1792 deopt_id(), | |
1793 kAllocateObjectWithBoundsCheckRuntimeEntry, | |
1794 3, | |
1795 locs()); | |
1796 __ Drop(3); | |
1797 ASSERT(locs()->out().reg() == RAX); | |
1798 __ popq(RAX); // Pop new instance. | |
1799 } | |
1800 | |
1801 | |
1802 class BoxDoubleSlowPath : public SlowPathCode { | 1783 class BoxDoubleSlowPath : public SlowPathCode { |
1803 public: | 1784 public: |
1804 explicit BoxDoubleSlowPath(Instruction* instruction) | 1785 explicit BoxDoubleSlowPath(Instruction* instruction) |
1805 : instruction_(instruction) { } | 1786 : instruction_(instruction) { } |
1806 | 1787 |
1807 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1788 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
1808 __ Comment("BoxDoubleSlowPath"); | 1789 __ Comment("BoxDoubleSlowPath"); |
1809 __ Bind(entry_label()); | 1790 __ Bind(entry_label()); |
1810 const Class& double_class = compiler->double_class(); | 1791 const Class& double_class = compiler->double_class(); |
1811 const Code& stub = | 1792 const Code& stub = |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 locs->set_in(0, Location::RegisterLocation(RAX)); | 1913 locs->set_in(0, Location::RegisterLocation(RAX)); |
1933 locs->set_out(Location::RegisterLocation(RAX)); | 1914 locs->set_out(Location::RegisterLocation(RAX)); |
1934 return locs; | 1915 return locs; |
1935 } | 1916 } |
1936 | 1917 |
1937 | 1918 |
1938 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1919 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1939 Register instantiator_reg = locs()->in(0).reg(); | 1920 Register instantiator_reg = locs()->in(0).reg(); |
1940 Register result_reg = locs()->out().reg(); | 1921 Register result_reg = locs()->out().reg(); |
1941 | 1922 |
1942 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 1923 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
1943 // (or null). | |
1944 // A runtime call to instantiate the type is required. | 1924 // A runtime call to instantiate the type is required. |
1945 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 1925 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
1946 __ PushObject(type(), PP); | 1926 __ PushObject(type(), PP); |
1947 __ pushq(instantiator_reg); // Push instantiator type arguments. | 1927 __ pushq(instantiator_reg); // Push instantiator type arguments. |
1948 compiler->GenerateRuntimeCall(token_pos(), | 1928 compiler->GenerateRuntimeCall(token_pos(), |
1949 deopt_id(), | 1929 deopt_id(), |
1950 kInstantiateTypeRuntimeEntry, | 1930 kInstantiateTypeRuntimeEntry, |
1951 2, | 1931 2, |
1952 locs()); | 1932 locs()); |
1953 __ Drop(2); // Drop instantiator and uninstantiated type. | 1933 __ Drop(2); // Drop instantiator and uninstantiated type. |
(...skipping 12 matching lines...) Expand all Loading... |
1966 locs->set_out(Location::RegisterLocation(RAX)); | 1946 locs->set_out(Location::RegisterLocation(RAX)); |
1967 return locs; | 1947 return locs; |
1968 } | 1948 } |
1969 | 1949 |
1970 | 1950 |
1971 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 1951 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
1972 FlowGraphCompiler* compiler) { | 1952 FlowGraphCompiler* compiler) { |
1973 Register instantiator_reg = locs()->in(0).reg(); | 1953 Register instantiator_reg = locs()->in(0).reg(); |
1974 Register result_reg = locs()->out().reg(); | 1954 Register result_reg = locs()->out().reg(); |
1975 | 1955 |
1976 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 1956 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
1977 // (or null). | |
1978 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 1957 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
1979 !type_arguments().CanShareInstantiatorTypeArguments( | 1958 !type_arguments().CanShareInstantiatorTypeArguments( |
1980 instantiator_class())); | 1959 instantiator_class())); |
1981 // If the instantiator is null and if the type argument vector | 1960 // If the instantiator is null and if the type argument vector |
1982 // instantiated from null becomes a vector of dynamic, then use null as | 1961 // instantiated from null becomes a vector of dynamic, then use null as |
1983 // the type arguments. | 1962 // the type arguments. |
1984 Label type_arguments_instantiated; | 1963 Label type_arguments_instantiated; |
1985 const intptr_t len = type_arguments().Length(); | 1964 const intptr_t len = type_arguments().Length(); |
1986 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1965 if (type_arguments().IsRawInstantiatedRaw(len)) { |
1987 __ CompareObject(instantiator_reg, Object::null_object(), PP); | 1966 __ CompareObject(instantiator_reg, Object::null_object(), PP); |
(...skipping 27 matching lines...) Expand all Loading... |
2015 return locs; | 1994 return locs; |
2016 } | 1995 } |
2017 | 1996 |
2018 | 1997 |
2019 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( | 1998 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( |
2020 FlowGraphCompiler* compiler) { | 1999 FlowGraphCompiler* compiler) { |
2021 Register instantiator_reg = locs()->in(0).reg(); | 2000 Register instantiator_reg = locs()->in(0).reg(); |
2022 Register result_reg = locs()->out().reg(); | 2001 Register result_reg = locs()->out().reg(); |
2023 ASSERT(instantiator_reg == result_reg); | 2002 ASSERT(instantiator_reg == result_reg); |
2024 | 2003 |
2025 // instantiator_reg is the instantiator type argument vector, i.e. an | 2004 // instantiator_reg is the instantiator type argument vector, |
2026 // AbstractTypeArguments object (or null). | 2005 // i.e. a TypeArguments object (or null). |
2027 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2006 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
2028 !type_arguments().CanShareInstantiatorTypeArguments( | 2007 !type_arguments().CanShareInstantiatorTypeArguments( |
2029 instantiator_class())); | 2008 instantiator_class())); |
2030 // If the instantiator is null and if the type argument vector | 2009 // If the instantiator is null and if the type argument vector |
2031 // instantiated from null becomes a vector of dynamic, then use null as | 2010 // instantiated from null becomes a vector of dynamic, then use null as |
2032 // the type arguments. | 2011 // the type arguments. |
2033 Label type_arguments_instantiated; | 2012 Label type_arguments_instantiated; |
2034 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2013 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
2035 | 2014 |
2036 __ CompareObject(instantiator_reg, Object::null_object(), PP); | 2015 __ CompareObject(instantiator_reg, Object::null_object(), PP); |
(...skipping 19 matching lines...) Expand all Loading... |
2056 locs->set_out(Location::SameAsFirstInput()); | 2035 locs->set_out(Location::SameAsFirstInput()); |
2057 return locs; | 2036 return locs; |
2058 } | 2037 } |
2059 | 2038 |
2060 | 2039 |
2061 void ExtractConstructorInstantiatorInstr::EmitNativeCode( | 2040 void ExtractConstructorInstantiatorInstr::EmitNativeCode( |
2062 FlowGraphCompiler* compiler) { | 2041 FlowGraphCompiler* compiler) { |
2063 Register instantiator_reg = locs()->in(0).reg(); | 2042 Register instantiator_reg = locs()->in(0).reg(); |
2064 ASSERT(locs()->out().reg() == instantiator_reg); | 2043 ASSERT(locs()->out().reg() == instantiator_reg); |
2065 | 2044 |
2066 // instantiator_reg is the instantiator AbstractTypeArguments object | 2045 // instantiator_reg is the instantiator TypeArguments object (or null). |
2067 // (or null). | |
2068 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2046 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
2069 !type_arguments().CanShareInstantiatorTypeArguments( | 2047 !type_arguments().CanShareInstantiatorTypeArguments( |
2070 instantiator_class())); | 2048 instantiator_class())); |
2071 | 2049 |
2072 // If the instantiator is null and if the type argument vector | 2050 // If the instantiator is null and if the type argument vector |
2073 // instantiated from null becomes a vector of dynamic, then use null as | 2051 // instantiated from null becomes a vector of dynamic, then use null as |
2074 // the type arguments and do not pass the instantiator. | 2052 // the type arguments and do not pass the instantiator. |
2075 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2053 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
2076 | 2054 |
2077 Label instantiator_not_null; | 2055 Label instantiator_not_null; |
(...skipping 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5001 PcDescriptors::kOther, | 4979 PcDescriptors::kOther, |
5002 locs()); | 4980 locs()); |
5003 __ Drop(2); // Discard type arguments and receiver. | 4981 __ Drop(2); // Discard type arguments and receiver. |
5004 } | 4982 } |
5005 | 4983 |
5006 } // namespace dart | 4984 } // namespace dart |
5007 | 4985 |
5008 #undef __ | 4986 #undef __ |
5009 | 4987 |
5010 #endif // defined TARGET_ARCH_X64 | 4988 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |