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

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

Issue 2624273002: VM: [Kernel] Fix constructor invocations by creating the unfolded type argument vector (Closed)
Patch Set: Created 3 years, 11 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 | tests/co19/co19-kernel.status » ('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) 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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "vm/kernel_to_il.h" 9 #include "vm/kernel_to_il.h"
10 10
(...skipping 4558 matching lines...) Expand 10 before | Expand all | Expand 10 after
4569 4569
4570 dart::Class& klass = 4570 dart::Class& klass =
4571 dart::Class::ZoneHandle(Z, H.LookupClassByKernelClass(kernel_class)); 4571 dart::Class::ZoneHandle(Z, H.LookupClassByKernelClass(kernel_class));
4572 4572
4573 Fragment instructions; 4573 Fragment instructions;
4574 if (klass.NumTypeArguments() > 0) { 4574 if (klass.NumTypeArguments() > 0) {
4575 List<DartType>& kernel_type_arguments = node->arguments()->types(); 4575 List<DartType>& kernel_type_arguments = node->arguments()->types();
4576 const TypeArguments& type_arguments = T.TranslateInstantiatedTypeArguments( 4576 const TypeArguments& type_arguments = T.TranslateInstantiatedTypeArguments(
4577 klass, kernel_type_arguments.raw_array(), 4577 klass, kernel_type_arguments.raw_array(),
4578 kernel_type_arguments.length()); 4578 kernel_type_arguments.length());
4579 if (!klass.IsGeneric()) {
4580 Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw());
4579 4581
4580 if (type_arguments.IsNull() || type_arguments.IsInstantiated()) { 4582 // TODO(27590): Can we move this code into [ReceiverType]?
4583 type ^= ClassFinalizer::FinalizeType(*active_class_.klass, type,
4584 ClassFinalizer::kFinalize);
4585 ASSERT(!type.IsMalformedOrMalbounded());
4586
4587 TypeArguments& canonicalized_type_arguments =
4588 TypeArguments::ZoneHandle(Z, type.arguments());
4589 canonicalized_type_arguments =
4590 canonicalized_type_arguments.Canonicalize();
4591 instructions += Constant(canonicalized_type_arguments);
4592 } else {
4581 instructions += TranslateInstantiatedTypeArguments(type_arguments); 4593 instructions += TranslateInstantiatedTypeArguments(type_arguments);
kustermann 2017/01/11 19:16:37 This CL replaces if () { X } else { Y } with
4582 } else {
4583 if (!klass.IsGeneric()) {
4584 Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw());
4585
4586 // TODO(27590): Can we move this code into [ReceiverType]?
4587 type ^= ClassFinalizer::FinalizeType(*active_class_.klass, type,
4588 ClassFinalizer::kFinalize);
4589 ASSERT(!type.IsMalformedOrMalbounded());
4590
4591 TypeArguments& canonicalized_type_arguments =
4592 TypeArguments::ZoneHandle(Z, type.arguments());
4593 canonicalized_type_arguments =
4594 canonicalized_type_arguments.Canonicalize();
4595 instructions += Constant(canonicalized_type_arguments);
4596 } else {
4597 instructions += TranslateInstantiatedTypeArguments(type_arguments);
4598 }
4599 } 4594 }
4600 4595
4601 instructions += PushArgument(); 4596 instructions += PushArgument();
4602 instructions += AllocateObject(klass, 1); 4597 instructions += AllocateObject(klass, 1);
4603 } else { 4598 } else {
4604 instructions += AllocateObject(klass, 0); 4599 instructions += AllocateObject(klass, 0);
4605 } 4600 }
4606 LocalVariable* variable = MakeTemporary(); 4601 LocalVariable* variable = MakeTemporary();
4607 4602
4608 instructions += LoadLocal(variable); 4603 instructions += LoadLocal(variable);
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
5868 instructions += LoadLocal(parsed_function_->current_context_var()); 5863 instructions += LoadLocal(parsed_function_->current_context_var());
5869 instructions += StoreInstanceField(Closure::context_offset()); 5864 instructions += StoreInstanceField(Closure::context_offset());
5870 5865
5871 return instructions; 5866 return instructions;
5872 } 5867 }
5873 5868
5874 5869
5875 } // namespace kernel 5870 } // namespace kernel
5876 } // namespace dart 5871 } // namespace dart
5877 #endif // !defined(DART_PRECOMPILED_RUNTIME) 5872 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698