| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 // The call below has an empty stackmap because we have just | 929 // The call below has an empty stackmap because we have just |
| 930 // dropped the spill slots. | 930 // dropped the spill slots. |
| 931 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 931 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
| 932 | 932 |
| 933 // Invoke noSuchMethod function passing the original name of the function. | 933 // Invoke noSuchMethod function passing the original name of the function. |
| 934 // If the function is a closure function, use "call" as the original name. | 934 // If the function is a closure function, use "call" as the original name. |
| 935 const String& name = String::Handle( | 935 const String& name = String::Handle( |
| 936 function.IsClosureFunction() ? Symbols::Call().raw() : function.name()); | 936 function.IsClosureFunction() ? Symbols::Call().raw() : function.name()); |
| 937 const int kNumArgsChecked = 1; | 937 const int kNumArgsChecked = 1; |
| 938 const ICData& ic_data = ICData::ZoneHandle( | 938 const ICData& ic_data = ICData::ZoneHandle( |
| 939 ICData::New(function, name, Isolate::kNoDeoptId, kNumArgsChecked)); | 939 ICData::New(function, name, Object::null_array(), |
| 940 Isolate::kNoDeoptId, kNumArgsChecked)); |
| 940 __ LoadObject(S5, ic_data); | 941 __ LoadObject(S5, ic_data); |
| 941 // FP - 4 : saved PP, object pool pointer of caller. | 942 // FP - 4 : saved PP, object pool pointer of caller. |
| 942 // FP + 0 : previous frame pointer. | 943 // FP + 0 : previous frame pointer. |
| 943 // FP + 4 : return address. | 944 // FP + 4 : return address. |
| 944 // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 945 // FP + 8 : PC marker, for easy identification of RawInstruction obj. |
| 945 // FP + 12: last argument (arg n-1). | 946 // FP + 12: last argument (arg n-1). |
| 946 // SP + 0 : saved PP. | 947 // SP + 0 : saved PP. |
| 947 // SP + 16 + 4*(n-1) : first argument (arg 0). | 948 // SP + 16 + 4*(n-1) : first argument (arg 0). |
| 948 // S5 : ic-data. | 949 // S5 : ic-data. |
| 949 // S4 : arguments descriptor array. | 950 // S4 : arguments descriptor array. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 // that area on the stack. | 1139 // that area on the stack. |
| 1139 __ AddImmediate(SP, StackSize() * kWordSize); | 1140 __ AddImmediate(SP, StackSize() * kWordSize); |
| 1140 } | 1141 } |
| 1141 // The call below has an empty stackmap because we have just | 1142 // The call below has an empty stackmap because we have just |
| 1142 // dropped the spill slots. | 1143 // dropped the spill slots. |
| 1143 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 1144 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
| 1144 | 1145 |
| 1145 // Invoke noSuchMethod function passing "call" as the function name. | 1146 // Invoke noSuchMethod function passing "call" as the function name. |
| 1146 const int kNumArgsChecked = 1; | 1147 const int kNumArgsChecked = 1; |
| 1147 const ICData& ic_data = ICData::ZoneHandle( | 1148 const ICData& ic_data = ICData::ZoneHandle( |
| 1148 ICData::New(function, Symbols::Call(), | 1149 ICData::New(function, Symbols::Call(), Object::null_array(), |
| 1149 Isolate::kNoDeoptId, kNumArgsChecked)); | 1150 Isolate::kNoDeoptId, kNumArgsChecked)); |
| 1150 __ LoadObject(S5, ic_data); | 1151 __ LoadObject(S5, ic_data); |
| 1151 // FP - 4 : saved PP, object pool pointer of caller. | 1152 // FP - 4 : saved PP, object pool pointer of caller. |
| 1152 // FP + 0 : previous frame pointer. | 1153 // FP + 0 : previous frame pointer. |
| 1153 // FP + 4 : return address. | 1154 // FP + 4 : return address. |
| 1154 // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 1155 // FP + 8 : PC marker, for easy identification of RawInstruction obj. |
| 1155 // FP + 12: last argument (arg n-1). | 1156 // FP + 12: last argument (arg n-1). |
| 1156 // SP + 0 : saved PP. | 1157 // SP + 0 : saved PP. |
| 1157 // SP + 16 + 4*(n-1) : first argument (arg 0). | 1158 // SP + 16 + 4*(n-1) : first argument (arg 0). |
| 1158 // S5 : ic-data. | 1159 // S5 : ic-data. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 deopt_id_after, | 1284 deopt_id_after, |
| 1284 token_pos); | 1285 token_pos); |
| 1285 } | 1286 } |
| 1286 } | 1287 } |
| 1287 } | 1288 } |
| 1288 | 1289 |
| 1289 | 1290 |
| 1290 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1291 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1291 ExternalLabel* target_label, | 1292 ExternalLabel* target_label, |
| 1292 const ICData& ic_data, | 1293 const ICData& ic_data, |
| 1293 const Array& arguments_descriptor, | |
| 1294 intptr_t argument_count, | 1294 intptr_t argument_count, |
| 1295 intptr_t deopt_id, | 1295 intptr_t deopt_id, |
| 1296 intptr_t token_pos, | 1296 intptr_t token_pos, |
| 1297 LocationSummary* locs) { | 1297 LocationSummary* locs) { |
| 1298 // Each ICData propagated from unoptimized to optimized code contains the | 1298 // Each ICData propagated from unoptimized to optimized code contains the |
| 1299 // function that corresponds to the Dart function of that IC call. Due | 1299 // function that corresponds to the Dart function of that IC call. Due |
| 1300 // to inlining in optimized code, that function may not correspond to the | 1300 // to inlining in optimized code, that function may not correspond to the |
| 1301 // top-level function (parsed_function().function()) which could be | 1301 // top-level function (parsed_function().function()) which could be |
| 1302 // reoptimized and which counter needs to be incremented. | 1302 // reoptimized and which counter needs to be incremented. |
| 1303 // Pass the function explicitly, it is used in IC stub. | 1303 // Pass the function explicitly, it is used in IC stub. |
| 1304 __ TraceSimMsg("OptimizedInstanceCall"); | 1304 __ TraceSimMsg("OptimizedInstanceCall"); |
| 1305 __ LoadObject(T0, parsed_function().function()); | 1305 __ LoadObject(T0, parsed_function().function()); |
| 1306 __ LoadObject(S4, arguments_descriptor); | |
| 1307 __ LoadObject(S5, ic_data); | 1306 __ LoadObject(S5, ic_data); |
| 1308 GenerateDartCall(deopt_id, | 1307 GenerateDartCall(deopt_id, |
| 1309 token_pos, | 1308 token_pos, |
| 1310 target_label, | 1309 target_label, |
| 1311 PcDescriptors::kIcCall, | 1310 PcDescriptors::kIcCall, |
| 1312 locs); | 1311 locs); |
| 1313 __ Drop(argument_count); | 1312 __ Drop(argument_count); |
| 1314 } | 1313 } |
| 1315 | 1314 |
| 1316 | 1315 |
| 1317 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1316 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1318 const ICData& ic_data, | 1317 const ICData& ic_data, |
| 1319 const Array& arguments_descriptor, | |
| 1320 intptr_t argument_count, | 1318 intptr_t argument_count, |
| 1321 intptr_t deopt_id, | 1319 intptr_t deopt_id, |
| 1322 intptr_t token_pos, | 1320 intptr_t token_pos, |
| 1323 LocationSummary* locs) { | 1321 LocationSummary* locs) { |
| 1324 __ TraceSimMsg("InstanceCall"); | 1322 __ TraceSimMsg("InstanceCall"); |
| 1325 __ LoadObject(S4, arguments_descriptor); | |
| 1326 __ LoadObject(S5, ic_data); | 1323 __ LoadObject(S5, ic_data); |
| 1327 GenerateDartCall(deopt_id, | 1324 GenerateDartCall(deopt_id, |
| 1328 token_pos, | 1325 token_pos, |
| 1329 target_label, | 1326 target_label, |
| 1330 PcDescriptors::kIcCall, | 1327 PcDescriptors::kIcCall, |
| 1331 locs); | 1328 locs); |
| 1332 __ TraceSimMsg("InstanceCall return"); | 1329 __ TraceSimMsg("InstanceCall return"); |
| 1333 __ Drop(argument_count); | 1330 __ Drop(argument_count); |
| 1334 } | 1331 } |
| 1335 | 1332 |
| 1336 | 1333 |
| 1337 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1334 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| 1338 const ICData& ic_data, | 1335 const ICData& ic_data, |
| 1339 const Array& arguments_descriptor, | |
| 1340 intptr_t argument_count, | 1336 intptr_t argument_count, |
| 1341 intptr_t deopt_id, | 1337 intptr_t deopt_id, |
| 1342 intptr_t token_pos, | 1338 intptr_t token_pos, |
| 1343 LocationSummary* locs) { | 1339 LocationSummary* locs) { |
| 1344 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 1340 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); |
| 1345 const String& name = String::Handle(ic_data.target_name()); | 1341 const String& name = String::Handle(ic_data.target_name()); |
| 1342 const Array& arguments_descriptor = |
| 1343 Array::ZoneHandle(ic_data.arguments_descriptor()); |
| 1344 ASSERT(!arguments_descriptor.IsNull()); |
| 1346 const MegamorphicCache& cache = | 1345 const MegamorphicCache& cache = |
| 1347 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); | 1346 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); |
| 1348 Label not_smi, load_cache; | 1347 Label not_smi, load_cache; |
| 1349 __ TraceSimMsg("MegamorphicInstanceCall"); | 1348 __ TraceSimMsg("MegamorphicInstanceCall"); |
| 1350 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); | 1349 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); |
| 1351 __ andi(CMPRES, T0, Immediate(kSmiTagMask)); | 1350 __ andi(CMPRES, T0, Immediate(kSmiTagMask)); |
| 1352 __ bne(CMPRES, ZR, ¬_smi); | 1351 __ bne(CMPRES, ZR, ¬_smi); |
| 1353 __ LoadImmediate(T0, Smi::RawValue(kSmiCid)); | 1352 __ LoadImmediate(T0, Smi::RawValue(kSmiCid)); |
| 1354 __ b(&load_cache); | 1353 __ b(&load_cache); |
| 1355 | 1354 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 __ AddImmediate(SP, kDoubleSize); | 1927 __ AddImmediate(SP, kDoubleSize); |
| 1929 } | 1928 } |
| 1930 | 1929 |
| 1931 | 1930 |
| 1932 #undef __ | 1931 #undef __ |
| 1933 | 1932 |
| 1934 | 1933 |
| 1935 } // namespace dart | 1934 } // namespace dart |
| 1936 | 1935 |
| 1937 #endif // defined TARGET_ARCH_MIPS | 1936 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |