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

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

Issue 1397043002: Introduce BackendImpact to separate enqueueing from data. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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) 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;
11 FunctionElement element = builder.work.element; 11 FunctionElement element = builder.work.element;
12 NativeEmitter nativeEmitter = builder.nativeEmitter; 12 NativeEmitter nativeEmitter = builder.nativeEmitter;
13 JavaScriptBackend backend = builder.backend; 13 JavaScriptBackend backend = builder.backend;
14 DiagnosticReporter reporter = compiler.reporter; 14 DiagnosticReporter reporter = compiler.reporter;
15 15
16 HInstruction convertDartClosure(ParameterElement parameter, 16 HInstruction convertDartClosure(ParameterElement parameter,
17 FunctionType type) { 17 FunctionType type) {
18 HInstruction local = builder.localsHandler.readLocal(parameter); 18 HInstruction local = builder.localsHandler.readLocal(parameter);
19 ConstantValue arityConstant = 19 ConstantValue arityConstant =
20 builder.constantSystem.createInt(type.computeArity()); 20 builder.constantSystem.createInt(type.computeArity());
21 HInstruction arity = builder.graph.addConstant(arityConstant, compiler); 21 HInstruction arity = builder.graph.addConstant(arityConstant, compiler);
22 // TODO(ngeoffray): For static methods, we could pass a method with a 22 // TODO(ngeoffray): For static methods, we could pass a method with a
23 // defined arity. 23 // defined arity.
24 Element helper = backend.getClosureConverter(); 24 Element helper = backend.helpers.closureConverter;
25 builder.pushInvokeStatic(nativeBody, helper, [local, arity]); 25 builder.pushInvokeStatic(nativeBody, helper, [local, arity]);
26 HInstruction closure = builder.pop(); 26 HInstruction closure = builder.pop();
27 return closure; 27 return closure;
28 } 28 }
29 29
30 // Check which pattern this native method follows: 30 // Check which pattern this native method follows:
31 // 1) foo() native; 31 // 1) foo() native;
32 // hasBody = false 32 // hasBody = false
33 // 2) foo() native "bar"; 33 // 2) foo() native "bar";
34 // No longer supported, this is now done with @JSName('foo') and case 1. 34 // No longer supported, this is now done with @JSName('foo') and case 1.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 LiteralString jsCode = nativeBody.asLiteralString(); 106 LiteralString jsCode = nativeBody.asLiteralString();
107 builder.push(new HForeignCode.statement( 107 builder.push(new HForeignCode.statement(
108 js.js.statementTemplateYielding( 108 js.js.statementTemplateYielding(
109 new js.LiteralStatement(jsCode.dartString.slowToString())), 109 new js.LiteralStatement(jsCode.dartString.slowToString())),
110 <HInstruction>[], 110 <HInstruction>[],
111 new SideEffects(), 111 new SideEffects(),
112 null, 112 null,
113 backend.dynamicType)); 113 backend.dynamicType));
114 } 114 }
115 } 115 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698