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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 ASSERT(locs()->in(0).reg() == ECX); | 1880 ASSERT(locs()->in(0).reg() == ECX); |
1881 ASSERT(locs()->in(1).reg() == EDX); | 1881 ASSERT(locs()->in(1).reg() == EDX); |
1882 compiler->GenerateCall(token_pos(), | 1882 compiler->GenerateCall(token_pos(), |
1883 &StubCode::AllocateArrayLabel(), | 1883 &StubCode::AllocateArrayLabel(), |
1884 PcDescriptors::kOther, | 1884 PcDescriptors::kOther, |
1885 locs()); | 1885 locs()); |
1886 ASSERT(locs()->out().reg() == EAX); | 1886 ASSERT(locs()->out().reg() == EAX); |
1887 } | 1887 } |
1888 | 1888 |
1889 | 1889 |
1890 LocationSummary* | |
1891 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const { | |
1892 return MakeCallSummary(); | |
1893 } | |
1894 | |
1895 | |
1896 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( | |
1897 FlowGraphCompiler* compiler) { | |
1898 compiler->GenerateRuntimeCall(token_pos(), | |
1899 deopt_id(), | |
1900 kAllocateObjectWithBoundsCheckRuntimeEntry, | |
1901 3, | |
1902 locs()); | |
1903 __ Drop(3); | |
1904 ASSERT(locs()->out().reg() == EAX); | |
1905 __ popl(EAX); // Pop new instance. | |
1906 } | |
1907 | |
1908 | |
1909 class BoxDoubleSlowPath : public SlowPathCode { | 1890 class BoxDoubleSlowPath : public SlowPathCode { |
1910 public: | 1891 public: |
1911 explicit BoxDoubleSlowPath(Instruction* instruction) | 1892 explicit BoxDoubleSlowPath(Instruction* instruction) |
1912 : instruction_(instruction) { } | 1893 : instruction_(instruction) { } |
1913 | 1894 |
1914 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1895 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
1915 __ Comment("BoxDoubleSlowPath"); | 1896 __ Comment("BoxDoubleSlowPath"); |
1916 __ Bind(entry_label()); | 1897 __ Bind(entry_label()); |
1917 const Class& double_class = compiler->double_class(); | 1898 const Class& double_class = compiler->double_class(); |
1918 const Code& stub = | 1899 const Code& stub = |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 locs->set_in(0, Location::RegisterLocation(EAX)); | 2019 locs->set_in(0, Location::RegisterLocation(EAX)); |
2039 locs->set_out(Location::RegisterLocation(EAX)); | 2020 locs->set_out(Location::RegisterLocation(EAX)); |
2040 return locs; | 2021 return locs; |
2041 } | 2022 } |
2042 | 2023 |
2043 | 2024 |
2044 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2025 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2045 Register instantiator_reg = locs()->in(0).reg(); | 2026 Register instantiator_reg = locs()->in(0).reg(); |
2046 Register result_reg = locs()->out().reg(); | 2027 Register result_reg = locs()->out().reg(); |
2047 | 2028 |
2048 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 2029 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
2049 // (or null). | |
2050 // A runtime call to instantiate the type is required. | 2030 // A runtime call to instantiate the type is required. |
2051 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2031 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
2052 __ PushObject(type()); | 2032 __ PushObject(type()); |
2053 __ pushl(instantiator_reg); // Push instantiator type arguments. | 2033 __ pushl(instantiator_reg); // Push instantiator type arguments. |
2054 compiler->GenerateRuntimeCall(token_pos(), | 2034 compiler->GenerateRuntimeCall(token_pos(), |
2055 deopt_id(), | 2035 deopt_id(), |
2056 kInstantiateTypeRuntimeEntry, | 2036 kInstantiateTypeRuntimeEntry, |
2057 2, | 2037 2, |
2058 locs()); | 2038 locs()); |
2059 __ Drop(2); // Drop instantiator and uninstantiated type. | 2039 __ Drop(2); // Drop instantiator and uninstantiated type. |
(...skipping 12 matching lines...) Expand all Loading... |
2072 locs->set_out(Location::RegisterLocation(EAX)); | 2052 locs->set_out(Location::RegisterLocation(EAX)); |
2073 return locs; | 2053 return locs; |
2074 } | 2054 } |
2075 | 2055 |
2076 | 2056 |
2077 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 2057 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
2078 FlowGraphCompiler* compiler) { | 2058 FlowGraphCompiler* compiler) { |
2079 Register instantiator_reg = locs()->in(0).reg(); | 2059 Register instantiator_reg = locs()->in(0).reg(); |
2080 Register result_reg = locs()->out().reg(); | 2060 Register result_reg = locs()->out().reg(); |
2081 | 2061 |
2082 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 2062 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
2083 // (or null). | |
2084 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2063 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
2085 !type_arguments().CanShareInstantiatorTypeArguments( | 2064 !type_arguments().CanShareInstantiatorTypeArguments( |
2086 instantiator_class())); | 2065 instantiator_class())); |
2087 // If the instantiator is null and if the type argument vector | 2066 // If the instantiator is null and if the type argument vector |
2088 // instantiated from null becomes a vector of dynamic, then use null as | 2067 // instantiated from null becomes a vector of dynamic, then use null as |
2089 // the type arguments. | 2068 // the type arguments. |
2090 Label type_arguments_instantiated; | 2069 Label type_arguments_instantiated; |
2091 const intptr_t len = type_arguments().Length(); | 2070 const intptr_t len = type_arguments().Length(); |
2092 if (type_arguments().IsRawInstantiatedRaw(len)) { | 2071 if (type_arguments().IsRawInstantiatedRaw(len)) { |
2093 const Immediate& raw_null = | 2072 const Immediate& raw_null = |
(...skipping 29 matching lines...) Expand all Loading... |
2123 return locs; | 2102 return locs; |
2124 } | 2103 } |
2125 | 2104 |
2126 | 2105 |
2127 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( | 2106 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( |
2128 FlowGraphCompiler* compiler) { | 2107 FlowGraphCompiler* compiler) { |
2129 Register instantiator_reg = locs()->in(0).reg(); | 2108 Register instantiator_reg = locs()->in(0).reg(); |
2130 Register result_reg = locs()->out().reg(); | 2109 Register result_reg = locs()->out().reg(); |
2131 ASSERT(instantiator_reg == result_reg); | 2110 ASSERT(instantiator_reg == result_reg); |
2132 | 2111 |
2133 // instantiator_reg is the instantiator type argument vector, i.e. an | 2112 // instantiator_reg is the instantiator type argument vector, |
2134 // AbstractTypeArguments object (or null). | 2113 // i.e. a TypeArguments object (or null). |
2135 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2114 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
2136 !type_arguments().CanShareInstantiatorTypeArguments( | 2115 !type_arguments().CanShareInstantiatorTypeArguments( |
2137 instantiator_class())); | 2116 instantiator_class())); |
2138 // If the instantiator is null and if the type argument vector | 2117 // If the instantiator is null and if the type argument vector |
2139 // instantiated from null becomes a vector of dynamic, then use null as | 2118 // instantiated from null becomes a vector of dynamic, then use null as |
2140 // the type arguments. | 2119 // the type arguments. |
2141 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2120 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
2142 Label type_arguments_instantiated; | 2121 Label type_arguments_instantiated; |
2143 const Immediate& raw_null = | 2122 const Immediate& raw_null = |
2144 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2123 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 20 matching lines...) Expand all Loading... |
2165 locs->set_out(Location::SameAsFirstInput()); | 2144 locs->set_out(Location::SameAsFirstInput()); |
2166 return locs; | 2145 return locs; |
2167 } | 2146 } |
2168 | 2147 |
2169 | 2148 |
2170 void ExtractConstructorInstantiatorInstr::EmitNativeCode( | 2149 void ExtractConstructorInstantiatorInstr::EmitNativeCode( |
2171 FlowGraphCompiler* compiler) { | 2150 FlowGraphCompiler* compiler) { |
2172 Register instantiator_reg = locs()->in(0).reg(); | 2151 Register instantiator_reg = locs()->in(0).reg(); |
2173 ASSERT(locs()->out().reg() == instantiator_reg); | 2152 ASSERT(locs()->out().reg() == instantiator_reg); |
2174 | 2153 |
2175 // instantiator_reg is the instantiator AbstractTypeArguments object | 2154 // instantiator_reg is the instantiator TypeArguments object (or null). |
2176 // (or null). | |
2177 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2155 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
2178 !type_arguments().CanShareInstantiatorTypeArguments( | 2156 !type_arguments().CanShareInstantiatorTypeArguments( |
2179 instantiator_class())); | 2157 instantiator_class())); |
2180 | 2158 |
2181 // If the instantiator is null and if the type argument vector | 2159 // If the instantiator is null and if the type argument vector |
2182 // instantiated from null becomes a vector of dynamic, then use null as | 2160 // instantiated from null becomes a vector of dynamic, then use null as |
2183 // the type arguments and do not pass the instantiator. | 2161 // the type arguments and do not pass the instantiator. |
2184 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2162 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
2185 const Immediate& raw_null = | 2163 const Immediate& raw_null = |
2186 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2164 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5281 PcDescriptors::kOther, | 5259 PcDescriptors::kOther, |
5282 locs()); | 5260 locs()); |
5283 __ Drop(2); // Discard type arguments and receiver. | 5261 __ Drop(2); // Discard type arguments and receiver. |
5284 } | 5262 } |
5285 | 5263 |
5286 } // namespace dart | 5264 } // namespace dart |
5287 | 5265 |
5288 #undef __ | 5266 #undef __ |
5289 | 5267 |
5290 #endif // defined TARGET_ARCH_IA32 | 5268 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |