Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: runtime/vm/kernel_to_il.cc

Issue 2623143003: VM: [Kernel] Make type literals which refer to type parameters work (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698