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

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 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 ASSERT(locs()->in(0).reg() == A0); 1941 ASSERT(locs()->in(0).reg() == A0);
1942 ASSERT(locs()->in(1).reg() == A1); 1942 ASSERT(locs()->in(1).reg() == A1);
1943 compiler->GenerateCall(token_pos(), 1943 compiler->GenerateCall(token_pos(),
1944 &StubCode::AllocateArrayLabel(), 1944 &StubCode::AllocateArrayLabel(),
1945 PcDescriptors::kOther, 1945 PcDescriptors::kOther,
1946 locs()); 1946 locs());
1947 ASSERT(locs()->out().reg() == V0); 1947 ASSERT(locs()->out().reg() == V0);
1948 } 1948 }
1949 1949
1950 1950
1951 LocationSummary*
1952 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const {
1953 return MakeCallSummary();
1954 }
1955
1956
1957 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode(
1958 FlowGraphCompiler* compiler) {
1959 compiler->GenerateRuntimeCall(token_pos(),
1960 deopt_id(),
1961 kAllocateObjectWithBoundsCheckRuntimeEntry,
1962 3,
1963 locs());
1964 __ Drop(3);
1965 ASSERT(locs()->out().reg() == V0);
1966 __ Pop(V0); // Pop new instance.
1967 }
1968
1969
1970 class BoxDoubleSlowPath : public SlowPathCode { 1951 class BoxDoubleSlowPath : public SlowPathCode {
1971 public: 1952 public:
1972 explicit BoxDoubleSlowPath(Instruction* instruction) 1953 explicit BoxDoubleSlowPath(Instruction* instruction)
1973 : instruction_(instruction) { } 1954 : instruction_(instruction) { }
1974 1955
1975 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1956 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1976 __ Comment("BoxDoubleSlowPath"); 1957 __ Comment("BoxDoubleSlowPath");
1977 __ Bind(entry_label()); 1958 __ Bind(entry_label());
1978 const Class& double_class = compiler->double_class(); 1959 const Class& double_class = compiler->double_class();
1979 const Code& stub = 1960 const Code& stub =
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 locs->set_out(Location::RegisterLocation(T0)); 2084 locs->set_out(Location::RegisterLocation(T0));
2104 return locs; 2085 return locs;
2105 } 2086 }
2106 2087
2107 2088
2108 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2089 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2109 __ TraceSimMsg("InstantiateTypeInstr"); 2090 __ TraceSimMsg("InstantiateTypeInstr");
2110 Register instantiator_reg = locs()->in(0).reg(); 2091 Register instantiator_reg = locs()->in(0).reg();
2111 Register result_reg = locs()->out().reg(); 2092 Register result_reg = locs()->out().reg();
2112 2093
2113 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2094 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2114 // (or null).
2115 // A runtime call to instantiate the type is required. 2095 // A runtime call to instantiate the type is required.
2116 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 2096 __ addiu(SP, SP, Immediate(-3 * kWordSize));
2117 __ LoadObject(TMP, Object::ZoneHandle()); 2097 __ LoadObject(TMP, Object::ZoneHandle());
2118 __ sw(TMP, Address(SP, 2 * kWordSize)); // Make room for the result. 2098 __ sw(TMP, Address(SP, 2 * kWordSize)); // Make room for the result.
2119 __ LoadObject(TMP, type()); 2099 __ LoadObject(TMP, type());
2120 __ sw(TMP, Address(SP, 1 * kWordSize)); 2100 __ sw(TMP, Address(SP, 1 * kWordSize));
2121 // Push instantiator type arguments. 2101 // Push instantiator type arguments.
2122 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); 2102 __ sw(instantiator_reg, Address(SP, 0 * kWordSize));
2123 2103
2124 compiler->GenerateRuntimeCall(token_pos(), 2104 compiler->GenerateRuntimeCall(token_pos(),
(...skipping 20 matching lines...) Expand all
2145 return locs; 2125 return locs;
2146 } 2126 }
2147 2127
2148 2128
2149 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2129 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2150 FlowGraphCompiler* compiler) { 2130 FlowGraphCompiler* compiler) {
2151 __ TraceSimMsg("InstantiateTypeArgumentsInstr"); 2131 __ TraceSimMsg("InstantiateTypeArgumentsInstr");
2152 Register instantiator_reg = locs()->in(0).reg(); 2132 Register instantiator_reg = locs()->in(0).reg();
2153 Register result_reg = locs()->out().reg(); 2133 Register result_reg = locs()->out().reg();
2154 2134
2155 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2135 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2156 // (or null).
2157 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2136 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2158 !type_arguments().CanShareInstantiatorTypeArguments( 2137 !type_arguments().CanShareInstantiatorTypeArguments(
2159 instantiator_class())); 2138 instantiator_class()));
2160 // If the instantiator is null and if the type argument vector 2139 // If the instantiator is null and if the type argument vector
2161 // instantiated from null becomes a vector of dynamic, then use null as 2140 // instantiated from null becomes a vector of dynamic, then use null as
2162 // the type arguments. 2141 // the type arguments.
2163 Label type_arguments_instantiated; 2142 Label type_arguments_instantiated;
2164 const intptr_t len = type_arguments().Length(); 2143 const intptr_t len = type_arguments().Length();
2165 if (type_arguments().IsRawInstantiatedRaw(len)) { 2144 if (type_arguments().IsRawInstantiatedRaw(len)) {
2166 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()), 2145 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 return locs; 2180 return locs;
2202 } 2181 }
2203 2182
2204 2183
2205 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( 2184 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode(
2206 FlowGraphCompiler* compiler) { 2185 FlowGraphCompiler* compiler) {
2207 Register instantiator_reg = locs()->in(0).reg(); 2186 Register instantiator_reg = locs()->in(0).reg();
2208 Register result_reg = locs()->out().reg(); 2187 Register result_reg = locs()->out().reg();
2209 ASSERT(instantiator_reg == result_reg); 2188 ASSERT(instantiator_reg == result_reg);
2210 2189
2211 // instantiator_reg is the instantiator type argument vector, i.e. an 2190 // instantiator_reg is the instantiator type argument vector,
2212 // AbstractTypeArguments object (or null). 2191 // i.e. a TypeArguments object (or null).
2213 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2192 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2214 !type_arguments().CanShareInstantiatorTypeArguments( 2193 !type_arguments().CanShareInstantiatorTypeArguments(
2215 instantiator_class())); 2194 instantiator_class()));
2216 // If the instantiator is null and if the type argument vector 2195 // If the instantiator is null and if the type argument vector
2217 // instantiated from null becomes a vector of dynamic, then use null as 2196 // instantiated from null becomes a vector of dynamic, then use null as
2218 // the type arguments. 2197 // the type arguments.
2219 Label type_arguments_instantiated; 2198 Label type_arguments_instantiated;
2220 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2199 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2221 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()), 2200 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()),
2222 &type_arguments_instantiated); 2201 &type_arguments_instantiated);
(...skipping 18 matching lines...) Expand all
2241 locs->set_out(Location::SameAsFirstInput()); 2220 locs->set_out(Location::SameAsFirstInput());
2242 return locs; 2221 return locs;
2243 } 2222 }
2244 2223
2245 2224
2246 void ExtractConstructorInstantiatorInstr::EmitNativeCode( 2225 void ExtractConstructorInstantiatorInstr::EmitNativeCode(
2247 FlowGraphCompiler* compiler) { 2226 FlowGraphCompiler* compiler) {
2248 Register instantiator_reg = locs()->in(0).reg(); 2227 Register instantiator_reg = locs()->in(0).reg();
2249 ASSERT(locs()->out().reg() == instantiator_reg); 2228 ASSERT(locs()->out().reg() == instantiator_reg);
2250 2229
2251 // instantiator_reg is the instantiator AbstractTypeArguments object 2230 // instantiator_reg is the instantiator TypeArguments object (or null).
2252 // (or null).
2253 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2231 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2254 !type_arguments().CanShareInstantiatorTypeArguments( 2232 !type_arguments().CanShareInstantiatorTypeArguments(
2255 instantiator_class())); 2233 instantiator_class()));
2256 2234
2257 // If the instantiator is null and if the type argument vector 2235 // If the instantiator is null and if the type argument vector
2258 // 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
2259 // the type arguments and do not pass the instantiator. 2237 // the type arguments and do not pass the instantiator.
2260 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2238 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2261 Label instantiator_not_null; 2239 Label instantiator_not_null;
2262 __ BranchNotEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()), 2240 __ BranchNotEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()),
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
4244 compiler->GenerateCall(token_pos(), 4222 compiler->GenerateCall(token_pos(),
4245 &label, 4223 &label,
4246 PcDescriptors::kOther, 4224 PcDescriptors::kOther,
4247 locs()); 4225 locs());
4248 __ Drop(2); // Discard type arguments and receiver. 4226 __ Drop(2); // Discard type arguments and receiver.
4249 } 4227 }
4250 4228
4251 } // namespace dart 4229 } // namespace dart
4252 4230
4253 #endif // defined TARGET_ARCH_MIPS 4231 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698