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

Side by Side Diff: runtime/vm/intermediate_language_mips.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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 ASSERT(locs()->in(0).reg() == A0); 1947 ASSERT(locs()->in(0).reg() == A0);
1948 ASSERT(locs()->in(1).reg() == A1); 1948 ASSERT(locs()->in(1).reg() == A1);
1949 compiler->GenerateCall(token_pos(), 1949 compiler->GenerateCall(token_pos(),
1950 &StubCode::AllocateArrayLabel(), 1950 &StubCode::AllocateArrayLabel(),
1951 PcDescriptors::kOther, 1951 PcDescriptors::kOther,
1952 locs()); 1952 locs());
1953 ASSERT(locs()->out().reg() == V0); 1953 ASSERT(locs()->out().reg() == V0);
1954 } 1954 }
1955 1955
1956 1956
1957 LocationSummary*
1958 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const {
1959 return MakeCallSummary();
1960 }
1961
1962
1963 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode(
1964 FlowGraphCompiler* compiler) {
1965 compiler->GenerateRuntimeCall(token_pos(),
1966 deopt_id(),
1967 kAllocateObjectWithBoundsCheckRuntimeEntry,
1968 3,
1969 locs());
1970 __ Drop(3);
1971 ASSERT(locs()->out().reg() == V0);
1972 __ Pop(V0); // Pop new instance.
1973 }
1974
1975
1976 class BoxDoubleSlowPath : public SlowPathCode { 1957 class BoxDoubleSlowPath : public SlowPathCode {
1977 public: 1958 public:
1978 explicit BoxDoubleSlowPath(Instruction* instruction) 1959 explicit BoxDoubleSlowPath(Instruction* instruction)
1979 : instruction_(instruction) { } 1960 : instruction_(instruction) { }
1980 1961
1981 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1962 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1982 __ Comment("BoxDoubleSlowPath"); 1963 __ Comment("BoxDoubleSlowPath");
1983 __ Bind(entry_label()); 1964 __ Bind(entry_label());
1984 const Class& double_class = compiler->double_class(); 1965 const Class& double_class = compiler->double_class();
1985 const Code& stub = 1966 const Code& stub =
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 locs->set_out(Location::RegisterLocation(T0)); 2092 locs->set_out(Location::RegisterLocation(T0));
2112 return locs; 2093 return locs;
2113 } 2094 }
2114 2095
2115 2096
2116 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2097 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2117 __ TraceSimMsg("InstantiateTypeInstr"); 2098 __ TraceSimMsg("InstantiateTypeInstr");
2118 Register instantiator_reg = locs()->in(0).reg(); 2099 Register instantiator_reg = locs()->in(0).reg();
2119 Register result_reg = locs()->out().reg(); 2100 Register result_reg = locs()->out().reg();
2120 2101
2121 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2102 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2122 // (or null).
2123 // A runtime call to instantiate the type is required. 2103 // A runtime call to instantiate the type is required.
2124 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 2104 __ addiu(SP, SP, Immediate(-3 * kWordSize));
2125 __ LoadObject(TMP, Object::ZoneHandle()); 2105 __ LoadObject(TMP, Object::ZoneHandle());
2126 __ sw(TMP, Address(SP, 2 * kWordSize)); // Make room for the result. 2106 __ sw(TMP, Address(SP, 2 * kWordSize)); // Make room for the result.
2127 __ LoadObject(TMP, type()); 2107 __ LoadObject(TMP, type());
2128 __ sw(TMP, Address(SP, 1 * kWordSize)); 2108 __ sw(TMP, Address(SP, 1 * kWordSize));
2129 // Push instantiator type arguments. 2109 // Push instantiator type arguments.
2130 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); 2110 __ sw(instantiator_reg, Address(SP, 0 * kWordSize));
2131 2111
2132 compiler->GenerateRuntimeCall(token_pos(), 2112 compiler->GenerateRuntimeCall(token_pos(),
(...skipping 20 matching lines...) Expand all
2153 return locs; 2133 return locs;
2154 } 2134 }
2155 2135
2156 2136
2157 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2137 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2158 FlowGraphCompiler* compiler) { 2138 FlowGraphCompiler* compiler) {
2159 __ TraceSimMsg("InstantiateTypeArgumentsInstr"); 2139 __ TraceSimMsg("InstantiateTypeArgumentsInstr");
2160 Register instantiator_reg = locs()->in(0).reg(); 2140 Register instantiator_reg = locs()->in(0).reg();
2161 Register result_reg = locs()->out().reg(); 2141 Register result_reg = locs()->out().reg();
2162 2142
2163 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2143 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2164 // (or null).
2165 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2144 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2166 !type_arguments().CanShareInstantiatorTypeArguments( 2145 !type_arguments().CanShareInstantiatorTypeArguments(
2167 instantiator_class())); 2146 instantiator_class()));
2168 // If the instantiator is null and if the type argument vector 2147 // If the instantiator is null and if the type argument vector
2169 // instantiated from null becomes a vector of dynamic, then use null as 2148 // instantiated from null becomes a vector of dynamic, then use null as
2170 // the type arguments. 2149 // the type arguments.
2171 Label type_arguments_instantiated; 2150 Label type_arguments_instantiated;
2172 const intptr_t len = type_arguments().Length(); 2151 const intptr_t len = type_arguments().Length();
2173 if (type_arguments().IsRawInstantiatedRaw(len)) { 2152 if (type_arguments().IsRawInstantiatedRaw(len)) {
2174 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()), 2153 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 return locs; 2188 return locs;
2210 } 2189 }
2211 2190
2212 2191
2213 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( 2192 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode(
2214 FlowGraphCompiler* compiler) { 2193 FlowGraphCompiler* compiler) {
2215 Register instantiator_reg = locs()->in(0).reg(); 2194 Register instantiator_reg = locs()->in(0).reg();
2216 Register result_reg = locs()->out().reg(); 2195 Register result_reg = locs()->out().reg();
2217 ASSERT(instantiator_reg == result_reg); 2196 ASSERT(instantiator_reg == result_reg);
2218 2197
2219 // instantiator_reg is the instantiator type argument vector, i.e. an 2198 // instantiator_reg is the instantiator type argument vector,
2220 // AbstractTypeArguments object (or null). 2199 // i.e. a TypeArguments object (or null).
2221 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2200 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2222 !type_arguments().CanShareInstantiatorTypeArguments( 2201 !type_arguments().CanShareInstantiatorTypeArguments(
2223 instantiator_class())); 2202 instantiator_class()));
2224 // If the instantiator is null and if the type argument vector 2203 // If the instantiator is null and if the type argument vector
2225 // instantiated from null becomes a vector of dynamic, then use null as 2204 // instantiated from null becomes a vector of dynamic, then use null as
2226 // the type arguments. 2205 // the type arguments.
2227 Label type_arguments_instantiated; 2206 Label type_arguments_instantiated;
2228 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2207 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2229 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()), 2208 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()),
2230 &type_arguments_instantiated); 2209 &type_arguments_instantiated);
(...skipping 18 matching lines...) Expand all
2249 locs->set_out(Location::SameAsFirstInput()); 2228 locs->set_out(Location::SameAsFirstInput());
2250 return locs; 2229 return locs;
2251 } 2230 }
2252 2231
2253 2232
2254 void ExtractConstructorInstantiatorInstr::EmitNativeCode( 2233 void ExtractConstructorInstantiatorInstr::EmitNativeCode(
2255 FlowGraphCompiler* compiler) { 2234 FlowGraphCompiler* compiler) {
2256 Register instantiator_reg = locs()->in(0).reg(); 2235 Register instantiator_reg = locs()->in(0).reg();
2257 ASSERT(locs()->out().reg() == instantiator_reg); 2236 ASSERT(locs()->out().reg() == instantiator_reg);
2258 2237
2259 // instantiator_reg is the instantiator AbstractTypeArguments object 2238 // instantiator_reg is the instantiator TypeArguments object (or null).
2260 // (or null).
2261 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2239 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2262 !type_arguments().CanShareInstantiatorTypeArguments( 2240 !type_arguments().CanShareInstantiatorTypeArguments(
2263 instantiator_class())); 2241 instantiator_class()));
2264 2242
2265 // If the instantiator is null and if the type argument vector 2243 // If the instantiator is null and if the type argument vector
2266 // instantiated from null becomes a vector of dynamic, then use null as 2244 // instantiated from null becomes a vector of dynamic, then use null as
2267 // the type arguments and do not pass the instantiator. 2245 // the type arguments and do not pass the instantiator.
2268 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2246 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2269 Label instantiator_not_null; 2247 Label instantiator_not_null;
2270 __ BranchNotEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()), 2248 __ BranchNotEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()),
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
4252 compiler->GenerateCall(token_pos(), 4230 compiler->GenerateCall(token_pos(),
4253 &label, 4231 &label,
4254 PcDescriptors::kOther, 4232 PcDescriptors::kOther,
4255 locs()); 4233 locs());
4256 __ Drop(2); // Discard type arguments and receiver. 4234 __ Drop(2); // Discard type arguments and receiver.
4257 } 4235 }
4258 4236
4259 } // namespace dart 4237 } // namespace dart
4260 4238
4261 #endif // defined TARGET_ARCH_MIPS 4239 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698