| 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_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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 | 1220 |
| 1221 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1221 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1222 ExternalLabel* target_label, | 1222 ExternalLabel* target_label, |
| 1223 const ICData& ic_data, | 1223 const ICData& ic_data, |
| 1224 intptr_t argument_count, | 1224 intptr_t argument_count, |
| 1225 intptr_t deopt_id, | 1225 intptr_t deopt_id, |
| 1226 intptr_t token_pos, | 1226 intptr_t token_pos, |
| 1227 LocationSummary* locs) { | 1227 LocationSummary* locs) { |
| 1228 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1228 // Each ICData propagated from unoptimized to optimized code contains the | 1229 // Each ICData propagated from unoptimized to optimized code contains the |
| 1229 // function that corresponds to the Dart function of that IC call. Due | 1230 // function that corresponds to the Dart function of that IC call. Due |
| 1230 // to inlining in optimized code, that function may not correspond to the | 1231 // to inlining in optimized code, that function may not correspond to the |
| 1231 // top-level function (parsed_function().function()) which could be | 1232 // top-level function (parsed_function().function()) which could be |
| 1232 // reoptimized and which counter needs to be incremented. | 1233 // reoptimized and which counter needs to be incremented. |
| 1233 // Pass the function explicitly, it is used in IC stub. | 1234 // Pass the function explicitly, it is used in IC stub. |
| 1234 __ TraceSimMsg("OptimizedInstanceCall"); | 1235 __ TraceSimMsg("OptimizedInstanceCall"); |
| 1235 __ LoadObject(T0, parsed_function().function()); | 1236 __ LoadObject(T0, parsed_function().function()); |
| 1236 __ LoadObject(S5, ic_data); | 1237 __ LoadObject(S5, ic_data); |
| 1237 GenerateDartCall(deopt_id, | 1238 GenerateDartCall(deopt_id, |
| 1238 token_pos, | 1239 token_pos, |
| 1239 target_label, | 1240 target_label, |
| 1240 PcDescriptors::kIcCall, | 1241 PcDescriptors::kIcCall, |
| 1241 locs); | 1242 locs); |
| 1242 __ Drop(argument_count); | 1243 __ Drop(argument_count); |
| 1243 } | 1244 } |
| 1244 | 1245 |
| 1245 | 1246 |
| 1246 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1247 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1247 const ICData& ic_data, | 1248 const ICData& ic_data, |
| 1248 intptr_t argument_count, | 1249 intptr_t argument_count, |
| 1249 intptr_t deopt_id, | 1250 intptr_t deopt_id, |
| 1250 intptr_t token_pos, | 1251 intptr_t token_pos, |
| 1251 LocationSummary* locs) { | 1252 LocationSummary* locs) { |
| 1253 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1252 __ TraceSimMsg("InstanceCall"); | 1254 __ TraceSimMsg("InstanceCall"); |
| 1253 __ LoadObject(S5, ic_data); | 1255 __ LoadObject(S5, ic_data); |
| 1254 GenerateDartCall(deopt_id, | 1256 GenerateDartCall(deopt_id, |
| 1255 token_pos, | 1257 token_pos, |
| 1256 target_label, | 1258 target_label, |
| 1257 PcDescriptors::kIcCall, | 1259 PcDescriptors::kIcCall, |
| 1258 locs); | 1260 locs); |
| 1259 __ TraceSimMsg("InstanceCall return"); | 1261 __ TraceSimMsg("InstanceCall return"); |
| 1260 __ Drop(argument_count); | 1262 __ Drop(argument_count); |
| 1261 } | 1263 } |
| 1262 | 1264 |
| 1263 | 1265 |
| 1264 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1266 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| 1265 const ICData& ic_data, | 1267 const ICData& ic_data, |
| 1266 intptr_t argument_count, | 1268 intptr_t argument_count, |
| 1267 intptr_t deopt_id, | 1269 intptr_t deopt_id, |
| 1268 intptr_t token_pos, | 1270 intptr_t token_pos, |
| 1269 LocationSummary* locs) { | 1271 LocationSummary* locs) { |
| 1270 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 1272 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); |
| 1271 const String& name = String::Handle(ic_data.target_name()); | 1273 const String& name = String::Handle(ic_data.target_name()); |
| 1272 const Array& arguments_descriptor = | 1274 const Array& arguments_descriptor = |
| 1273 Array::ZoneHandle(ic_data.arguments_descriptor()); | 1275 Array::ZoneHandle(ic_data.arguments_descriptor()); |
| 1274 ASSERT(!arguments_descriptor.IsNull()); | 1276 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
| 1275 const MegamorphicCache& cache = | 1277 const MegamorphicCache& cache = |
| 1276 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); | 1278 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); |
| 1277 Label not_smi, load_cache; | 1279 Label not_smi, load_cache; |
| 1278 __ TraceSimMsg("MegamorphicInstanceCall"); | 1280 __ TraceSimMsg("MegamorphicInstanceCall"); |
| 1279 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); | 1281 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); |
| 1280 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); | 1282 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 1281 __ bne(CMPRES1, ZR, ¬_smi); | 1283 __ bne(CMPRES1, ZR, ¬_smi); |
| 1282 __ LoadImmediate(T0, Smi::RawValue(kSmiCid)); | 1284 __ LoadImmediate(T0, Smi::RawValue(kSmiCid)); |
| 1283 __ b(&load_cache); | 1285 __ b(&load_cache); |
| 1284 | 1286 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 __ AddImmediate(SP, kDoubleSize); | 1847 __ AddImmediate(SP, kDoubleSize); |
| 1846 } | 1848 } |
| 1847 | 1849 |
| 1848 | 1850 |
| 1849 #undef __ | 1851 #undef __ |
| 1850 | 1852 |
| 1851 | 1853 |
| 1852 } // namespace dart | 1854 } // namespace dart |
| 1853 | 1855 |
| 1854 #endif // defined TARGET_ARCH_MIPS | 1856 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |