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

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

Issue 3007623002: Fix many bugs with closure conversion in checked mode. (Closed)
Patch Set: Review comments 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 | « pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect ('k') | runtime/vm/object.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) 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 6391 matching lines...) Expand 10 before | Expand all | Expand 10 after
6402 instructions += LoadLocal(closure); 6402 instructions += LoadLocal(closure);
6403 instructions += Constant(function); 6403 instructions += Constant(function);
6404 instructions += 6404 instructions +=
6405 StoreInstanceField(TokenPosition::kNoSource, Closure::function_offset()); 6405 StoreInstanceField(TokenPosition::kNoSource, Closure::function_offset());
6406 6406
6407 instructions += LoadLocal(closure); 6407 instructions += LoadLocal(closure);
6408 instructions += LoadLocal(context); 6408 instructions += LoadLocal(context);
6409 instructions += 6409 instructions +=
6410 StoreInstanceField(TokenPosition::kNoSource, Closure::context_offset()); 6410 StoreInstanceField(TokenPosition::kNoSource, Closure::context_offset());
6411 6411
6412 instructions += Drop();
6413
6414 SkipDartType(); // skip function type of the closure. 6412 SkipDartType(); // skip function type of the closure.
6415 6413
6416 // TODO(30455): Kernel generic methods undone. When generic methods are 6414 // TODO(30455): Kernel generic methods undone. When generic methods are
6417 // fully supported in kernel, we'll need to store a NULL in the type arguments 6415 // fully supported in kernel, we'll need to store a NULL in the type arguments
6418 // slot when type arguments are absent, so the wrapper for the target function 6416 // slot when type arguments are absent, so the wrapper for the target function
6419 // can tell how many type args are captured vs. provided by the caller of the 6417 // can tell how many type args are captured vs. provided by the caller of the
6420 // closure. 6418 // closure.
6421 6419
6422 intptr_t types_count = ReadListLength(); // read type count. 6420 intptr_t types_count = ReadListLength(); // read type count.
6423 if (types_count > 0) { 6421 if (types_count > 0) {
6424 instructions += LoadLocal(context);
6425
6426 const TypeArguments& type_args = 6422 const TypeArguments& type_args =
6427 T.BuildTypeArguments(types_count); // read list of type arguments. 6423 T.BuildTypeArguments(types_count); // read list of type arguments.
6428 instructions += TranslateInstantiatedTypeArguments(type_args); 6424 instructions += TranslateInstantiatedTypeArguments(type_args);
6425 LocalVariable* type_args_slot = MakeTemporary();
6429 6426
6427 instructions += LoadLocal(context);
6428 instructions += LoadLocal(type_args_slot);
6430 instructions += StoreInstanceField(TokenPosition::kNoSource, 6429 instructions += StoreInstanceField(TokenPosition::kNoSource,
6431 Context::variable_offset(0)); 6430 Context::variable_offset(0));
6431
6432 instructions += LoadLocal(closure);
6433 instructions += LoadLocal(type_args_slot);
6434 instructions += StoreInstanceField(
6435 TokenPosition::kNoSource, Closure::function_type_arguments_offset());
6436
6437 instructions += Drop(); // type args
6432 } 6438 }
6433 6439
6440 instructions += Drop(); // context
6434 return instructions; 6441 return instructions;
6435 } 6442 }
6436 6443
6437 Fragment StreamingFlowGraphBuilder::BuildInvalidStatement() { 6444 Fragment StreamingFlowGraphBuilder::BuildInvalidStatement() {
6438 H.ReportError("Invalid statements not implemented yet!"); 6445 H.ReportError("Invalid statements not implemented yet!");
6439 return Fragment(); 6446 return Fragment();
6440 } 6447 }
6441 6448
6442 Fragment StreamingFlowGraphBuilder::BuildExpressionStatement() { 6449 Fragment StreamingFlowGraphBuilder::BuildExpressionStatement() {
6443 Fragment instructions = BuildExpression(); // read expression. 6450 Fragment instructions = BuildExpression(); // read expression.
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
7821 } 7828 }
7822 } 7829 }
7823 7830
7824 return Array::Handle(Array::null()); 7831 return Array::Handle(Array::null());
7825 } 7832 }
7826 7833
7827 } // namespace kernel 7834 } // namespace kernel
7828 } // namespace dart 7835 } // namespace dart
7829 7836
7830 #endif // !defined(DART_PRECOMPILED_RUNTIME) 7837 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698