| 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_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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" | 
| 9 | 9 | 
| 10 #include "lib/error.h" | 10 #include "lib/error.h" | 
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 903   // The call below has an empty stackmap because we have just | 903   // The call below has an empty stackmap because we have just | 
| 904   // dropped the spill slots. | 904   // dropped the spill slots. | 
| 905   BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 905   BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 
| 906 | 906 | 
| 907   // Invoke noSuchMethod function passing the original name of the function. | 907   // Invoke noSuchMethod function passing the original name of the function. | 
| 908   // If the function is a closure function, use "call" as the original name. | 908   // If the function is a closure function, use "call" as the original name. | 
| 909   const String& name = String::Handle( | 909   const String& name = String::Handle( | 
| 910       function.IsClosureFunction() ? Symbols::Call().raw() : function.name()); | 910       function.IsClosureFunction() ? Symbols::Call().raw() : function.name()); | 
| 911   const int kNumArgsChecked = 1; | 911   const int kNumArgsChecked = 1; | 
| 912   const ICData& ic_data = ICData::ZoneHandle( | 912   const ICData& ic_data = ICData::ZoneHandle( | 
| 913       ICData::New(function, name, Isolate::kNoDeoptId, kNumArgsChecked)); | 913       ICData::New(function, name, Object::null_array(), | 
|  | 914                   Isolate::kNoDeoptId, kNumArgsChecked)); | 
| 914   __ LoadObject(R5, ic_data); | 915   __ LoadObject(R5, ic_data); | 
| 915   // FP - 4 : saved PP, object pool pointer of caller. | 916   // FP - 4 : saved PP, object pool pointer of caller. | 
| 916   // FP + 0 : previous frame pointer. | 917   // FP + 0 : previous frame pointer. | 
| 917   // FP + 4 : return address. | 918   // FP + 4 : return address. | 
| 918   // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 919   // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 
| 919   // FP + 12: last argument (arg n-1). | 920   // FP + 12: last argument (arg n-1). | 
| 920   // SP + 0 : saved PP. | 921   // SP + 0 : saved PP. | 
| 921   // SP + 16 + 4*(n-1) : first argument (arg 0). | 922   // SP + 16 + 4*(n-1) : first argument (arg 0). | 
| 922   // R5 : ic-data. | 923   // R5 : ic-data. | 
| 923   // R4 : arguments descriptor array. | 924   // R4 : arguments descriptor array. | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1088           // that area on the stack. | 1089           // that area on the stack. | 
| 1089           __ AddImmediate(SP, StackSize() * kWordSize); | 1090           __ AddImmediate(SP, StackSize() * kWordSize); | 
| 1090         } | 1091         } | 
| 1091         // The call below has an empty stackmap because we have just | 1092         // The call below has an empty stackmap because we have just | 
| 1092         // dropped the spill slots. | 1093         // dropped the spill slots. | 
| 1093         BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 1094         BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 
| 1094 | 1095 | 
| 1095         // Invoke noSuchMethod function passing "call" as the function name. | 1096         // Invoke noSuchMethod function passing "call" as the function name. | 
| 1096         const int kNumArgsChecked = 1; | 1097         const int kNumArgsChecked = 1; | 
| 1097         const ICData& ic_data = ICData::ZoneHandle( | 1098         const ICData& ic_data = ICData::ZoneHandle( | 
| 1098             ICData::New(function, Symbols::Call(), | 1099             ICData::New(function, Symbols::Call(), Object::null_array(), | 
| 1099                         Isolate::kNoDeoptId, kNumArgsChecked)); | 1100                         Isolate::kNoDeoptId, kNumArgsChecked)); | 
| 1100         __ LoadObject(R5, ic_data); | 1101         __ LoadObject(R5, ic_data); | 
| 1101         // FP - 4 : saved PP, object pool pointer of caller. | 1102         // FP - 4 : saved PP, object pool pointer of caller. | 
| 1102         // FP + 0 : previous frame pointer. | 1103         // FP + 0 : previous frame pointer. | 
| 1103         // FP + 4 : return address. | 1104         // FP + 4 : return address. | 
| 1104         // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 1105         // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 
| 1105         // FP + 12: last argument (arg n-1). | 1106         // FP + 12: last argument (arg n-1). | 
| 1106         // SP + 0 : saved PP. | 1107         // SP + 0 : saved PP. | 
| 1107         // SP + 16 + 4*(n-1) : first argument (arg 0). | 1108         // SP + 16 + 4*(n-1) : first argument (arg 0). | 
| 1108         // R5 : ic-data. | 1109         // R5 : ic-data. | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1231                            deopt_id_after, | 1232                            deopt_id_after, | 
| 1232                            token_pos); | 1233                            token_pos); | 
| 1233     } | 1234     } | 
| 1234   } | 1235   } | 
| 1235 } | 1236 } | 
| 1236 | 1237 | 
| 1237 | 1238 | 
| 1238 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1239 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 
| 1239     ExternalLabel* target_label, | 1240     ExternalLabel* target_label, | 
| 1240     const ICData& ic_data, | 1241     const ICData& ic_data, | 
| 1241     const Array& arguments_descriptor, |  | 
| 1242     intptr_t argument_count, | 1242     intptr_t argument_count, | 
| 1243     intptr_t deopt_id, | 1243     intptr_t deopt_id, | 
| 1244     intptr_t token_pos, | 1244     intptr_t token_pos, | 
| 1245     LocationSummary* locs) { | 1245     LocationSummary* locs) { | 
| 1246   // Each ICData propagated from unoptimized to optimized code contains the | 1246   // Each ICData propagated from unoptimized to optimized code contains the | 
| 1247   // function that corresponds to the Dart function of that IC call. Due | 1247   // function that corresponds to the Dart function of that IC call. Due | 
| 1248   // to inlining in optimized code, that function may not correspond to the | 1248   // to inlining in optimized code, that function may not correspond to the | 
| 1249   // top-level function (parsed_function().function()) which could be | 1249   // top-level function (parsed_function().function()) which could be | 
| 1250   // reoptimized and which counter needs to be incremented. | 1250   // reoptimized and which counter needs to be incremented. | 
| 1251   // Pass the function explicitly, it is used in IC stub. | 1251   // Pass the function explicitly, it is used in IC stub. | 
|  | 1252 | 
| 1252   __ LoadObject(R6, parsed_function().function()); | 1253   __ LoadObject(R6, parsed_function().function()); | 
| 1253   __ LoadObject(R4, arguments_descriptor); |  | 
| 1254   __ LoadObject(R5, ic_data); | 1254   __ LoadObject(R5, ic_data); | 
| 1255   GenerateDartCall(deopt_id, | 1255   GenerateDartCall(deopt_id, | 
| 1256                    token_pos, | 1256                    token_pos, | 
| 1257                    target_label, | 1257                    target_label, | 
| 1258                    PcDescriptors::kIcCall, | 1258                    PcDescriptors::kIcCall, | 
| 1259                    locs); | 1259                    locs); | 
| 1260   __ Drop(argument_count); | 1260   __ Drop(argument_count); | 
| 1261 } | 1261 } | 
| 1262 | 1262 | 
| 1263 | 1263 | 
| 1264 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1264 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 
| 1265                                          const ICData& ic_data, | 1265                                          const ICData& ic_data, | 
| 1266                                          const Array& arguments_descriptor, |  | 
| 1267                                          intptr_t argument_count, | 1266                                          intptr_t argument_count, | 
| 1268                                          intptr_t deopt_id, | 1267                                          intptr_t deopt_id, | 
| 1269                                          intptr_t token_pos, | 1268                                          intptr_t token_pos, | 
| 1270                                          LocationSummary* locs) { | 1269                                          LocationSummary* locs) { | 
| 1271   __ LoadObject(R4, arguments_descriptor); |  | 
| 1272   __ LoadObject(R5, ic_data); | 1270   __ LoadObject(R5, ic_data); | 
| 1273   GenerateDartCall(deopt_id, | 1271   GenerateDartCall(deopt_id, | 
| 1274                    token_pos, | 1272                    token_pos, | 
| 1275                    target_label, | 1273                    target_label, | 
| 1276                    PcDescriptors::kIcCall, | 1274                    PcDescriptors::kIcCall, | 
| 1277                    locs); | 1275                    locs); | 
| 1278   __ Drop(argument_count); | 1276   __ Drop(argument_count); | 
| 1279 } | 1277 } | 
| 1280 | 1278 | 
| 1281 | 1279 | 
| 1282 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1280 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 
| 1283     const ICData& ic_data, | 1281     const ICData& ic_data, | 
| 1284     const Array& arguments_descriptor, |  | 
| 1285     intptr_t argument_count, | 1282     intptr_t argument_count, | 
| 1286     intptr_t deopt_id, | 1283     intptr_t deopt_id, | 
| 1287     intptr_t token_pos, | 1284     intptr_t token_pos, | 
| 1288     LocationSummary* locs) { | 1285     LocationSummary* locs) { | 
| 1289   MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 1286   MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 
| 1290   const String& name = String::Handle(ic_data.target_name()); | 1287   const String& name = String::Handle(ic_data.target_name()); | 
|  | 1288   const Array& arguments_descriptor = | 
|  | 1289       Array::ZoneHandle(ic_data.arguments_descriptor()); | 
|  | 1290   ASSERT(!arguments_descriptor.IsNull()); | 
| 1291   const MegamorphicCache& cache = | 1291   const MegamorphicCache& cache = | 
| 1292       MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); | 1292       MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); | 
| 1293   Label not_smi, load_cache; | 1293   Label not_smi, load_cache; | 
| 1294   __ LoadFromOffset(kLoadWord, R0, SP, (argument_count - 1) * kWordSize); | 1294   __ LoadFromOffset(kLoadWord, R0, SP, (argument_count - 1) * kWordSize); | 
| 1295   __ tst(R0, ShifterOperand(kSmiTagMask)); | 1295   __ tst(R0, ShifterOperand(kSmiTagMask)); | 
| 1296   __ b(¬_smi, NE); | 1296   __ b(¬_smi, NE); | 
| 1297   __ mov(R0, ShifterOperand(Smi::RawValue(kSmiCid))); | 1297   __ mov(R0, ShifterOperand(Smi::RawValue(kSmiCid))); | 
| 1298   __ b(&load_cache); | 1298   __ b(&load_cache); | 
| 1299 | 1299 | 
| 1300   __ Bind(¬_smi); | 1300   __ Bind(¬_smi); | 
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1782 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1782 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 
| 1783   __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); | 1783   __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); | 
| 1784 } | 1784 } | 
| 1785 | 1785 | 
| 1786 | 1786 | 
| 1787 #undef __ | 1787 #undef __ | 
| 1788 | 1788 | 
| 1789 }  // namespace dart | 1789 }  // namespace dart | 
| 1790 | 1790 | 
| 1791 #endif  // defined TARGET_ARCH_ARM | 1791 #endif  // defined TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|