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

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

Issue 3007123002: [kernel] const constructor type arguments (Closed)
Patch Set: Created 3 years, 3 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 | « no previous file | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "vm/longjump.h" 7 #include "vm/longjump.h"
8 #include "vm/object_store.h" 8 #include "vm/object_store.h"
9 9
10 #if !defined(DART_PRECOMPILED_RUNTIME) 10 #if !defined(DART_PRECOMPILED_RUNTIME)
(...skipping 2516 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 Function::Handle(Z, H.LookupConstructorByKernelConstructor(target)); 2527 Function::Handle(Z, H.LookupConstructorByKernelConstructor(target));
2528 Class& klass = Class::Handle(Z, constructor.Owner()); 2528 Class& klass = Class::Handle(Z, constructor.Owner());
2529 2529
2530 intptr_t argument_count = 2530 intptr_t argument_count =
2531 builder_->ReadUInt(); // read arguments part #1: arguments count. 2531 builder_->ReadUInt(); // read arguments part #1: arguments count.
2532 2532
2533 // Build the type arguments vector (if necessary). 2533 // Build the type arguments vector (if necessary).
2534 const TypeArguments* type_arguments = 2534 const TypeArguments* type_arguments =
2535 TranslateTypeArguments(constructor, &klass); // read argument types. 2535 TranslateTypeArguments(constructor, &klass); // read argument types.
2536 2536
2537 if (klass.NumTypeArguments() > 0 && !klass.IsGeneric()) {
jensj 2017/09/04 07:56:42 This code is basically just a copy-pasta from the
kustermann 2017/09/04 10:21:34 It seems correct, since NumTypeArguments (as oppos
2538 Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw());
2539 // TODO(27590): Can we move this code into [ReceiverType]?
2540 type ^= ClassFinalizer::FinalizeType(*builder_->active_class()->klass, type,
2541 ClassFinalizer::kFinalize);
2542 ASSERT(!type.IsMalformedOrMalbounded());
2543
2544 TypeArguments& canonicalized_type_arguments =
2545 TypeArguments::ZoneHandle(Z, type.arguments());
2546 canonicalized_type_arguments = canonicalized_type_arguments.Canonicalize();
2547 type_arguments = &canonicalized_type_arguments;
2548 }
2549
2537 // Prepare either the instance or the type argument vector for the constructor 2550 // Prepare either the instance or the type argument vector for the constructor
2538 // call. 2551 // call.
2539 Instance* receiver = NULL; 2552 Instance* receiver = NULL;
2540 const TypeArguments* type_arguments_argument = NULL; 2553 const TypeArguments* type_arguments_argument = NULL;
2541 if (!constructor.IsFactory()) { 2554 if (!constructor.IsFactory()) {
2542 receiver = &Instance::ZoneHandle(Z, Instance::New(klass, Heap::kOld)); 2555 receiver = &Instance::ZoneHandle(Z, Instance::New(klass, Heap::kOld));
2543 if (type_arguments != NULL) { 2556 if (type_arguments != NULL) {
2544 receiver->SetTypeArguments(*type_arguments); 2557 receiver->SetTypeArguments(*type_arguments);
2545 } 2558 }
2546 } else { 2559 } else {
(...skipping 5209 matching lines...) Expand 10 before | Expand all | Expand 10 after
7756 } 7769 }
7757 } 7770 }
7758 7771
7759 return Array::Handle(Array::null()); 7772 return Array::Handle(Array::null());
7760 } 7773 }
7761 7774
7762 } // namespace kernel 7775 } // namespace kernel
7763 } // namespace dart 7776 } // namespace dart
7764 7777
7765 #endif // !defined(DART_PRECOMPILED_RUNTIME) 7778 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698