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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 __ LoadObject(R1, Object::empty_context()); | 1072 __ LoadObject(R1, Object::empty_context()); |
1073 __ StoreToOffset(kWord, R1, FP, (slot_base - i) * kWordSize); | 1073 __ StoreToOffset(kWord, R1, FP, (slot_base - i) * kWordSize); |
1074 } | 1074 } |
1075 } else { | 1075 } else { |
1076 ASSERT(num_locals > 1); | 1076 ASSERT(num_locals > 1); |
1077 __ StoreToOffset(kWord, R0, FP, (slot_base - i) * kWordSize); | 1077 __ StoreToOffset(kWord, R0, FP, (slot_base - i) * kWordSize); |
1078 } | 1078 } |
1079 } | 1079 } |
1080 } | 1080 } |
1081 | 1081 |
| 1082 // Check for a passed type argument vector if the function is generic. |
| 1083 if (FLAG_reify_generic_functions && function.IsGeneric()) { |
| 1084 __ Comment("Check passed-in type args"); |
| 1085 Label store_type_args, ok; |
| 1086 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::type_args_len_offset())); |
| 1087 __ CompareImmediate(R0, 0); |
| 1088 if (is_optimizing()) { |
| 1089 // Initialize type_args to null if none passed in. |
| 1090 __ LoadObject(R0, Object::null_object(), EQ); |
| 1091 __ b(&store_type_args, EQ); |
| 1092 } else { |
| 1093 __ b(&ok, EQ); // Already initialized to null. |
| 1094 } |
| 1095 // TODO(regis): Verify that type_args_len is correct. |
| 1096 // Load the passed type args vector in R0 from |
| 1097 // fp[kParamEndSlotFromFp + num_args + 1]; num_args (R1) is Smi. |
| 1098 __ ldr(R1, FieldAddress(R4, ArgumentsDescriptor::count_offset())); |
| 1099 __ add(R1, FP, Operand(R1, LSL, 1)); |
| 1100 __ ldr(R0, Address(R1, (kParamEndSlotFromFp + 1) * kWordSize)); |
| 1101 // Store R0 into the stack slot reserved for the function type arguments. |
| 1102 // If the function type arguments variable is captured, a copy will happen |
| 1103 // after the context is allocated. |
| 1104 const intptr_t slot_base = parsed_function().first_stack_local_index(); |
| 1105 ASSERT(parsed_function().function_type_arguments()->is_captured() || |
| 1106 parsed_function().function_type_arguments()->index() == slot_base); |
| 1107 __ Bind(&store_type_args); |
| 1108 __ str(R0, Address(FP, slot_base * kWordSize)); |
| 1109 __ Bind(&ok); |
| 1110 } |
| 1111 |
| 1112 // TODO(regis): Verify that no vector is passed if not generic, unless already |
| 1113 // checked during resolution. |
| 1114 |
1082 EndCodeSourceRange(TokenPosition::kDartCodePrologue); | 1115 EndCodeSourceRange(TokenPosition::kDartCodePrologue); |
1083 VisitBlocks(); | 1116 VisitBlocks(); |
1084 | 1117 |
1085 __ bkpt(0); | 1118 __ bkpt(0); |
1086 ASSERT(assembler()->constant_pool_allowed()); | 1119 ASSERT(assembler()->constant_pool_allowed()); |
1087 GenerateDeferredCode(); | 1120 GenerateDeferredCode(); |
1088 } | 1121 } |
1089 | 1122 |
1090 | 1123 |
1091 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, | 1124 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 | 1360 |
1328 | 1361 |
1329 void FlowGraphCompiler::EmitOptimizedStaticCall( | 1362 void FlowGraphCompiler::EmitOptimizedStaticCall( |
1330 const Function& function, | 1363 const Function& function, |
1331 const Array& arguments_descriptor, | 1364 const Array& arguments_descriptor, |
1332 intptr_t argument_count, | 1365 intptr_t argument_count, |
1333 intptr_t deopt_id, | 1366 intptr_t deopt_id, |
1334 TokenPosition token_pos, | 1367 TokenPosition token_pos, |
1335 LocationSummary* locs) { | 1368 LocationSummary* locs) { |
1336 ASSERT(!function.IsClosureFunction()); | 1369 ASSERT(!function.IsClosureFunction()); |
1337 if (function.HasOptionalParameters()) { | 1370 if (function.HasOptionalParameters() || |
| 1371 (FLAG_reify_generic_functions && function.IsGeneric())) { |
1338 __ LoadObject(R4, arguments_descriptor); | 1372 __ LoadObject(R4, arguments_descriptor); |
1339 } else { | 1373 } else { |
1340 __ LoadImmediate(R4, 0); // GC safe smi zero because of stub. | 1374 __ LoadImmediate(R4, 0); // GC safe smi zero because of stub. |
1341 } | 1375 } |
1342 // Do not use the code from the function, but let the code be patched so that | 1376 // Do not use the code from the function, but let the code be patched so that |
1343 // we can record the outgoing edges to other code. | 1377 // we can record the outgoing edges to other code. |
1344 GenerateStaticDartCall(deopt_id, token_pos, | 1378 GenerateStaticDartCall(deopt_id, token_pos, |
1345 *StubCode::CallStaticFunction_entry(), | 1379 *StubCode::CallStaticFunction_entry(), |
1346 RawPcDescriptors::kOther, locs, function); | 1380 RawPcDescriptors::kOther, locs, function); |
1347 __ Drop(argument_count); | 1381 __ Drop(argument_count); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 DRegister dreg = EvenDRegisterOf(reg); | 1856 DRegister dreg = EvenDRegisterOf(reg); |
1823 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1857 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1824 } | 1858 } |
1825 | 1859 |
1826 | 1860 |
1827 #undef __ | 1861 #undef __ |
1828 | 1862 |
1829 } // namespace dart | 1863 } // namespace dart |
1830 | 1864 |
1831 #endif // defined TARGET_ARCH_ARM | 1865 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |