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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 12299006: Start tracking all registered elements in one big full function set (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Register fields. Created 7 years, 10 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 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 HInstruction visitInvokeStatic(HInvokeStatic node) { 382 HInstruction visitInvokeStatic(HInvokeStatic node) {
383 if (isFixedSizeListConstructor(node)) { 383 if (isFixedSizeListConstructor(node)) {
384 node.guaranteedType = HType.FIXED_ARRAY; 384 node.guaranteedType = HType.FIXED_ARRAY;
385 } 385 }
386 return node; 386 return node;
387 } 387 }
388 388
389 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) { 389 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
390 if (node.isInterceptorCall) return handleInterceptorCall(node); 390 if (node.isInterceptorCall) return handleInterceptorCall(node);
391 HType receiverType = types[node.receiver]; 391 HType receiverType = types[node.receiver];
392 Element element = receiverType.lookupSingleTarget(node.selector, compiler); 392 Selector selector = receiverType.refine(node.selector, compiler);
393 Element element = compiler.world.locateSingleElement(selector);
393 // TODO(ngeoffray): Also fold if it's a getter or variable. 394 // TODO(ngeoffray): Also fold if it's a getter or variable.
394 if (element != null && element.isFunction()) { 395 if (element != null && element.isFunction()) {
395 FunctionElement method = element; 396 FunctionElement method = element;
396 FunctionSignature parameters = method.computeSignature(compiler); 397 FunctionSignature parameters = method.computeSignature(compiler);
397 // TODO(ngeoffray): If the method has optional parameters, 398 // TODO(ngeoffray): If the method has optional parameters,
398 // we should pass the default values. 399 // we should pass the default values.
399 if (parameters.optionalParameterCount == 0 400 if (parameters.optionalParameterCount == 0
400 || parameters.parameterCount == node.selector.argumentCount) { 401 || parameters.parameterCount == node.selector.argumentCount) {
401 node.element = element; 402 node.element = element;
402 } 403 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 if (types[value].canBeNull() && node.isBooleanConversionCheck) { 593 if (types[value].canBeNull() && node.isBooleanConversionCheck) {
593 return node; 594 return node;
594 } 595 }
595 HType combinedType = types[value].intersection(types[node], compiler); 596 HType combinedType = types[value].intersection(types[node], compiler);
596 return (combinedType == types[value]) ? value : node; 597 return (combinedType == types[value]) ? value : node;
597 } 598 }
598 599
599 Element findConcreteFieldForDynamicAccess(HInstruction receiver, 600 Element findConcreteFieldForDynamicAccess(HInstruction receiver,
600 Selector selector) { 601 Selector selector) {
601 HType receiverType = types[receiver]; 602 HType receiverType = types[receiver];
602 if (!receiverType.isUseful()) return null; 603 return compiler.world.locateSingleField(
603 DartType type = receiverType.computeType(compiler); 604 receiverType.refine(selector, compiler));
604 if (type == null) return null;
605 if (Elements.isErroneousElement(type.element)) return null;
606 return compiler.world.locateSingleField(type, selector);
607 } 605 }
608 606
609 HInstruction visitFieldGet(HFieldGet node) { 607 HInstruction visitFieldGet(HFieldGet node) {
610 if (node.element == backend.jsArrayLength) { 608 if (node.element == backend.jsArrayLength) {
611 if (node.receiver is HInvokeStatic) { 609 if (node.receiver is HInvokeStatic) {
612 // Try to recognize the length getter with input 610 // Try to recognize the length getter with input
613 // [:new List.fixedLength(int):]. 611 // [:new List.fixedLength(int):].
614 HInvokeStatic call = node.receiver; 612 HInvokeStatic call = node.receiver;
615 if (isFixedSizeListConstructor(call)) { 613 if (isFixedSizeListConstructor(call)) {
616 return call.inputs[1]; 614 return call.inputs[1];
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 HBasicBlock block = user.block; 1543 HBasicBlock block = user.block;
1546 block.addAfter(user, interceptor); 1544 block.addAfter(user, interceptor);
1547 block.rewrite(user, interceptor); 1545 block.rewrite(user, interceptor);
1548 block.remove(user); 1546 block.remove(user);
1549 1547
1550 // The interceptor will be removed in the dead code elimination 1548 // The interceptor will be removed in the dead code elimination
1551 // phase. Note that removing it here would not work because of how 1549 // phase. Note that removing it here would not work because of how
1552 // the [visitBasicBlock] is implemented. 1550 // the [visitBasicBlock] is implemented.
1553 } 1551 }
1554 } 1552 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698