| 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 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 ASSERT(locs()->in(0).reg() == ECX); | 1924 ASSERT(locs()->in(0).reg() == ECX); |
| 1925 ASSERT(locs()->in(1).reg() == EDX); | 1925 ASSERT(locs()->in(1).reg() == EDX); |
| 1926 compiler->GenerateCall(token_pos(), | 1926 compiler->GenerateCall(token_pos(), |
| 1927 &StubCode::AllocateArrayLabel(), | 1927 &StubCode::AllocateArrayLabel(), |
| 1928 PcDescriptors::kOther, | 1928 PcDescriptors::kOther, |
| 1929 locs()); | 1929 locs()); |
| 1930 ASSERT(locs()->out().reg() == EAX); | 1930 ASSERT(locs()->out().reg() == EAX); |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 | 1933 |
| 1934 LocationSummary* | |
| 1935 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const { | |
| 1936 return MakeCallSummary(); | |
| 1937 } | |
| 1938 | |
| 1939 | |
| 1940 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( | |
| 1941 FlowGraphCompiler* compiler) { | |
| 1942 compiler->GenerateRuntimeCall(token_pos(), | |
| 1943 deopt_id(), | |
| 1944 kAllocateObjectWithBoundsCheckRuntimeEntry, | |
| 1945 3, | |
| 1946 locs()); | |
| 1947 __ Drop(3); | |
| 1948 ASSERT(locs()->out().reg() == EAX); | |
| 1949 __ popl(EAX); // Pop new instance. | |
| 1950 } | |
| 1951 | |
| 1952 | |
| 1953 class BoxDoubleSlowPath : public SlowPathCode { | 1934 class BoxDoubleSlowPath : public SlowPathCode { |
| 1954 public: | 1935 public: |
| 1955 explicit BoxDoubleSlowPath(Instruction* instruction) | 1936 explicit BoxDoubleSlowPath(Instruction* instruction) |
| 1956 : instruction_(instruction) { } | 1937 : instruction_(instruction) { } |
| 1957 | 1938 |
| 1958 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1939 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1959 __ Comment("BoxDoubleSlowPath"); | 1940 __ Comment("BoxDoubleSlowPath"); |
| 1960 __ Bind(entry_label()); | 1941 __ Bind(entry_label()); |
| 1961 const Class& double_class = compiler->double_class(); | 1942 const Class& double_class = compiler->double_class(); |
| 1962 const Code& stub = | 1943 const Code& stub = |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 locs->set_in(0, Location::RegisterLocation(EAX)); | 2124 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 2144 locs->set_out(Location::RegisterLocation(EAX)); | 2125 locs->set_out(Location::RegisterLocation(EAX)); |
| 2145 return locs; | 2126 return locs; |
| 2146 } | 2127 } |
| 2147 | 2128 |
| 2148 | 2129 |
| 2149 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2130 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2150 Register instantiator_reg = locs()->in(0).reg(); | 2131 Register instantiator_reg = locs()->in(0).reg(); |
| 2151 Register result_reg = locs()->out().reg(); | 2132 Register result_reg = locs()->out().reg(); |
| 2152 | 2133 |
| 2153 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 2134 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
| 2154 // (or null). | |
| 2155 // A runtime call to instantiate the type is required. | 2135 // A runtime call to instantiate the type is required. |
| 2156 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2136 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 2157 __ PushObject(type()); | 2137 __ PushObject(type()); |
| 2158 __ pushl(instantiator_reg); // Push instantiator type arguments. | 2138 __ pushl(instantiator_reg); // Push instantiator type arguments. |
| 2159 compiler->GenerateRuntimeCall(token_pos(), | 2139 compiler->GenerateRuntimeCall(token_pos(), |
| 2160 deopt_id(), | 2140 deopt_id(), |
| 2161 kInstantiateTypeRuntimeEntry, | 2141 kInstantiateTypeRuntimeEntry, |
| 2162 2, | 2142 2, |
| 2163 locs()); | 2143 locs()); |
| 2164 __ Drop(2); // Drop instantiator and uninstantiated type. | 2144 __ Drop(2); // Drop instantiator and uninstantiated type. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2177 locs->set_out(Location::RegisterLocation(EAX)); | 2157 locs->set_out(Location::RegisterLocation(EAX)); |
| 2178 return locs; | 2158 return locs; |
| 2179 } | 2159 } |
| 2180 | 2160 |
| 2181 | 2161 |
| 2182 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 2162 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
| 2183 FlowGraphCompiler* compiler) { | 2163 FlowGraphCompiler* compiler) { |
| 2184 Register instantiator_reg = locs()->in(0).reg(); | 2164 Register instantiator_reg = locs()->in(0).reg(); |
| 2185 Register result_reg = locs()->out().reg(); | 2165 Register result_reg = locs()->out().reg(); |
| 2186 | 2166 |
| 2187 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 2167 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
| 2188 // (or null). | |
| 2189 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2168 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 2190 !type_arguments().CanShareInstantiatorTypeArguments( | 2169 !type_arguments().CanShareInstantiatorTypeArguments( |
| 2191 instantiator_class())); | 2170 instantiator_class())); |
| 2192 // If the instantiator is null and if the type argument vector | 2171 // If the instantiator is null and if the type argument vector |
| 2193 // instantiated from null becomes a vector of dynamic, then use null as | 2172 // instantiated from null becomes a vector of dynamic, then use null as |
| 2194 // the type arguments. | 2173 // the type arguments. |
| 2195 Label type_arguments_instantiated; | 2174 Label type_arguments_instantiated; |
| 2196 const intptr_t len = type_arguments().Length(); | 2175 const intptr_t len = type_arguments().Length(); |
| 2197 if (type_arguments().IsRawInstantiatedRaw(len)) { | 2176 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 2198 const Immediate& raw_null = | 2177 const Immediate& raw_null = |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2228 return locs; | 2207 return locs; |
| 2229 } | 2208 } |
| 2230 | 2209 |
| 2231 | 2210 |
| 2232 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( | 2211 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( |
| 2233 FlowGraphCompiler* compiler) { | 2212 FlowGraphCompiler* compiler) { |
| 2234 Register instantiator_reg = locs()->in(0).reg(); | 2213 Register instantiator_reg = locs()->in(0).reg(); |
| 2235 Register result_reg = locs()->out().reg(); | 2214 Register result_reg = locs()->out().reg(); |
| 2236 ASSERT(instantiator_reg == result_reg); | 2215 ASSERT(instantiator_reg == result_reg); |
| 2237 | 2216 |
| 2238 // instantiator_reg is the instantiator type argument vector, i.e. an | 2217 // instantiator_reg is the instantiator type argument vector, |
| 2239 // AbstractTypeArguments object (or null). | 2218 // i.e. a TypeArguments object (or null). |
| 2240 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2219 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 2241 !type_arguments().CanShareInstantiatorTypeArguments( | 2220 !type_arguments().CanShareInstantiatorTypeArguments( |
| 2242 instantiator_class())); | 2221 instantiator_class())); |
| 2243 // If the instantiator is null and if the type argument vector | 2222 // If the instantiator is null and if the type argument vector |
| 2244 // instantiated from null becomes a vector of dynamic, then use null as | 2223 // instantiated from null becomes a vector of dynamic, then use null as |
| 2245 // the type arguments. | 2224 // the type arguments. |
| 2246 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2225 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
| 2247 Label type_arguments_instantiated; | 2226 Label type_arguments_instantiated; |
| 2248 const Immediate& raw_null = | 2227 const Immediate& raw_null = |
| 2249 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2228 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2270 locs->set_out(Location::SameAsFirstInput()); | 2249 locs->set_out(Location::SameAsFirstInput()); |
| 2271 return locs; | 2250 return locs; |
| 2272 } | 2251 } |
| 2273 | 2252 |
| 2274 | 2253 |
| 2275 void ExtractConstructorInstantiatorInstr::EmitNativeCode( | 2254 void ExtractConstructorInstantiatorInstr::EmitNativeCode( |
| 2276 FlowGraphCompiler* compiler) { | 2255 FlowGraphCompiler* compiler) { |
| 2277 Register instantiator_reg = locs()->in(0).reg(); | 2256 Register instantiator_reg = locs()->in(0).reg(); |
| 2278 ASSERT(locs()->out().reg() == instantiator_reg); | 2257 ASSERT(locs()->out().reg() == instantiator_reg); |
| 2279 | 2258 |
| 2280 // instantiator_reg is the instantiator AbstractTypeArguments object | 2259 // instantiator_reg is the instantiator TypeArguments object (or null). |
| 2281 // (or null). | |
| 2282 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2260 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 2283 !type_arguments().CanShareInstantiatorTypeArguments( | 2261 !type_arguments().CanShareInstantiatorTypeArguments( |
| 2284 instantiator_class())); | 2262 instantiator_class())); |
| 2285 | 2263 |
| 2286 // If the instantiator is null and if the type argument vector | 2264 // If the instantiator is null and if the type argument vector |
| 2287 // instantiated from null becomes a vector of dynamic, then use null as | 2265 // instantiated from null becomes a vector of dynamic, then use null as |
| 2288 // the type arguments and do not pass the instantiator. | 2266 // the type arguments and do not pass the instantiator. |
| 2289 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); | 2267 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); |
| 2290 const Immediate& raw_null = | 2268 const Immediate& raw_null = |
| 2291 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2269 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 3065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5357 PcDescriptors::kOther, | 5335 PcDescriptors::kOther, |
| 5358 locs()); | 5336 locs()); |
| 5359 __ Drop(2); // Discard type arguments and receiver. | 5337 __ Drop(2); // Discard type arguments and receiver. |
| 5360 } | 5338 } |
| 5361 | 5339 |
| 5362 } // namespace dart | 5340 } // namespace dart |
| 5363 | 5341 |
| 5364 #undef __ | 5342 #undef __ |
| 5365 | 5343 |
| 5366 #endif // defined TARGET_ARCH_IA32 | 5344 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |