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

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

Issue 1020853003: Split HForeign into HForeignCode and abstract base class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Formatting Created 5 years, 9 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 native; 5 part of native;
6 6
7 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); 7 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$');
8 8
9 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { 9 void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
10 Compiler compiler = builder.compiler; 10 Compiler compiler = builder.compiler;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } else if (element.kind == ElementKind.GETTER) { 78 } else if (element.kind == ElementKind.GETTER) {
79 nativeMethodCall = '$receiver$nativeMethodName'; 79 nativeMethodCall = '$receiver$nativeMethodName';
80 } else if (element.kind == ElementKind.SETTER) { 80 } else if (element.kind == ElementKind.SETTER) {
81 nativeMethodCall = '$receiver$nativeMethodName = $foreignParameters'; 81 nativeMethodCall = '$receiver$nativeMethodName = $foreignParameters';
82 } else { 82 } else {
83 builder.compiler.internalError(element, 83 builder.compiler.internalError(element,
84 'Unexpected kind: "${element.kind}".'); 84 'Unexpected kind: "${element.kind}".');
85 } 85 }
86 86
87 builder.push( 87 builder.push(
88 new HForeign( 88 new HForeignCode(
89 // TODO(sra): This could be cached. The number of templates should 89 // TODO(sra): This could be cached. The number of templates should
90 // be proportional to the number of native methods, which is bounded 90 // be proportional to the number of native methods, which is bounded
91 // by the dart: libraries. 91 // by the dart: libraries.
92 js.js.uncachedExpressionTemplate(nativeMethodCall), 92 js.js.uncachedExpressionTemplate(nativeMethodCall),
93 backend.dynamicType, 93 backend.dynamicType,
94 inputs, effects: new SideEffects())); 94 inputs, effects: new SideEffects()));
95 builder.close(new HReturn(builder.pop())).addSuccessor(builder.graph.exit); 95 builder.close(new HReturn(builder.pop())).addSuccessor(builder.graph.exit);
96 } else { 96 } else {
97 if (parameters.parameterCount != 0) { 97 if (parameters.parameterCount != 0) {
98 compiler.internalError(nativeBody, 98 compiler.internalError(nativeBody,
99 'native "..." syntax is restricted to ' 99 'native "..." syntax is restricted to '
100 'functions with zero parameters.'); 100 'functions with zero parameters.');
101 } 101 }
102 LiteralString jsCode = nativeBody.asLiteralString(); 102 LiteralString jsCode = nativeBody.asLiteralString();
103 builder.push(new HForeign.statement( 103 builder.push(new HForeignCode.statement(
104 js.js.statementTemplateYielding( 104 js.js.statementTemplateYielding(
105 new js.LiteralStatement(jsCode.dartString.slowToString())), 105 new js.LiteralStatement(jsCode.dartString.slowToString())),
106 <HInstruction>[], 106 <HInstruction>[],
107 new SideEffects(), 107 new SideEffects(),
108 null, 108 null,
109 backend.dynamicType)); 109 backend.dynamicType));
110 } 110 }
111 } 111 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | pkg/compiler/lib/src/ssa/nodes.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698