Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: runtime/vm/intermediate_language_arm.cc

Issue 154393003: Implement eager instantiation and canonicalization of type arguments at run (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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
1924 ASSERT(locs()->in(kElementTypePos).reg() == R1); 1924 ASSERT(locs()->in(kElementTypePos).reg() == R1);
1925 ASSERT(locs()->in(kLengthPos).reg() == R2); 1925 ASSERT(locs()->in(kLengthPos).reg() == R2);
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() == R0); 1930 ASSERT(locs()->out().reg() == R0);
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() == R0);
1949 __ Pop(R0); // 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 locs->set_in(0, Location::RegisterLocation(R0)); 2138 locs->set_in(0, Location::RegisterLocation(R0));
2158 locs->set_out(Location::RegisterLocation(R0)); 2139 locs->set_out(Location::RegisterLocation(R0));
2159 return locs; 2140 return locs;
2160 } 2141 }
2161 2142
2162 2143
2163 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2144 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2164 Register instantiator_reg = locs()->in(0).reg(); 2145 Register instantiator_reg = locs()->in(0).reg();
2165 Register result_reg = locs()->out().reg(); 2146 Register result_reg = locs()->out().reg();
2166 2147
2167 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2148 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2168 // (or null).
2169 // A runtime call to instantiate the type is required. 2149 // A runtime call to instantiate the type is required.
2170 __ PushObject(Object::ZoneHandle()); // Make room for the result. 2150 __ PushObject(Object::ZoneHandle()); // Make room for the result.
2171 __ PushObject(type()); 2151 __ PushObject(type());
2172 __ Push(instantiator_reg); // Push instantiator type arguments. 2152 __ Push(instantiator_reg); // Push instantiator type arguments.
2173 compiler->GenerateRuntimeCall(token_pos(), 2153 compiler->GenerateRuntimeCall(token_pos(),
2174 deopt_id(), 2154 deopt_id(),
2175 kInstantiateTypeRuntimeEntry, 2155 kInstantiateTypeRuntimeEntry,
2176 2, 2156 2,
2177 locs()); 2157 locs());
2178 __ Drop(2); // Drop instantiator and uninstantiated type. 2158 __ Drop(2); // Drop instantiator and uninstantiated type.
(...skipping 12 matching lines...) Expand all
2191 locs->set_out(Location::RegisterLocation(R0)); 2171 locs->set_out(Location::RegisterLocation(R0));
2192 return locs; 2172 return locs;
2193 } 2173 }
2194 2174
2195 2175
2196 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2176 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2197 FlowGraphCompiler* compiler) { 2177 FlowGraphCompiler* compiler) {
2198 Register instantiator_reg = locs()->in(0).reg(); 2178 Register instantiator_reg = locs()->in(0).reg();
2199 Register result_reg = locs()->out().reg(); 2179 Register result_reg = locs()->out().reg();
2200 2180
2201 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2181 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2202 // (or null).
2203 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2182 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2204 !type_arguments().CanShareInstantiatorTypeArguments( 2183 !type_arguments().CanShareInstantiatorTypeArguments(
2205 instantiator_class())); 2184 instantiator_class()));
2206 // If the instantiator is null and if the type argument vector 2185 // If the instantiator is null and if the type argument vector
2207 // instantiated from null becomes a vector of dynamic, then use null as 2186 // instantiated from null becomes a vector of dynamic, then use null as
2208 // the type arguments. 2187 // the type arguments.
2209 Label type_arguments_instantiated; 2188 Label type_arguments_instantiated;
2210 const intptr_t len = type_arguments().Length(); 2189 const intptr_t len = type_arguments().Length();
2211 if (type_arguments().IsRawInstantiatedRaw(len)) { 2190 if (type_arguments().IsRawInstantiatedRaw(len)) {
2212 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); 2191 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
(...skipping 28 matching lines...) Expand all
2241 return locs; 2220 return locs;
2242 } 2221 }
2243 2222
2244 2223
2245 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( 2224 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode(
2246 FlowGraphCompiler* compiler) { 2225 FlowGraphCompiler* compiler) {
2247 Register instantiator_reg = locs()->in(0).reg(); 2226 Register instantiator_reg = locs()->in(0).reg();
2248 Register result_reg = locs()->out().reg(); 2227 Register result_reg = locs()->out().reg();
2249 ASSERT(instantiator_reg == result_reg); 2228 ASSERT(instantiator_reg == result_reg);
2250 2229
2251 // instantiator_reg is the instantiator type argument vector, i.e. an 2230 // instantiator_reg is the instantiator type argument vector,
2252 // AbstractTypeArguments object (or null). 2231 // i.e. a TypeArguments object (or null).
2253 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2232 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2254 !type_arguments().CanShareInstantiatorTypeArguments( 2233 !type_arguments().CanShareInstantiatorTypeArguments(
2255 instantiator_class())); 2234 instantiator_class()));
2256 // If the instantiator is null and if the type argument vector 2235 // If the instantiator is null and if the type argument vector
2257 // instantiated from null becomes a vector of dynamic, then use null as 2236 // instantiated from null becomes a vector of dynamic, then use null as
2258 // the type arguments. 2237 // the type arguments.
2259 Label type_arguments_instantiated; 2238 Label type_arguments_instantiated;
2260 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2239 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2261 __ CompareImmediate(instantiator_reg, 2240 __ CompareImmediate(instantiator_reg,
2262 reinterpret_cast<intptr_t>(Object::null())); 2241 reinterpret_cast<intptr_t>(Object::null()));
(...skipping 19 matching lines...) Expand all
2282 locs->set_out(Location::SameAsFirstInput()); 2261 locs->set_out(Location::SameAsFirstInput());
2283 return locs; 2262 return locs;
2284 } 2263 }
2285 2264
2286 2265
2287 void ExtractConstructorInstantiatorInstr::EmitNativeCode( 2266 void ExtractConstructorInstantiatorInstr::EmitNativeCode(
2288 FlowGraphCompiler* compiler) { 2267 FlowGraphCompiler* compiler) {
2289 Register instantiator_reg = locs()->in(0).reg(); 2268 Register instantiator_reg = locs()->in(0).reg();
2290 ASSERT(locs()->out().reg() == instantiator_reg); 2269 ASSERT(locs()->out().reg() == instantiator_reg);
2291 2270
2292 // instantiator_reg is the instantiator AbstractTypeArguments object 2271 // instantiator_reg is the instantiator TypeArguments object (or null).
2293 // (or null).
2294 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2272 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2295 !type_arguments().CanShareInstantiatorTypeArguments( 2273 !type_arguments().CanShareInstantiatorTypeArguments(
2296 instantiator_class())); 2274 instantiator_class()));
2297 2275
2298 // If the instantiator is null and if the type argument vector 2276 // If the instantiator is null and if the type argument vector
2299 // instantiated from null becomes a vector of dynamic, then use null as 2277 // instantiated from null becomes a vector of dynamic, then use null as
2300 // the type arguments and do not pass the instantiator. 2278 // the type arguments and do not pass the instantiator.
2301 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2279 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2302 Label instantiator_not_null; 2280 Label instantiator_not_null;
2303 __ CompareImmediate(instantiator_reg, 2281 __ CompareImmediate(instantiator_reg,
(...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after
4978 compiler->GenerateCall(token_pos(), 4956 compiler->GenerateCall(token_pos(),
4979 &label, 4957 &label,
4980 PcDescriptors::kOther, 4958 PcDescriptors::kOther,
4981 locs()); 4959 locs());
4982 __ Drop(2); // Discard type arguments and receiver. 4960 __ Drop(2); // Discard type arguments and receiver.
4983 } 4961 }
4984 4962
4985 } // namespace dart 4963 } // namespace dart
4986 4964
4987 #endif // defined TARGET_ARCH_ARM 4965 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698