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

Side by Side Diff: frog/leg/ssa/codegen.dart

Issue 9193016: Add the arity to calls, and support noSuchMethodException. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 | Annotate | Revision Log
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/leg/universe.dart » ('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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 String generate(WorkItem work, HGraph graph) { 9 String generate(WorkItem work, HGraph graph) {
10 return measure(() { 10 return measure(() {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 assert(dominatedCount == 3); 402 assert(dominatedCount == 3);
403 assert(dominated.last().isExitBlock()); 403 assert(dominated.last().isExitBlock());
404 visitBasicBlock(dominated[1]); 404 visitBasicBlock(dominated[1]);
405 visitBasicBlock(dominated[2]); 405 visitBasicBlock(dominated[2]);
406 } 406 }
407 } 407 }
408 408
409 visitInvokeDynamicMethod(HInvokeDynamicMethod node) { 409 visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
410 use(node.receiver); 410 use(node.receiver);
411 buffer.add('.'); 411 buffer.add('.');
412 buffer.add(compiler.namer.instanceName(node.name)); 412 // Remove 'this' from the number of arguments.
413 int argumentCount = node.inputs.length - 1;
414 buffer.add(compiler.namer.instanceMethodName(node.name, argumentCount));
413 visitArguments(node.inputs); 415 visitArguments(node.inputs);
414 compiler.registerDynamicInvocation(node.name); 416 // Avoid adding the generative constructor name to the list of
417 // seen selectors.
418 if (node.inputs[0] is !HForeignNew) {
419 compiler.registerDynamicInvocation(node.name, argumentCount);
420 }
415 } 421 }
416 422
417 visitInvokeDynamicSetter(HInvokeDynamicSetter node) { 423 visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
418 use(node.receiver); 424 use(node.receiver);
419 buffer.add('.'); 425 buffer.add('.');
420 buffer.add(compiler.namer.setterName(node.name)); 426 buffer.add(compiler.namer.setterName(node.name));
421 visitArguments(node.inputs); 427 visitArguments(node.inputs);
422 compiler.registerDynamicSetter(node.name); 428 compiler.registerDynamicSetter(node.name);
423 } 429 }
424 430
425 visitInvokeDynamicGetter(HInvokeDynamicGetter node) { 431 visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
426 use(node.receiver); 432 use(node.receiver);
427 buffer.add('.'); 433 buffer.add('.');
428 buffer.add(compiler.namer.getterName(node.name)); 434 buffer.add(compiler.namer.getterName(node.name));
429 visitArguments(node.inputs); 435 visitArguments(node.inputs);
430 compiler.registerDynamicGetter(node.name); 436 compiler.registerDynamicGetter(node.name);
431 } 437 }
432 438
433 visitInvokeClosure(HInvokeClosure node) { 439 visitInvokeClosure(HInvokeClosure node) {
434 use(node.receiver); 440 use(node.receiver);
435 buffer.add('.'); 441 buffer.add('.');
436 buffer.add(compiler.namer.closureInvocationName()); 442 buffer.add(compiler.namer.closureInvocationName(node.inputs.length - 1));
437 visitArguments(node.inputs); 443 visitArguments(node.inputs);
438 } 444 }
439 445
440 visitInvokeStatic(HInvokeStatic node) { 446 visitInvokeStatic(HInvokeStatic node) {
441 use(node.target); 447 use(node.target);
442 visitArguments(node.inputs); 448 visitArguments(node.inputs);
443 } 449 }
444 450
445 visitInvokeSuper(HInvokeSuper node) { 451 visitInvokeSuper(HInvokeSuper node) {
446 Element superMethod = node.element; 452 Element superMethod = node.element;
447 Element superClass = superMethod.enclosingElement; 453 Element superClass = superMethod.enclosingElement;
454 // Remove the element and 'this'.
455 int argumentCount = node.inputs.length - 2;
448 String className = compiler.namer.isolatePropertyAccess(superClass); 456 String className = compiler.namer.isolatePropertyAccess(superClass);
449 String methodName = compiler.namer.instanceName(superMethod.name); 457 String methodName = compiler.namer.instanceMethodName(
458 superMethod.name, argumentCount);
450 buffer.add('$className.prototype.$methodName.call'); 459 buffer.add('$className.prototype.$methodName.call');
451 visitArguments(node.inputs); 460 visitArguments(node.inputs);
452 } 461 }
453 462
454 visitForeign(HForeign node) { 463 visitForeign(HForeign node) {
455 String code = '${node.code}'; 464 String code = '${node.code}';
456 List<HInstruction> inputs = node.inputs; 465 List<HInstruction> inputs = node.inputs;
457 for (int i = 0; i < inputs.length; i++) { 466 for (int i = 0; i < inputs.length; i++) {
458 HInstruction input = inputs[i]; 467 HInstruction input = inputs[i];
459 String name; 468 String name;
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 startBailoutSwitch(); 1030 startBailoutSwitch();
1022 } 1031 }
1023 } 1032 }
1024 1033
1025 void endElse(HIf node) { 1034 void endElse(HIf node) {
1026 if (node.elseBlock.hasBailouts()) { 1035 if (node.elseBlock.hasBailouts()) {
1027 endBailoutSwitch(); 1036 endBailoutSwitch();
1028 } 1037 }
1029 } 1038 }
1030 } 1039 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/leg/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698