Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(799)

Side by Side Diff: runtime/vm/flow_graph_compiler_mips.cc

Issue 2941643002: Check for a passed-in type argument vector in the prolog of generic functions. (Closed)
Patch Set: address review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 __ LoadObject(V1, Object::empty_context()); 1089 __ LoadObject(V1, Object::empty_context());
1090 __ sw(V1, Address(FP, (slot_base - i) * kWordSize)); 1090 __ sw(V1, Address(FP, (slot_base - i) * kWordSize));
1091 } 1091 }
1092 } else { 1092 } else {
1093 ASSERT(num_locals > 1); 1093 ASSERT(num_locals > 1);
1094 __ sw(V0, Address(FP, (slot_base - i) * kWordSize)); 1094 __ sw(V0, Address(FP, (slot_base - i) * kWordSize));
1095 } 1095 }
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 // Check for a passed type argument vector if the function is generic.
1100 if (FLAG_reify_generic_functions && function.IsGeneric()) {
1101 __ Comment("Check passed-in type args");
1102 Label store_type_args, ok;
1103 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::type_args_len_offset()));
1104 if (is_optimizing()) {
1105 // Initialize type_args to null if none passed in.
1106 __ LoadObject(T0, Object::null_object());
1107 __ BranchEqual(T1, Immediate(0), &store_type_args);
1108 } else {
1109 __ BranchEqual(T1, Immediate(0), &ok); // Already initialized to null.
1110 }
1111 // TODO(regis): Verify that type_args_len is correct.
1112 // Load the passed type args vector in T0 from
1113 // fp[kParamEndSlotFromFp + num_args + 1]; num_args (T1) is Smi.
1114 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
1115 __ sll(T1, T1, 1);
1116 __ addu(T1, FP, T1);
1117 __ lw(T0, Address(T1, (kParamEndSlotFromFp + 1) * kWordSize));
1118 // Store T0 into the stack slot reserved for the function type arguments.
1119 // If the function type arguments variable is captured, a copy will happen
1120 // after the context is allocated.
1121 const intptr_t slot_base = parsed_function().first_stack_local_index();
1122 ASSERT(parsed_function().function_type_arguments()->is_captured() ||
1123 parsed_function().function_type_arguments()->index() == slot_base);
1124 __ Bind(&store_type_args);
1125 __ sw(T0, Address(FP, slot_base * kWordSize));
1126 __ Bind(&ok);
1127 }
1128
1129 // TODO(regis): Verify that no vector is passed if not generic, unless already
1130 // checked during resolution.
1131
1099 EndCodeSourceRange(TokenPosition::kDartCodePrologue); 1132 EndCodeSourceRange(TokenPosition::kDartCodePrologue);
1100 VisitBlocks(); 1133 VisitBlocks();
1101 1134
1102 __ break_(0); 1135 __ break_(0);
1103 GenerateDeferredCode(); 1136 GenerateDeferredCode();
1104 } 1137 }
1105 1138
1106 1139
1107 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, 1140 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos,
1108 const StubEntry& stub_entry, 1141 const StubEntry& stub_entry,
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 1370
1338 void FlowGraphCompiler::EmitOptimizedStaticCall( 1371 void FlowGraphCompiler::EmitOptimizedStaticCall(
1339 const Function& function, 1372 const Function& function,
1340 const Array& arguments_descriptor, 1373 const Array& arguments_descriptor,
1341 intptr_t argument_count, 1374 intptr_t argument_count,
1342 intptr_t deopt_id, 1375 intptr_t deopt_id,
1343 TokenPosition token_pos, 1376 TokenPosition token_pos,
1344 LocationSummary* locs) { 1377 LocationSummary* locs) {
1345 __ Comment("StaticCall"); 1378 __ Comment("StaticCall");
1346 ASSERT(!function.IsClosureFunction()); 1379 ASSERT(!function.IsClosureFunction());
1347 if (function.HasOptionalParameters()) { 1380 if (function.HasOptionalParameters() ||
1381 (FLAG_reify_generic_functions && function.IsGeneric())) {
1348 __ LoadObject(S4, arguments_descriptor); 1382 __ LoadObject(S4, arguments_descriptor);
1349 } else { 1383 } else {
1350 __ LoadImmediate(S4, 0); // GC safe smi zero because of stub. 1384 __ LoadImmediate(S4, 0); // GC safe smi zero because of stub.
1351 } 1385 }
1352 // Do not use the code from the function, but let the code be patched so that 1386 // Do not use the code from the function, but let the code be patched so that
1353 // we can record the outgoing edges to other code. 1387 // we can record the outgoing edges to other code.
1354 GenerateStaticDartCall(deopt_id, token_pos, 1388 GenerateStaticDartCall(deopt_id, token_pos,
1355 *StubCode::CallStaticFunction_entry(), 1389 *StubCode::CallStaticFunction_entry(),
1356 RawPcDescriptors::kOther, locs, function); 1390 RawPcDescriptors::kOther, locs, function);
1357 __ Drop(argument_count); 1391 __ Drop(argument_count);
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 __ AddImmediate(SP, kDoubleSize); 1842 __ AddImmediate(SP, kDoubleSize);
1809 } 1843 }
1810 1844
1811 1845
1812 #undef __ 1846 #undef __
1813 1847
1814 1848
1815 } // namespace dart 1849 } // namespace dart
1816 1850
1817 #endif // defined TARGET_ARCH_MIPS 1851 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698