Chromium Code Reviews| 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 5678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5689 intptr_t length = ReadListLength(); // read list length. | 5689 intptr_t length = ReadListLength(); // read list length. |
| 5690 // Note: there will be "length" expressions. | 5690 // Note: there will be "length" expressions. |
| 5691 | 5691 |
| 5692 // The type argument for the factory call. | 5692 // The type argument for the factory call. |
| 5693 Fragment instructions = TranslateInstantiatedTypeArguments(type_arguments); | 5693 Fragment instructions = TranslateInstantiatedTypeArguments(type_arguments); |
| 5694 instructions += PushArgument(); | 5694 instructions += PushArgument(); |
| 5695 if (length == 0) { | 5695 if (length == 0) { |
| 5696 instructions += Constant(Object::empty_array()); | 5696 instructions += Constant(Object::empty_array()); |
| 5697 } else { | 5697 } else { |
| 5698 // The type arguments for CreateArray. | 5698 // The type arguments for CreateArray. |
| 5699 instructions += Constant(TypeArguments::ZoneHandle(Z)); | 5699 instructions += Constant(type_arguments); |
| 5700 instructions += IntConstant(length); | 5700 instructions += IntConstant(length); |
| 5701 instructions += CreateArray(); | 5701 instructions += CreateArray(); |
| 5702 AbstractType& list_type = AbstractType::Handle(type_arguments.TypeAt(0)); | |
|
Kevin Millikin (Google)
2017/06/19 15:01:17
Pass the zone argument Z so we don't have to get i
jensj
2017/06/20 10:43:30
Done.
| |
| 5702 | 5703 |
| 5703 LocalVariable* array = MakeTemporary(); | 5704 LocalVariable* array = MakeTemporary(); |
| 5704 for (intptr_t i = 0; i < length; ++i) { | 5705 for (intptr_t i = 0; i < length; ++i) { |
| 5705 instructions += LoadLocal(array); | 5706 instructions += LoadLocal(array); |
| 5706 instructions += IntConstant(i); | 5707 instructions += IntConstant(i); |
| 5707 instructions += BuildExpression(); // read ith expression. | 5708 instructions += BuildExpression(); // read ith expression. |
| 5709 instructions += CheckAssignableInCheckedMode( | |
| 5710 list_type, Symbols::ListLiteralElement()); | |
| 5708 instructions += StoreIndexed(kArrayCid); | 5711 instructions += StoreIndexed(kArrayCid); |
| 5709 instructions += Drop(); | 5712 instructions += Drop(); |
| 5710 } | 5713 } |
| 5711 } | 5714 } |
| 5712 instructions += PushArgument(); // The array. | 5715 instructions += PushArgument(); // The array. |
| 5713 | 5716 |
| 5714 const dart::Class& factory_class = | 5717 const dart::Class& factory_class = |
| 5715 dart::Class::Handle(Z, dart::Library::LookupCoreClass(Symbols::List())); | 5718 dart::Class::Handle(Z, dart::Library::LookupCoreClass(Symbols::List())); |
| 5716 const Function& factory_method = Function::ZoneHandle( | 5719 const Function& factory_method = Function::ZoneHandle( |
| 5717 Z, factory_class.LookupFactory( | 5720 Z, factory_class.LookupFactory( |
| (...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7136 metadata_values.SetAt(i, value); | 7139 metadata_values.SetAt(i, value); |
| 7137 } | 7140 } |
| 7138 | 7141 |
| 7139 return metadata_values.raw(); | 7142 return metadata_values.raw(); |
| 7140 } | 7143 } |
| 7141 | 7144 |
| 7142 } // namespace kernel | 7145 } // namespace kernel |
| 7143 } // namespace dart | 7146 } // namespace dart |
| 7144 | 7147 |
| 7145 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 7148 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |