| 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 <map> | 5 #include <map> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "vm/kernel_to_il.h" | 9 #include "vm/kernel_to_il.h" |
| 10 | 10 |
| (...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 | 2039 |
| 2040 instructions += LoadLocal(scopes_->this_variable); | 2040 instructions += LoadLocal(scopes_->this_variable); |
| 2041 instructions += LoadField(type_arguments_field_offset); | 2041 instructions += LoadField(type_arguments_field_offset); |
| 2042 } else { | 2042 } else { |
| 2043 instructions += NullConstant(); | 2043 instructions += NullConstant(); |
| 2044 } | 2044 } |
| 2045 return instructions; | 2045 return instructions; |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 | 2048 |
| 2049 Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) { |
| 2050 InstantiateTypeInstr* instr = new (Z) InstantiateTypeInstr( |
| 2051 TokenPosition::kNoSource, type, *active_class_.klass, Pop()); |
| 2052 Push(instr); |
| 2053 return Fragment(instr); |
| 2054 } |
| 2055 |
| 2056 |
| 2049 Fragment FlowGraphBuilder::InstantiateTypeArguments( | 2057 Fragment FlowGraphBuilder::InstantiateTypeArguments( |
| 2050 const TypeArguments& type_arguments) { | 2058 const TypeArguments& type_arguments) { |
| 2051 InstantiateTypeArgumentsInstr* instr = new (Z) InstantiateTypeArgumentsInstr( | 2059 InstantiateTypeArgumentsInstr* instr = new (Z) InstantiateTypeArgumentsInstr( |
| 2052 TokenPosition::kNoSource, type_arguments, *active_class_.klass, Pop()); | 2060 TokenPosition::kNoSource, type_arguments, *active_class_.klass, Pop()); |
| 2053 Push(instr); | 2061 Push(instr); |
| 2054 return Fragment(instr); | 2062 return Fragment(instr); |
| 2055 } | 2063 } |
| 2056 | 2064 |
| 2057 | 2065 |
| 2058 Fragment FlowGraphBuilder::TranslateInstantiatedTypeArguments( | 2066 Fragment FlowGraphBuilder::TranslateInstantiatedTypeArguments( |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4197 klass.SetCanonicalType(type); | 4205 klass.SetCanonicalType(type); |
| 4198 } | 4206 } |
| 4199 return type; | 4207 return type; |
| 4200 } | 4208 } |
| 4201 | 4209 |
| 4202 | 4210 |
| 4203 void FlowGraphBuilder::VisitTypeLiteral(TypeLiteral* node) { | 4211 void FlowGraphBuilder::VisitTypeLiteral(TypeLiteral* node) { |
| 4204 const AbstractType& type = T.TranslateType(node->type()); | 4212 const AbstractType& type = T.TranslateType(node->type()); |
| 4205 if (type.IsMalformed()) H.ReportError("Malformed type literal"); | 4213 if (type.IsMalformed()) H.ReportError("Malformed type literal"); |
| 4206 | 4214 |
| 4207 fragment_ = Constant(type); | 4215 Fragment instructions; |
| 4216 if (type.IsInstantiated()) { |
| 4217 instructions += Constant(type); |
| 4218 } else { |
| 4219 instructions += LoadInstantiatorTypeArguments(); |
| 4220 instructions += InstantiateType(type); |
| 4221 } |
| 4222 fragment_ = instructions; |
| 4208 } | 4223 } |
| 4209 | 4224 |
| 4210 | 4225 |
| 4211 void FlowGraphBuilder::VisitVariableGet(VariableGet* node) { | 4226 void FlowGraphBuilder::VisitVariableGet(VariableGet* node) { |
| 4212 fragment_ = LoadLocal(LookupVariable(node->variable())); | 4227 fragment_ = LoadLocal(LookupVariable(node->variable())); |
| 4213 } | 4228 } |
| 4214 | 4229 |
| 4215 | 4230 |
| 4216 void FlowGraphBuilder::VisitVariableSet(VariableSet* node) { | 4231 void FlowGraphBuilder::VisitVariableSet(VariableSet* node) { |
| 4217 Fragment instructions = TranslateExpression(node->expression()); | 4232 Fragment instructions = TranslateExpression(node->expression()); |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5836 instructions += LoadLocal(parsed_function_->current_context_var()); | 5851 instructions += LoadLocal(parsed_function_->current_context_var()); |
| 5837 instructions += StoreInstanceField(Closure::context_offset()); | 5852 instructions += StoreInstanceField(Closure::context_offset()); |
| 5838 | 5853 |
| 5839 return instructions; | 5854 return instructions; |
| 5840 } | 5855 } |
| 5841 | 5856 |
| 5842 | 5857 |
| 5843 } // namespace kernel | 5858 } // namespace kernel |
| 5844 } // namespace dart | 5859 } // namespace dart |
| 5845 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 5860 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |