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

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

Issue 2793033005: Keep types in signatures of function types properly instantiated as the function (Closed)
Patch Set: added comment and sync Created 3 years, 8 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/dart_api_impl.cc ('k') | runtime/vm/object.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 Class::ZoneHandle(Z, isolate()->object_store()->closure_class()); 2337 Class::ZoneHandle(Z, isolate()->object_store()->closure_class());
2338 ZoneGrowableArray<PushArgumentInstr*>* no_arguments = 2338 ZoneGrowableArray<PushArgumentInstr*>* no_arguments =
2339 new (Z) ZoneGrowableArray<PushArgumentInstr*>(0); 2339 new (Z) ZoneGrowableArray<PushArgumentInstr*>(0);
2340 AllocateObjectInstr* alloc = new (Z) 2340 AllocateObjectInstr* alloc = new (Z)
2341 AllocateObjectInstr(node->token_pos(), closure_class, no_arguments); 2341 AllocateObjectInstr(node->token_pos(), closure_class, no_arguments);
2342 alloc->set_closure_function(function); 2342 alloc->set_closure_function(function);
2343 2343
2344 Value* closure_val = Bind(alloc); 2344 Value* closure_val = Bind(alloc);
2345 { 2345 {
2346 LocalVariable* closure_tmp_var = EnterTempLocalScope(closure_val); 2346 LocalVariable* closure_tmp_var = EnterTempLocalScope(closure_val);
2347 // Store instantiator type arguments if scope class is generic. 2347 // Store instantiator type arguments if signature is uninstantiated.
2348 const Type& function_type = Type::ZoneHandle(Z, function.SignatureType()); 2348 if (!function.HasInstantiatedSignature(kCurrentClass)) {
2349 const Class& scope_cls = Class::ZoneHandle(Z, function_type.type_class());
2350 if (scope_cls.IsGeneric()) {
2351 ASSERT(function.Owner() == scope_cls.raw());
2352 Value* closure_tmp_val = 2349 Value* closure_tmp_val =
2353 Bind(new (Z) LoadLocalInstr(*closure_tmp_var, node->token_pos())); 2350 Bind(new (Z) LoadLocalInstr(*closure_tmp_var, node->token_pos()));
2354 Value* type_arguments = BuildInstantiatorTypeArguments(node->token_pos()); 2351 Value* type_arguments = BuildInstantiatorTypeArguments(node->token_pos());
2355 Do(new (Z) StoreInstanceFieldInstr(Closure::instantiator_offset(), 2352 Do(new (Z) StoreInstanceFieldInstr(Closure::instantiator_offset(),
2356 closure_tmp_val, type_arguments, 2353 closure_tmp_val, type_arguments,
2357 kEmitStoreBarrier, node->token_pos())); 2354 kEmitStoreBarrier, node->token_pos()));
2358 } 2355 }
2359 2356
2360 // Store function. 2357 // Store function.
2361 Value* closure_tmp_val = 2358 Value* closure_tmp_val =
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 ASSERT(type.HasResolvedTypeClass()); 4352 ASSERT(type.HasResolvedTypeClass());
4356 const Class& type_class = Class::Handle(type.type_class()); 4353 const Class& type_class = Class::Handle(type.type_class());
4357 // Bail if the type has any type parameters. 4354 // Bail if the type has any type parameters.
4358 if (type_class.IsGeneric()) return false; 4355 if (type_class.IsGeneric()) return false;
4359 4356
4360 // Finally a simple class for instance of checking. 4357 // Finally a simple class for instance of checking.
4361 return true; 4358 return true;
4362 } 4359 }
4363 4360
4364 } // namespace dart 4361 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698