OLD | NEW |
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 3446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3457 function_node_helper.ReadUntilExcluding( | 3457 function_node_helper.ReadUntilExcluding( |
3458 FunctionNodeHelper::kPositionalParameters); | 3458 FunctionNodeHelper::kPositionalParameters); |
3459 | 3459 |
3460 // Positional. | 3460 // Positional. |
3461 const intptr_t positional_argument_count = ReadListLength(); | 3461 const intptr_t positional_argument_count = ReadListLength(); |
3462 | 3462 |
3463 // The first argument is the instance of the closure class. For converted | 3463 // The first argument is the instance of the closure class. For converted |
3464 // closures its context field contains the context vector that is used by the | 3464 // closures its context field contains the context vector that is used by the |
3465 // converted top-level function (target) explicitly and that should be passed | 3465 // converted top-level function (target) explicitly and that should be passed |
3466 // to that function as the first parameter. | 3466 // to that function as the first parameter. |
3467 body += LoadLocal(LookupVariable( | 3467 LocalVariable* var = LookupVariable(ReaderOffset() + relative_kernel_offset_); |
3468 ReaderOffset() + relative_kernel_offset_)); // 0th variable offset. | 3468 LocalVariable* parameter = |
| 3469 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 3470 Symbols::TempParam(), var->type()); |
| 3471 parameter->set_index(parsed_function()->first_parameter_index()); |
| 3472 if (var->is_captured()) parameter->set_is_captured_parameter(true); |
| 3473 body += LoadLocal(parameter); // 0th variable offset. |
3469 body += flow_graph_builder_->LoadField(Closure::context_offset()); | 3474 body += flow_graph_builder_->LoadField(Closure::context_offset()); |
3470 LocalVariable* context = MakeTemporary(); | 3475 LocalVariable* context = MakeTemporary(); |
3471 | 3476 |
3472 if (type_param_count > 0) { | 3477 if (type_param_count > 0) { |
3473 body += LoadLocal(context); | 3478 body += LoadLocal(context); |
3474 body += flow_graph_builder_->LoadField(Context::variable_offset(0)); | 3479 body += flow_graph_builder_->LoadField(Context::variable_offset(0)); |
3475 body += PushArgument(); | 3480 body += PushArgument(); |
3476 } | 3481 } |
3477 | 3482 |
3478 body += LoadLocal(context); | 3483 body += LoadLocal(context); |
(...skipping 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7793 } | 7798 } |
7794 } | 7799 } |
7795 | 7800 |
7796 return Array::Handle(Array::null()); | 7801 return Array::Handle(Array::null()); |
7797 } | 7802 } |
7798 | 7803 |
7799 } // namespace kernel | 7804 } // namespace kernel |
7800 } // namespace dart | 7805 } // namespace dart |
7801 | 7806 |
7802 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 7807 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |