| 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 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 ASSERT(locs()->in(0).reg() == RBX); | 1816 ASSERT(locs()->in(0).reg() == RBX); |
| 1817 ASSERT(locs()->in(1).reg() == R10); | 1817 ASSERT(locs()->in(1).reg() == R10); |
| 1818 compiler->GenerateCall(token_pos(), | 1818 compiler->GenerateCall(token_pos(), |
| 1819 &StubCode::AllocateArrayLabel(), | 1819 &StubCode::AllocateArrayLabel(), |
| 1820 PcDescriptors::kOther, | 1820 PcDescriptors::kOther, |
| 1821 locs()); | 1821 locs()); |
| 1822 ASSERT(locs()->out().reg() == RAX); | 1822 ASSERT(locs()->out().reg() == RAX); |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 | 1825 |
| 1826 LocationSummary* | |
| 1827 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const { | |
| 1828 return MakeCallSummary(); | |
| 1829 } | |
| 1830 | |
| 1831 | |
| 1832 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( | |
| 1833 FlowGraphCompiler* compiler) { | |
| 1834 compiler->GenerateRuntimeCall(token_pos(), | |
| 1835 deopt_id(), | |
| 1836 kAllocateObjectWithBoundsCheckRuntimeEntry, | |
| 1837 3, | |
| 1838 locs()); | |
| 1839 __ Drop(3); | |
| 1840 ASSERT(locs()->out().reg() == RAX); | |
| 1841 __ popq(RAX); // Pop new instance. | |
| 1842 } | |
| 1843 | |
| 1844 | |
| 1845 class BoxDoubleSlowPath : public SlowPathCode { | 1826 class BoxDoubleSlowPath : public SlowPathCode { |
| 1846 public: | 1827 public: |
| 1847 explicit BoxDoubleSlowPath(Instruction* instruction) | 1828 explicit BoxDoubleSlowPath(Instruction* instruction) |
| 1848 : instruction_(instruction) { } | 1829 : instruction_(instruction) { } |
| 1849 | 1830 |
| 1850 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1831 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1851 __ Comment("BoxDoubleSlowPath"); | 1832 __ Comment("BoxDoubleSlowPath"); |
| 1852 __ Bind(entry_label()); | 1833 __ Bind(entry_label()); |
| 1853 const Class& double_class = compiler->double_class(); | 1834 const Class& double_class = compiler->double_class(); |
| 1854 const Code& stub = | 1835 const Code& stub = |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 locs->set_in(0, Location::RegisterLocation(RAX)); | 2012 locs->set_in(0, Location::RegisterLocation(RAX)); |
| 2032 locs->set_out(Location::RegisterLocation(RAX)); | 2013 locs->set_out(Location::RegisterLocation(RAX)); |
| 2033 return locs; | 2014 return locs; |
| 2034 } | 2015 } |
| 2035 | 2016 |
| 2036 | 2017 |
| 2037 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2018 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2038 Register instantiator_reg = locs()->in(0).reg(); | 2019 Register instantiator_reg = locs()->in(0).reg(); |
| 2039 Register result_reg = locs()->out().reg(); | 2020 Register result_reg = locs()->out().reg(); |
| 2040 | 2021 |
| 2041 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 2022 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
| 2042 // (or null). | |
| 2043 // A runtime call to instantiate the type is required. | 2023 // A runtime call to instantiate the type is required. |
| 2044 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 2024 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 2045 __ PushObject(type(), PP); | 2025 __ PushObject(type(), PP); |
| 2046 __ pushq(instantiator_reg); // Push instantiator type arguments. | 2026 __ pushq(instantiator_reg); // Push instantiator type arguments. |
| 2047 compiler->GenerateRuntimeCall(token_pos(), | 2027 compiler->GenerateRuntimeCall(token_pos(), |
| 2048 deopt_id(), | 2028 deopt_id(), |
| 2049 kInstantiateTypeRuntimeEntry, | 2029 kInstantiateTypeRuntimeEntry, |
| 2050 2, | 2030 2, |
| 2051 locs()); | 2031 locs()); |
| 2052 __ Drop(2); // Drop instantiator and uninstantiated type. | 2032 __ Drop(2); // Drop instantiator and uninstantiated type. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2065 locs->set_out(Location::RegisterLocation(RAX)); | 2045 locs->set_out(Location::RegisterLocation(RAX)); |
| 2066 return locs; | 2046 return locs; |
| 2067 } | 2047 } |
| 2068 | 2048 |
| 2069 | 2049 |
| 2070 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 2050 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
| 2071 FlowGraphCompiler* compiler) { | 2051 FlowGraphCompiler* compiler) { |
| 2072 Register instantiator_reg = locs()->in(0).reg(); | 2052 Register instantiator_reg = locs()->in(0).reg(); |
| 2073 Register result_reg = locs()->out().reg(); | 2053 Register result_reg = locs()->out().reg(); |
| 2074 | 2054 |
| 2075 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 2055 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
| 2076 // (or null). | |
| 2077 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2056 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 2078 !type_arguments().CanShareInstantiatorTypeArguments( | 2057 !type_arguments().CanShareInstantiatorTypeArguments( |
| 2079 instantiator_class())); | 2058 instantiator_class())); |
| 2080 // If the instantiator is null and if the type argument vector | 2059 // If the instantiator is null and if the type argument vector |
| 2081 // instantiated from null becomes a vector of dynamic, then use null as | 2060 // instantiated from null becomes a vector of dynamic, then use null as |
| 2082 // the type arguments. | 2061 // the type arguments. |
| 2083 Label type_arguments_instantiated; | 2062 Label type_arguments_instantiated; |
| 2084 const intptr_t len = type_arguments().Length(); | 2063 const intptr_t len = type_arguments().Length(); |
| 2085 if (type_arguments().IsRawInstantiatedRaw(len)) { | 2064 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 2086 __ CompareObject(instantiator_reg, Object::null_object(), PP); | 2065 __ CompareObject(instantiator_reg, Object::null_object(), PP); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2114 return locs; | 2093 return locs; |
| 2115 } | 2094 } |
| 2116 | 2095 |
| 2117 | 2096 |
| 2118 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( | 2097 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( |
| 2119 FlowGraphCompiler* compiler) { | 2098 FlowGraphCompiler* compiler) { |
| 2120 Register instantiator_reg = locs()->in(0).reg(); | 2099 Register instantiator_reg = locs()->in(0).reg(); |
| 2121 Register result_reg = locs()->out().reg(); | 2100 Register result_reg = locs()->out().reg(); |
| 2122 ASSERT(instantiator_reg == result_reg); | 2101 ASSERT(instantiator_reg == result_reg); |
| 2123 | 2102 |
| 2124 // instantiator_reg is the instantiator type argument vector, i.e. an | 2103 // instantiator_reg is the instantiator type argument vector, |
| 2125 // AbstractTypeArguments object (or null). | 2104 // i.e. a TypeArguments object (or null). |
| 2126 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2105 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 2127 !type_arguments().CanShareInstantiatorTypeArguments( | 2106 !type_arguments().CanShareInstantiatorTypeArguments( |
| 2128 instantiator_class())); | 2107 instantiator_class())); |
| 2129 // If the instantiator is null and if the type argument vector | 2108 // If the instantiator is null and if the type argument vector |
| 2130 // instantiated from null becomes a vector of dynamic, then use null as | 2109 // instantiated from null becomes a vector of dynamic, then use null as |
| 2131 // the type arguments. | 2110 // the type arguments. |
| 2132 Label type_arguments_instantiated; | 2111 Label type_arguments_instantiated; |
| 2133 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2112 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
| 2134 | 2113 |
| 2135 __ CompareObject(instantiator_reg, Object::null_object(), PP); | 2114 __ CompareObject(instantiator_reg, Object::null_object(), PP); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2155 locs->set_out(Location::SameAsFirstInput()); | 2134 locs->set_out(Location::SameAsFirstInput()); |
| 2156 return locs; | 2135 return locs; |
| 2157 } | 2136 } |
| 2158 | 2137 |
| 2159 | 2138 |
| 2160 void ExtractConstructorInstantiatorInstr::EmitNativeCode( | 2139 void ExtractConstructorInstantiatorInstr::EmitNativeCode( |
| 2161 FlowGraphCompiler* compiler) { | 2140 FlowGraphCompiler* compiler) { |
| 2162 Register instantiator_reg = locs()->in(0).reg(); | 2141 Register instantiator_reg = locs()->in(0).reg(); |
| 2163 ASSERT(locs()->out().reg() == instantiator_reg); | 2142 ASSERT(locs()->out().reg() == instantiator_reg); |
| 2164 | 2143 |
| 2165 // instantiator_reg is the instantiator AbstractTypeArguments object | 2144 // instantiator_reg is the instantiator TypeArguments object (or null). |
| 2166 // (or null). | |
| 2167 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2145 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 2168 !type_arguments().CanShareInstantiatorTypeArguments( | 2146 !type_arguments().CanShareInstantiatorTypeArguments( |
| 2169 instantiator_class())); | 2147 instantiator_class())); |
| 2170 | 2148 |
| 2171 // If the instantiator is null and if the type argument vector | 2149 // If the instantiator is null and if the type argument vector |
| 2172 // instantiated from null becomes a vector of dynamic, then use null as | 2150 // instantiated from null becomes a vector of dynamic, then use null as |
| 2173 // the type arguments and do not pass the instantiator. | 2151 // the type arguments and do not pass the instantiator. |
| 2174 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2152 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
| 2175 | 2153 |
| 2176 Label instantiator_not_null; | 2154 Label instantiator_not_null; |
| (...skipping 2891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5068 PcDescriptors::kOther, | 5046 PcDescriptors::kOther, |
| 5069 locs()); | 5047 locs()); |
| 5070 __ Drop(2); // Discard type arguments and receiver. | 5048 __ Drop(2); // Discard type arguments and receiver. |
| 5071 } | 5049 } |
| 5072 | 5050 |
| 5073 } // namespace dart | 5051 } // namespace dart |
| 5074 | 5052 |
| 5075 #undef __ | 5053 #undef __ |
| 5076 | 5054 |
| 5077 #endif // defined TARGET_ARCH_X64 | 5055 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |