| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "vm/kernel_to_il.h" | 7 #include "vm/kernel_to_il.h" |
| 8 | 8 |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 ASSERT(type_arguments_field_offset != dart::Class::kNoTypeArguments); | 783 ASSERT(type_arguments_field_offset != dart::Class::kNoTypeArguments); |
| 784 | 784 |
| 785 instructions += LoadLocal(scopes_->this_variable); | 785 instructions += LoadLocal(scopes_->this_variable); |
| 786 instructions += LoadField(type_arguments_field_offset); | 786 instructions += LoadField(type_arguments_field_offset); |
| 787 } else { | 787 } else { |
| 788 instructions += NullConstant(); | 788 instructions += NullConstant(); |
| 789 } | 789 } |
| 790 return instructions; | 790 return instructions; |
| 791 } | 791 } |
| 792 | 792 |
| 793 // TODO(sjindel): Kernel generic methods undone. This seems to work for static |
| 794 // top-level functions, but probably needs to be revisited when generic methods |
| 795 // are fully supported in kernel. |
| 793 Fragment FlowGraphBuilder::LoadFunctionTypeArguments() { | 796 Fragment FlowGraphBuilder::LoadFunctionTypeArguments() { |
| 794 UNIMPLEMENTED(); // TODO(regis) | 797 Fragment instructions; |
| 795 return Fragment(NULL); | 798 ASSERT(parsed_function_->function_type_arguments() != NULL); |
| 799 instructions += LoadLocal(parsed_function_->function_type_arguments()); |
| 800 return instructions; |
| 796 } | 801 } |
| 797 | 802 |
| 798 Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) { | 803 Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) { |
| 799 Value* function_type_args = Pop(); | 804 Value* function_type_args = Pop(); |
| 800 Value* instantiator_type_args = Pop(); | 805 Value* instantiator_type_args = Pop(); |
| 801 InstantiateTypeInstr* instr = new (Z) InstantiateTypeInstr( | 806 InstantiateTypeInstr* instr = new (Z) InstantiateTypeInstr( |
| 802 TokenPosition::kNoSource, type, instantiator_type_args, | 807 TokenPosition::kNoSource, type, instantiator_type_args, |
| 803 function_type_args, GetNextDeoptId()); | 808 function_type_args, GetNextDeoptId()); |
| 804 Push(instr); | 809 Push(instr); |
| 805 return Fragment(instr); | 810 return Fragment(instr); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 (function.name() == Symbols::ListFactory().raw())) { | 1280 (function.name() == Symbols::ListFactory().raw())) { |
| 1276 ASSERT(argument_count == 1 || argument_count == 2); | 1281 ASSERT(argument_count == 1 || argument_count == 2); |
| 1277 return (argument_count == 1) ? kGrowableObjectArrayCid : kArrayCid; | 1282 return (argument_count == 1) ? kGrowableObjectArrayCid : kArrayCid; |
| 1278 } | 1283 } |
| 1279 return FactoryRecognizer::ResultCid(function); | 1284 return FactoryRecognizer::ResultCid(function); |
| 1280 } | 1285 } |
| 1281 | 1286 |
| 1282 Fragment FlowGraphBuilder::StaticCall(TokenPosition position, | 1287 Fragment FlowGraphBuilder::StaticCall(TokenPosition position, |
| 1283 const Function& target, | 1288 const Function& target, |
| 1284 intptr_t argument_count, | 1289 intptr_t argument_count, |
| 1285 const Array& argument_names) { | 1290 const Array& argument_names, |
| 1291 intptr_t type_args_count) { |
| 1286 ArgumentArray arguments = GetArguments(argument_count); | 1292 ArgumentArray arguments = GetArguments(argument_count); |
| 1287 const intptr_t kTypeArgsLen = 0; // Generic static calls not yet supported. | |
| 1288 StaticCallInstr* call = | 1293 StaticCallInstr* call = |
| 1289 new (Z) StaticCallInstr(position, target, kTypeArgsLen, argument_names, | 1294 new (Z) StaticCallInstr(position, target, type_args_count, argument_names, |
| 1290 arguments, ic_data_array_, GetNextDeoptId()); | 1295 arguments, ic_data_array_, GetNextDeoptId()); |
| 1291 const intptr_t list_cid = | 1296 const intptr_t list_cid = |
| 1292 GetResultCidOfListFactory(Z, target, argument_count); | 1297 GetResultCidOfListFactory(Z, target, argument_count); |
| 1293 if (list_cid != kDynamicCid) { | 1298 if (list_cid != kDynamicCid) { |
| 1294 call->set_result_cid(list_cid); | 1299 call->set_result_cid(list_cid); |
| 1295 call->set_is_known_list_constructor(true); | 1300 call->set_is_known_list_constructor(true); |
| 1296 } else if (target.recognized_kind() != MethodRecognizer::kUnknown) { | 1301 } else if (target.recognized_kind() != MethodRecognizer::kUnknown) { |
| 1297 call->set_result_cid(MethodRecognizer::ResultCid(target)); | 1302 call->set_result_cid(MethodRecognizer::ResultCid(target)); |
| 1298 } | 1303 } |
| 1299 Push(call); | 1304 Push(call); |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2410 array_object = AsSortedDuplicateFreeArray(&token_positions); | 2415 array_object = AsSortedDuplicateFreeArray(&token_positions); |
| 2411 script.set_debug_positions(array_object); | 2416 script.set_debug_positions(array_object); |
| 2412 array_object = AsSortedDuplicateFreeArray(&yield_positions); | 2417 array_object = AsSortedDuplicateFreeArray(&yield_positions); |
| 2413 script.set_yield_positions(array_object); | 2418 script.set_yield_positions(array_object); |
| 2414 } | 2419 } |
| 2415 | 2420 |
| 2416 } // namespace kernel | 2421 } // namespace kernel |
| 2417 } // namespace dart | 2422 } // namespace dart |
| 2418 | 2423 |
| 2419 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 2424 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |