| 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 | 6 |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/longjump.h" | 8 #include "vm/longjump.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| (...skipping 5493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5504 intptr_t length = ReadListLength(); // read list length. | 5504 intptr_t length = ReadListLength(); // read list length. |
| 5505 // Note: there will be "length" expressions. | 5505 // Note: there will be "length" expressions. |
| 5506 | 5506 |
| 5507 // The type argument for the factory call. | 5507 // The type argument for the factory call. |
| 5508 Fragment instructions = TranslateInstantiatedTypeArguments(type_arguments); | 5508 Fragment instructions = TranslateInstantiatedTypeArguments(type_arguments); |
| 5509 instructions += PushArgument(); | 5509 instructions += PushArgument(); |
| 5510 if (length == 0) { | 5510 if (length == 0) { |
| 5511 instructions += Constant(Object::empty_array()); | 5511 instructions += Constant(Object::empty_array()); |
| 5512 } else { | 5512 } else { |
| 5513 // The type arguments for CreateArray. | 5513 // The type arguments for CreateArray. |
| 5514 instructions += Constant(TypeArguments::ZoneHandle(Z)); | 5514 instructions += Constant(type_arguments); |
| 5515 instructions += IntConstant(length); | 5515 instructions += IntConstant(length); |
| 5516 instructions += CreateArray(); | 5516 instructions += CreateArray(); |
| 5517 AbstractType& list_type = AbstractType::ZoneHandle(Z); |
| 5518 if (I->type_checks()) { |
| 5519 if (type_arguments.IsNull()) { |
| 5520 // It was dynamic. |
| 5521 list_type = Object::dynamic_type().raw(); |
| 5522 } else { |
| 5523 list_type = type_arguments.TypeAt(0); |
| 5524 } |
| 5525 } |
| 5517 | 5526 |
| 5518 LocalVariable* array = MakeTemporary(); | 5527 LocalVariable* array = MakeTemporary(); |
| 5519 for (intptr_t i = 0; i < length; ++i) { | 5528 for (intptr_t i = 0; i < length; ++i) { |
| 5520 instructions += LoadLocal(array); | 5529 instructions += LoadLocal(array); |
| 5521 instructions += IntConstant(i); | 5530 instructions += IntConstant(i); |
| 5522 instructions += BuildExpression(); // read ith expression. | 5531 instructions += BuildExpression(); // read ith expression. |
| 5532 instructions += CheckAssignableInCheckedMode( |
| 5533 list_type, Symbols::ListLiteralElement()); |
| 5523 instructions += StoreIndexed(kArrayCid); | 5534 instructions += StoreIndexed(kArrayCid); |
| 5524 instructions += Drop(); | 5535 instructions += Drop(); |
| 5525 } | 5536 } |
| 5526 } | 5537 } |
| 5527 instructions += PushArgument(); // The array. | 5538 instructions += PushArgument(); // The array. |
| 5528 | 5539 |
| 5529 const dart::Class& factory_class = | 5540 const dart::Class& factory_class = |
| 5530 dart::Class::Handle(Z, dart::Library::LookupCoreClass(Symbols::List())); | 5541 dart::Class::Handle(Z, dart::Library::LookupCoreClass(Symbols::List())); |
| 5531 const Function& factory_method = Function::ZoneHandle( | 5542 const Function& factory_method = Function::ZoneHandle( |
| 5532 Z, factory_class.LookupFactory( | 5543 Z, factory_class.LookupFactory( |
| (...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6898 metadata_values.SetAt(i, value); | 6909 metadata_values.SetAt(i, value); |
| 6899 } | 6910 } |
| 6900 | 6911 |
| 6901 return metadata_values.raw(); | 6912 return metadata_values.raw(); |
| 6902 } | 6913 } |
| 6903 | 6914 |
| 6904 } // namespace kernel | 6915 } // namespace kernel |
| 6905 } // namespace dart | 6916 } // namespace dart |
| 6906 | 6917 |
| 6907 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6918 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |