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

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

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

Powered by Google App Engine
This is Rietveld 408576698