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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2609063002: Further reduce use of Element in codegen. (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
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 import 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:js_runtime/shared/embedded_names.dart'; 7 import 'package:js_runtime/shared/embedded_names.dart';
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 * defines the defaults) is not known. 343 * defines the defaults) is not known.
344 * 344 *
345 * However, inlining can only be performed when the target function can be 345 * However, inlining can only be performed when the target function can be
346 * resolved statically. The defaults can therefore be included at this point. 346 * resolved statically. The defaults can therefore be included at this point.
347 * 347 *
348 * The [providedArguments] list contains first all positional arguments, then 348 * The [providedArguments] list contains first all positional arguments, then
349 * the provided named arguments (the named arguments that are defined in the 349 * the provided named arguments (the named arguments that are defined in the
350 * [selector]) in a specific order (see [addDynamicSendArgumentsToList]). 350 * [selector]) in a specific order (see [addDynamicSendArgumentsToList]).
351 */ 351 */
352 List<HInstruction> completeDynamicSendArgumentsList(Selector selector, 352 List<HInstruction> completeDynamicSendArgumentsList(Selector selector,
353 FunctionElement function, List<HInstruction> providedArguments) { 353 MethodElement function, List<HInstruction> providedArguments) {
354 assert(selector.applies(function)); 354 assert(selector.applies(function));
355 FunctionSignature signature = function.functionSignature; 355 FunctionSignature signature = function.functionSignature;
356 List<HInstruction> compiledArguments = new List<HInstruction>( 356 List<HInstruction> compiledArguments = new List<HInstruction>(
357 signature.parameterCount + 1); // Plus one for receiver. 357 signature.parameterCount + 1); // Plus one for receiver.
358 358
359 compiledArguments[0] = providedArguments[0]; // Receiver. 359 compiledArguments[0] = providedArguments[0]; // Receiver.
360 int index = 1; 360 int index = 1;
361 for (; index <= signature.requiredParameterCount; index++) { 361 for (; index <= signature.requiredParameterCount; index++) {
362 compiledArguments[index] = providedArguments[index]; 362 compiledArguments[index] = providedArguments[index];
363 } 363 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (backend.isJsInterop(element) && !element.isFactoryConstructor) { 416 if (backend.isJsInterop(element) && !element.isFactoryConstructor) {
417 // We only inline factory JavaScript interop constructors. 417 // We only inline factory JavaScript interop constructors.
418 return false; 418 return false;
419 } 419 }
420 420
421 // Ensure that [element] is an implementation element. 421 // Ensure that [element] is an implementation element.
422 element = element.implementation; 422 element = element.implementation;
423 423
424 if (compiler.elementHasCompileTimeError(element)) return false; 424 if (compiler.elementHasCompileTimeError(element)) return false;
425 425
426 FunctionElement function = element; 426 MethodElement function = element;
427 ResolvedAst functionResolvedAst = function.resolvedAst; 427 ResolvedAst functionResolvedAst = function.resolvedAst;
428 bool insideLoop = loopDepth > 0 || graph.calledInLoop; 428 bool insideLoop = loopDepth > 0 || graph.calledInLoop;
429 429
430 // Bail out early if the inlining decision is in the cache and we can't 430 // Bail out early if the inlining decision is in the cache and we can't
431 // inline (no need to check the hard constraints). 431 // inline (no need to check the hard constraints).
432 bool cachedCanBeInlined = 432 bool cachedCanBeInlined =
433 backend.inlineCache.canInline(function, insideLoop: insideLoop); 433 backend.inlineCache.canInline(function, insideLoop: insideLoop);
434 if (cachedCanBeInlined == false) return false; 434 if (cachedCanBeInlined == false) return false;
435 435
436 bool meetsHardConstraints() { 436 bool meetsHardConstraints() {
(...skipping 6317 matching lines...) Expand 10 before | Expand all | Expand 10 after
6754 this.oldReturnLocal, 6754 this.oldReturnLocal,
6755 this.oldReturnType, 6755 this.oldReturnType,
6756 this.oldResolvedAst, 6756 this.oldResolvedAst,
6757 this.oldStack, 6757 this.oldStack,
6758 this.oldLocalsHandler, 6758 this.oldLocalsHandler,
6759 this.inTryStatement, 6759 this.inTryStatement,
6760 this.allFunctionsCalledOnce, 6760 this.allFunctionsCalledOnce,
6761 this.oldElementInferenceResults) 6761 this.oldElementInferenceResults)
6762 : super(function); 6762 : super(function);
6763 } 6763 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698