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

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

Issue 2859673002: Pass type argument vector to generic functions (if --reify-generic-functions is (Closed)
Patch Set: address review comments and sync Created 3 years, 7 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/parser.cc ('k') | runtime/vm/regexp_assembler_ir.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/precompiler.h" 5 #include "vm/precompiler.h"
6 6
7 #include "vm/aot_optimizer.h" 7 #include "vm/aot_optimizer.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/branch_optimizer.h" 10 #include "vm/branch_optimizer.h"
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 for (intptr_t k = 0; k < fields.Length(); k++) { 816 for (intptr_t k = 0; k < fields.Length(); k++) {
817 field ^= fields.At(k); 817 field ^= fields.At(k);
818 if (field.is_static()) continue; 818 if (field.is_static()) continue;
819 field_type = field.type(); 819 field_type = field.type();
820 if (!field_type.IsFunctionType()) continue; 820 if (!field_type.IsFunctionType()) continue;
821 field_name = field.name(); 821 field_name = field.name();
822 if (!IsSent(field_name)) continue; 822 if (!IsSent(field_name)) continue;
823 // Create arguments descriptor with fixed parameters from 823 // Create arguments descriptor with fixed parameters from
824 // signature of field_type. 824 // signature of field_type.
825 function = Type::Cast(field_type).signature(); 825 function = Type::Cast(field_type).signature();
826 if (function.IsGeneric()) continue;
826 if (function.HasOptionalParameters()) continue; 827 if (function.HasOptionalParameters()) continue;
827 if (FLAG_trace_precompiler) { 828 if (FLAG_trace_precompiler) {
828 THR_Print("Found callback field %s\n", field_name.ToCString()); 829 THR_Print("Found callback field %s\n", field_name.ToCString());
829 } 830 }
830 args_desc = ArgumentsDescriptor::New(function.num_fixed_parameters()); 831 args_desc = ArgumentsDescriptor::New(0, // No type argument vector.
832 function.num_fixed_parameters());
831 cids.Clear(); 833 cids.Clear();
832 if (T->cha()->ConcreteSubclasses(cls, &cids)) { 834 if (T->cha()->ConcreteSubclasses(cls, &cids)) {
833 for (intptr_t j = 0; j < cids.length(); ++j) { 835 for (intptr_t j = 0; j < cids.length(); ++j) {
834 subcls ^= I->class_table()->At(cids[j]); 836 subcls ^= I->class_table()->At(cids[j]);
835 if (subcls.is_allocated()) { 837 if (subcls.is_allocated()) {
836 // Add dispatcher to cls. 838 // Add dispatcher to cls.
837 dispatcher = subcls.GetInvocationDispatcher( 839 dispatcher = subcls.GetInvocationDispatcher(
838 field_name, args_desc, RawFunction::kInvokeFieldDispatcher, 840 field_name, args_desc, RawFunction::kInvokeFieldDispatcher,
839 /* create_if_absent = */ true); 841 /* create_if_absent = */ true);
840 if (FLAG_trace_precompiler) { 842 if (FLAG_trace_precompiler) {
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 Zone* zone = Thread::Current()->zone(); 2508 Zone* zone = Thread::Current()->zone();
2507 2509
2508 for (BlockIterator block_it = graph->reverse_postorder_iterator(); 2510 for (BlockIterator block_it = graph->reverse_postorder_iterator();
2509 !block_it.Done(); block_it.Advance()) { 2511 !block_it.Done(); block_it.Advance()) {
2510 ForwardInstructionIterator it(block_it.Current()); 2512 ForwardInstructionIterator it(block_it.Current());
2511 for (; !it.Done(); it.Advance()) { 2513 for (; !it.Done(); it.Advance()) {
2512 Instruction* instr = it.Current(); 2514 Instruction* instr = it.Current();
2513 if (instr->IsInstanceCall()) { 2515 if (instr->IsInstanceCall()) {
2514 InstanceCallInstr* call = instr->AsInstanceCall(); 2516 InstanceCallInstr* call = instr->AsInstanceCall();
2515 if (!call->HasICData()) { 2517 if (!call->HasICData()) {
2516 const Array& arguments_descriptor = Array::Handle( 2518 const Array& arguments_descriptor =
2517 zone, ArgumentsDescriptor::New(call->ArgumentCount(), 2519 Array::Handle(zone, call->GetArgumentsDescriptor());
2518 call->argument_names()));
2519 const ICData& ic_data = ICData::ZoneHandle( 2520 const ICData& ic_data = ICData::ZoneHandle(
2520 zone, ICData::New(function, call->function_name(), 2521 zone, ICData::New(function, call->function_name(),
2521 arguments_descriptor, call->deopt_id(), 2522 arguments_descriptor, call->deopt_id(),
2522 call->checked_argument_count(), false)); 2523 call->checked_argument_count(), false));
2523 call->set_ic_data(&ic_data); 2524 call->set_ic_data(&ic_data);
2524 } 2525 }
2525 } else if (instr->IsStaticCall()) { 2526 } else if (instr->IsStaticCall()) {
2526 StaticCallInstr* call = instr->AsStaticCall(); 2527 StaticCallInstr* call = instr->AsStaticCall();
2527 if (!call->HasICData()) { 2528 if (!call->HasICData()) {
2528 const Array& arguments_descriptor = Array::Handle( 2529 const Array& arguments_descriptor =
2529 zone, ArgumentsDescriptor::New(call->ArgumentCount(), 2530 Array::Handle(zone, call->GetArgumentsDescriptor());
2530 call->argument_names()));
2531 const Function& target = call->function(); 2531 const Function& target = call->function();
2532 MethodRecognizer::Kind recognized_kind = 2532 MethodRecognizer::Kind recognized_kind =
2533 MethodRecognizer::RecognizeKind(target); 2533 MethodRecognizer::RecognizeKind(target);
2534 int num_args_checked = 0; 2534 int num_args_checked = 0;
2535 switch (recognized_kind) { 2535 switch (recognized_kind) {
2536 case MethodRecognizer::kDoubleFromInteger: 2536 case MethodRecognizer::kDoubleFromInteger:
2537 case MethodRecognizer::kMathMin: 2537 case MethodRecognizer::kMathMin:
2538 case MethodRecognizer::kMathMax: 2538 case MethodRecognizer::kMathMax:
2539 num_args_checked = 2; 2539 num_args_checked = 2;
2540 break; 2540 break;
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 3363
3364 ASSERT(FLAG_precompiled_mode); 3364 ASSERT(FLAG_precompiled_mode);
3365 const bool optimized = function.IsOptimizable(); // False for natives. 3365 const bool optimized = function.IsOptimizable(); // False for natives.
3366 DartPrecompilationPipeline pipeline(zone, field_type_map); 3366 DartPrecompilationPipeline pipeline(zone, field_type_map);
3367 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); 3367 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized);
3368 } 3368 }
3369 3369
3370 #endif // DART_PRECOMPILER 3370 #endif // DART_PRECOMPILER
3371 3371
3372 } // namespace dart 3372 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/regexp_assembler_ir.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698