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

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

Issue 2603263002: Prefix resolution_types with Resolution. (Closed)
Patch Set: Rebased 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
« no previous file with comments | « pkg/compiler/lib/src/native/enqueue.dart ('k') | pkg/compiler/lib/src/ordered_typeset.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) 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 import '../common.dart'; 5 import '../common.dart';
6 import '../compiler.dart' show Compiler; 6 import '../compiler.dart' show Compiler;
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../elements/resolution_types.dart'; 8 import '../elements/resolution_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../js/js.dart' as js; 10 import '../js/js.dart' as js;
11 import '../js_backend/js_backend.dart'; 11 import '../js_backend/js_backend.dart';
12 import '../js_emitter/js_emitter.dart' show NativeEmitter; 12 import '../js_emitter/js_emitter.dart' show NativeEmitter;
13 import '../ssa/builder.dart' show SsaBuilder; 13 import '../ssa/builder.dart' show SsaBuilder;
14 import '../ssa/nodes.dart' show HInstruction, HForeignCode, HReturn; 14 import '../ssa/nodes.dart' show HInstruction, HForeignCode, HReturn;
15 import '../tree/tree.dart'; 15 import '../tree/tree.dart';
16 import '../universe/side_effects.dart' show SideEffects; 16 import '../universe/side_effects.dart' show SideEffects;
17 17
18 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); 18 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$');
19 19
20 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { 20 void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
21 Compiler compiler = builder.compiler; 21 Compiler compiler = builder.compiler;
22 MethodElement element = builder.target; 22 MethodElement element = builder.target;
23 NativeEmitter nativeEmitter = builder.nativeEmitter; 23 NativeEmitter nativeEmitter = builder.nativeEmitter;
24 JavaScriptBackend backend = builder.backend; 24 JavaScriptBackend backend = builder.backend;
25 DiagnosticReporter reporter = compiler.reporter; 25 DiagnosticReporter reporter = compiler.reporter;
26 26
27 HInstruction convertDartClosure( 27 HInstruction convertDartClosure(
28 ParameterElement parameter, FunctionType type) { 28 ParameterElement parameter, ResolutionFunctionType type) {
29 HInstruction local = builder.localsHandler.readLocal(parameter); 29 HInstruction local = builder.localsHandler.readLocal(parameter);
30 ConstantValue arityConstant = 30 ConstantValue arityConstant =
31 builder.constantSystem.createInt(type.computeArity()); 31 builder.constantSystem.createInt(type.computeArity());
32 HInstruction arity = 32 HInstruction arity =
33 builder.graph.addConstant(arityConstant, builder.closedWorld); 33 builder.graph.addConstant(arityConstant, builder.closedWorld);
34 // TODO(ngeoffray): For static methods, we could pass a method with a 34 // TODO(ngeoffray): For static methods, we could pass a method with a
35 // defined arity. 35 // defined arity.
36 Element helper = backend.helpers.closureConverter; 36 Element helper = backend.helpers.closureConverter;
37 builder.pushInvokeStatic(nativeBody, helper, [local, arity]); 37 builder.pushInvokeStatic(nativeBody, helper, [local, arity]);
38 HInstruction closure = builder.pop(); 38 HInstruction closure = builder.pop();
(...skipping 27 matching lines...) Expand all
66 FunctionSignature parameters = element.functionSignature; 66 FunctionSignature parameters = element.functionSignature;
67 if (!hasBody) { 67 if (!hasBody) {
68 List<String> arguments = <String>[]; 68 List<String> arguments = <String>[];
69 List<HInstruction> inputs = <HInstruction>[]; 69 List<HInstruction> inputs = <HInstruction>[];
70 String receiver = ''; 70 String receiver = '';
71 if (element.isInstanceMember) { 71 if (element.isInstanceMember) {
72 receiver = '#.'; 72 receiver = '#.';
73 inputs.add(builder.localsHandler.readThis()); 73 inputs.add(builder.localsHandler.readThis());
74 } 74 }
75 parameters.forEachParameter((ParameterElement parameter) { 75 parameters.forEachParameter((ParameterElement parameter) {
76 DartType type = parameter.type.unaliased; 76 ResolutionDartType type = parameter.type.unaliased;
77 HInstruction input = builder.localsHandler.readLocal(parameter); 77 HInstruction input = builder.localsHandler.readLocal(parameter);
78 if (type is FunctionType) { 78 if (type is ResolutionFunctionType) {
79 // The parameter type is a function type either directly or through 79 // The parameter type is a function type either directly or through
80 // typedef(s). 80 // typedef(s).
81 input = convertDartClosure(parameter, type); 81 input = convertDartClosure(parameter, type);
82 } 82 }
83 inputs.add(input); 83 inputs.add(input);
84 arguments.add('#'); 84 arguments.add('#');
85 }); 85 });
86 86
87 String foreignParameters = arguments.join(','); 87 String foreignParameters = arguments.join(',');
88 String nativeMethodCall; 88 String nativeMethodCall;
(...skipping 30 matching lines...) Expand all
119 LiteralString jsCode = nativeBody.asLiteralString(); 119 LiteralString jsCode = nativeBody.asLiteralString();
120 builder.push(new HForeignCode.statement( 120 builder.push(new HForeignCode.statement(
121 js.js.statementTemplateYielding( 121 js.js.statementTemplateYielding(
122 new js.LiteralStatement(jsCode.dartString.slowToString())), 122 new js.LiteralStatement(jsCode.dartString.slowToString())),
123 <HInstruction>[], 123 <HInstruction>[],
124 new SideEffects(), 124 new SideEffects(),
125 null, 125 null,
126 builder.commonMasks.dynamicType)); 126 builder.commonMasks.dynamicType));
127 } 127 }
128 } 128 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/enqueue.dart ('k') | pkg/compiler/lib/src/ordered_typeset.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698