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

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

Issue 14672035: Further improve and simplify IL for building constructor type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 7 years, 7 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
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 "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 *instantiator = instantiator_val; 2276 *instantiator = instantiator_val;
2277 } 2277 }
2278 return; 2278 return;
2279 } 2279 }
2280 // The type arguments are uninstantiated. We use expression_temp_var to save 2280 // The type arguments are uninstantiated. We use expression_temp_var to save
2281 // the instantiator type arguments becuase they have two uses. 2281 // the instantiator type arguments becuase they have two uses.
2282 ASSERT(owner()->parsed_function().expression_temp_var() != NULL); 2282 ASSERT(owner()->parsed_function().expression_temp_var() != NULL);
2283 const LocalVariable& temp = *owner()->parsed_function().expression_temp_var(); 2283 const LocalVariable& temp = *owner()->parsed_function().expression_temp_var();
2284 const Class& instantiator_class = Class::Handle( 2284 const Class& instantiator_class = Class::Handle(
2285 owner()->parsed_function().function().Owner()); 2285 owner()->parsed_function().function().Owner());
2286 Value* instantiator_type_arguments = BuildInstantiatorTypeArguments( 2286 Value* type_arguments_val = BuildInstantiatorTypeArguments(
2287 node->token_pos(), instantiator_class, NULL); 2287 node->token_pos(), instantiator_class, NULL);
2288 Value* stored_instantiator =
2289 Bind(BuildStoreTemp(temp, instantiator_type_arguments));
2290 2288
2291 Value* type_arguments_val = Bind( 2289 const bool use_instantiator_type_args =
2292 new ExtractConstructorTypeArgumentsInstr( 2290 node->type_arguments().IsUninstantiatedIdentity() ||
2293 node->token_pos(), 2291 node->type_arguments().CanShareInstantiatorTypeArguments(
2294 node->type_arguments(), 2292 instantiator_class);
2295 instantiator_class, 2293
2296 stored_instantiator)); 2294 if (!use_instantiator_type_args) {
2295 type_arguments_val =
2296 Bind(BuildStoreTemp(temp, type_arguments_val));
2297 type_arguments_val = Bind(
2298 new ExtractConstructorTypeArgumentsInstr(
2299 node->token_pos(),
2300 node->type_arguments(),
2301 instantiator_class,
2302 type_arguments_val));
2303 }
2297 2304
2298 if (call_arguments != NULL) { 2305 if (call_arguments != NULL) {
2299 ASSERT(type_arguments == NULL); 2306 ASSERT(type_arguments == NULL);
2300 call_arguments->Add(PushArgument(type_arguments_val)); 2307 call_arguments->Add(PushArgument(type_arguments_val));
2301 } else { 2308 } else {
2302 ASSERT(type_arguments != NULL); 2309 ASSERT(type_arguments != NULL);
2303 *type_arguments = type_arguments_val; 2310 *type_arguments = type_arguments_val;
2304 } 2311 }
2305 2312
2306 Value* load_instantiator = Bind(BuildLoadLocal(temp)); 2313 Value* instantiator_val = NULL;
2307 Value* instantiator_val = 2314 if (!use_instantiator_type_args) {
2308 Bind(new ExtractConstructorInstantiatorInstr(node, 2315 instantiator_val = Bind(BuildLoadLocal(temp));
2309 instantiator_class, 2316 instantiator_val =
2310 load_instantiator)); 2317 Bind(new ExtractConstructorInstantiatorInstr(node,
2318 instantiator_class,
2319 instantiator_val));
2320 } else {
2321 // No instantiator required.
2322 instantiator_val = Bind(new ConstantInstr(
2323 Smi::ZoneHandle(Smi::New(StubCode::kNoInstantiator))));
2324 }
2311 2325
2312 if (call_arguments != NULL) { 2326 if (call_arguments != NULL) {
2313 ASSERT(instantiator == NULL); 2327 ASSERT(instantiator == NULL);
2314 call_arguments->Add(PushArgument(instantiator_val)); 2328 call_arguments->Add(PushArgument(instantiator_val));
2315 } else { 2329 } else {
2316 ASSERT(instantiator != NULL); 2330 ASSERT(instantiator != NULL);
2317 *instantiator = instantiator_val; 2331 *instantiator = instantiator_val;
2318 } 2332 }
2319 } 2333 }
2320 2334
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
3375 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3389 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3376 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3390 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3377 OS::SNPrint(chars, len, kFormat, function_name, reason); 3391 OS::SNPrint(chars, len, kFormat, function_name, reason);
3378 const Error& error = Error::Handle( 3392 const Error& error = Error::Handle(
3379 LanguageError::New(String::Handle(String::New(chars)))); 3393 LanguageError::New(String::Handle(String::New(chars))));
3380 Isolate::Current()->long_jump_base()->Jump(1, error); 3394 Isolate::Current()->long_jump_base()->Jump(1, error);
3381 } 3395 }
3382 3396
3383 3397
3384 } // namespace dart 3398 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_arm.cc » ('j') | runtime/vm/intermediate_language_arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698