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

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

Issue 9978014: Implement closure with type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/intermediate_language.h" 10 #include "vm/intermediate_language.h"
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 } 1180 }
1181 ++next_index; 1181 ++next_index;
1182 } 1182 }
1183 ASSERT(function.context_scope() != ContextScope::null()); 1183 ASSERT(function.context_scope() != ContextScope::null());
1184 1184
1185 // The function type of a closure may have type arguments. In that case, pass 1185 // The function type of a closure may have type arguments. In that case, pass
1186 // the type arguments of the instantiator. 1186 // the type arguments of the instantiator.
1187 const Class& cls = Class::Handle(function.signature_class()); 1187 const Class& cls = Class::Handle(function.signature_class());
1188 ASSERT(!cls.IsNull()); 1188 ASSERT(!cls.IsNull());
1189 const bool requires_type_arguments = cls.HasTypeArguments(); 1189 const bool requires_type_arguments = cls.HasTypeArguments();
1190 Value* type_arguments = NULL;
1190 if (requires_type_arguments) { 1191 if (requires_type_arguments) {
1191 Bailout("Closure creation requiring type arguments"); 1192 ASSERT(!function.IsImplicitStaticClosureFunction());
1193 type_arguments =
1194 BuildInstantiatorTypeArguments(node->token_index(), temp_index());
1192 } 1195 }
1193 1196
1194 CreateClosureComp* create = new CreateClosureComp(node); 1197 CreateClosureComp* create = new CreateClosureComp(node, type_arguments);
1195 ReturnComputation(create); 1198 ReturnComputation(create);
1196 } 1199 }
1197 1200
1198 1201
1199 void EffectGraphVisitor::TranslateArgumentList( 1202 void EffectGraphVisitor::TranslateArgumentList(
1200 const ArgumentListNode& node, 1203 const ArgumentListNode& node,
1201 intptr_t next_temp_index, 1204 intptr_t next_temp_index,
1202 ZoneGrowableArray<Value*>* values) { 1205 ZoneGrowableArray<Value*>* values) {
1203 for (intptr_t i = 0; i < node.length(); ++i) { 1206 for (intptr_t i = 0; i < node.length(); ++i) {
1204 ArgumentGraphVisitor for_argument(owner(), next_temp_index); 1207 ArgumentGraphVisitor for_argument(owner(), next_temp_index);
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 OS::Print("CreateArray("); 2069 OS::Print("CreateArray(");
2067 for (int i = 0; i < comp->ElementCount(); ++i) { 2070 for (int i = 0; i < comp->ElementCount(); ++i) {
2068 if (i != 0) OS::Print(", "); 2071 if (i != 0) OS::Print(", ");
2069 comp->ElementAt(i)->Accept(this); 2072 comp->ElementAt(i)->Accept(this);
2070 } 2073 }
2071 OS::Print(")"); 2074 OS::Print(")");
2072 } 2075 }
2073 2076
2074 2077
2075 void FlowGraphPrinter::VisitCreateClosure(CreateClosureComp* comp) { 2078 void FlowGraphPrinter::VisitCreateClosure(CreateClosureComp* comp) {
2076 OS::Print("CreateClosure(%s)", comp->function().ToCString()); 2079 OS::Print("CreateClosure(%s", comp->function().ToCString());
2080 if (comp->type_arguments() != NULL) {
2081 OS::Print(", ");
2082 comp->type_arguments()->Accept(this);
2083 }
2084 OS::Print(")");
2077 } 2085 }
2078 2086
2079 2087
2080 void FlowGraphPrinter::VisitNativeLoadField(NativeLoadFieldComp* comp) { 2088 void FlowGraphPrinter::VisitNativeLoadField(NativeLoadFieldComp* comp) {
2081 OS::Print("NativeLoadField("); 2089 OS::Print("NativeLoadField(");
2082 comp->value()->Accept(this); 2090 comp->value()->Accept(this);
2083 OS::Print(", %d)", comp->offset_in_bytes()); 2091 OS::Print(", %d)", comp->offset_in_bytes());
2084 } 2092 }
2085 2093
2086 2094
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 char* chars = reinterpret_cast<char*>( 2327 char* chars = reinterpret_cast<char*>(
2320 Isolate::Current()->current_zone()->Allocate(len)); 2328 Isolate::Current()->current_zone()->Allocate(len));
2321 OS::SNPrint(chars, len, kFormat, function_name, reason); 2329 OS::SNPrint(chars, len, kFormat, function_name, reason);
2322 const Error& error = Error::Handle( 2330 const Error& error = Error::Handle(
2323 LanguageError::New(String::Handle(String::New(chars)))); 2331 LanguageError::New(String::Handle(String::New(chars))));
2324 Isolate::Current()->long_jump_base()->Jump(1, error); 2332 Isolate::Current()->long_jump_base()->Jump(1, error);
2325 } 2333 }
2326 2334
2327 2335
2328 } // namespace dart 2336 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698