| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 __ LoadObject(R1, Object::empty_context()); | 1064 __ LoadObject(R1, Object::empty_context()); |
| 1065 __ StoreToOffset(R1, FP, (slot_base - i) * kWordSize); | 1065 __ StoreToOffset(R1, FP, (slot_base - i) * kWordSize); |
| 1066 } | 1066 } |
| 1067 } else { | 1067 } else { |
| 1068 ASSERT(num_locals > 1); | 1068 ASSERT(num_locals > 1); |
| 1069 __ StoreToOffset(R0, FP, (slot_base - i) * kWordSize); | 1069 __ StoreToOffset(R0, FP, (slot_base - i) * kWordSize); |
| 1070 } | 1070 } |
| 1071 } | 1071 } |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 // Check for a passed type argument vector if the function is generic. |
| 1075 if (FLAG_reify_generic_functions && function.IsGeneric()) { |
| 1076 __ Comment("Check passed-in type args"); |
| 1077 Label store_type_args, ok; |
| 1078 __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::type_args_len_offset()); |
| 1079 __ CompareImmediate(R0, 0); |
| 1080 if (is_optimizing()) { |
| 1081 // Initialize type_args to null if none passed in. |
| 1082 __ LoadObject(R0, Object::null_object()); |
| 1083 __ b(&store_type_args, EQ); |
| 1084 } else { |
| 1085 __ b(&ok, EQ); // Already initialized to null. |
| 1086 } |
| 1087 // TODO(regis): Verify that type_args_len is correct. |
| 1088 // Load the passed type args vector in R0 from |
| 1089 // fp[kParamEndSlotFromFp + num_args + 1]; num_args (R1) is Smi. |
| 1090 __ LoadFieldFromOffset(R1, R4, ArgumentsDescriptor::count_offset()); |
| 1091 __ add(R1, FP, Operand(R1, LSL, 2)); |
| 1092 __ LoadFromOffset(R0, R1, (kParamEndSlotFromFp + 1) * kWordSize); |
| 1093 // Store R0 into the stack slot reserved for the function type arguments. |
| 1094 // If the function type arguments variable is captured, a copy will happen |
| 1095 // after the context is allocated. |
| 1096 const intptr_t slot_base = parsed_function().first_stack_local_index(); |
| 1097 ASSERT(parsed_function().function_type_arguments()->is_captured() || |
| 1098 parsed_function().function_type_arguments()->index() == slot_base); |
| 1099 __ Bind(&store_type_args); |
| 1100 __ StoreToOffset(R0, FP, slot_base * kWordSize); |
| 1101 __ Bind(&ok); |
| 1102 } |
| 1103 |
| 1104 // TODO(regis): Verify that no vector is passed if not generic, unless already |
| 1105 // checked during resolution. |
| 1106 |
| 1074 EndCodeSourceRange(TokenPosition::kDartCodePrologue); | 1107 EndCodeSourceRange(TokenPosition::kDartCodePrologue); |
| 1075 VisitBlocks(); | 1108 VisitBlocks(); |
| 1076 | 1109 |
| 1077 __ brk(0); | 1110 __ brk(0); |
| 1078 ASSERT(assembler()->constant_pool_allowed()); | 1111 ASSERT(assembler()->constant_pool_allowed()); |
| 1079 GenerateDeferredCode(); | 1112 GenerateDeferredCode(); |
| 1080 } | 1113 } |
| 1081 | 1114 |
| 1082 | 1115 |
| 1083 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, | 1116 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1345 |
| 1313 | 1346 |
| 1314 void FlowGraphCompiler::EmitOptimizedStaticCall( | 1347 void FlowGraphCompiler::EmitOptimizedStaticCall( |
| 1315 const Function& function, | 1348 const Function& function, |
| 1316 const Array& arguments_descriptor, | 1349 const Array& arguments_descriptor, |
| 1317 intptr_t argument_count, | 1350 intptr_t argument_count, |
| 1318 intptr_t deopt_id, | 1351 intptr_t deopt_id, |
| 1319 TokenPosition token_pos, | 1352 TokenPosition token_pos, |
| 1320 LocationSummary* locs) { | 1353 LocationSummary* locs) { |
| 1321 ASSERT(!function.IsClosureFunction()); | 1354 ASSERT(!function.IsClosureFunction()); |
| 1322 if (function.HasOptionalParameters()) { | 1355 if (function.HasOptionalParameters() || |
| 1356 (FLAG_reify_generic_functions && function.IsGeneric())) { |
| 1323 __ LoadObject(R4, arguments_descriptor); | 1357 __ LoadObject(R4, arguments_descriptor); |
| 1324 } else { | 1358 } else { |
| 1325 __ LoadImmediate(R4, 0); // GC safe smi zero because of stub. | 1359 __ LoadImmediate(R4, 0); // GC safe smi zero because of stub. |
| 1326 } | 1360 } |
| 1327 // Do not use the code from the function, but let the code be patched so that | 1361 // Do not use the code from the function, but let the code be patched so that |
| 1328 // we can record the outgoing edges to other code. | 1362 // we can record the outgoing edges to other code. |
| 1329 GenerateStaticDartCall(deopt_id, token_pos, | 1363 GenerateStaticDartCall(deopt_id, token_pos, |
| 1330 *StubCode::CallStaticFunction_entry(), | 1364 *StubCode::CallStaticFunction_entry(), |
| 1331 RawPcDescriptors::kOther, locs, function); | 1365 RawPcDescriptors::kOther, locs, function); |
| 1332 __ Drop(argument_count); | 1366 __ Drop(argument_count); |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1800 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1767 __ PopDouble(reg); | 1801 __ PopDouble(reg); |
| 1768 } | 1802 } |
| 1769 | 1803 |
| 1770 | 1804 |
| 1771 #undef __ | 1805 #undef __ |
| 1772 | 1806 |
| 1773 } // namespace dart | 1807 } // namespace dart |
| 1774 | 1808 |
| 1775 #endif // defined TARGET_ARCH_ARM64 | 1809 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |