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

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

Issue 2680823002: Extract InterceptorData from JavaScriptBackend. (Closed)
Patch Set: Updated cf. comments Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/codegen_helpers.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 import 'dart:math' as math; 5 import 'dart:math' as math;
6 import '../common.dart'; 6 import '../common.dart';
7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
8 import '../common/tasks.dart' show CompilerTask; 8 import '../common/tasks.dart' show CompilerTask;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constant_system.dart'; 10 import '../constants/constant_system.dart';
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 .withSourceInformation(node.sourceInformation)); 1697 .withSourceInformation(node.sourceInformation));
1698 registry.registerStaticUse(new StaticUse.constructorBodyInvoke( 1698 registry.registerStaticUse(new StaticUse.constructorBodyInvoke(
1699 node.element, new CallStructure.unnamed(arguments.length))); 1699 node.element, new CallStructure.unnamed(arguments.length)));
1700 } 1700 }
1701 1701
1702 void visitOneShotInterceptor(HOneShotInterceptor node) { 1702 void visitOneShotInterceptor(HOneShotInterceptor node) {
1703 List<js.Expression> arguments = visitArguments(node.inputs); 1703 List<js.Expression> arguments = visitArguments(node.inputs);
1704 var isolate = new js.VariableUse( 1704 var isolate = new js.VariableUse(
1705 backend.namer.globalObjectForLibrary(helpers.interceptorsLibrary)); 1705 backend.namer.globalObjectForLibrary(helpers.interceptorsLibrary));
1706 Selector selector = node.selector; 1706 Selector selector = node.selector;
1707 js.Name methodName = backend.registerOneShotInterceptor(selector); 1707 js.Name methodName = backend.interceptorData
1708 .registerOneShotInterceptor(selector, backend.namer);
1708 push(js 1709 push(js
1709 .propertyCall(isolate, methodName, arguments) 1710 .propertyCall(isolate, methodName, arguments)
1710 .withSourceInformation(node.sourceInformation)); 1711 .withSourceInformation(node.sourceInformation));
1711 if (selector.isGetter) { 1712 if (selector.isGetter) {
1712 registerGetter(node); 1713 registerGetter(node);
1713 } else if (selector.isSetter) { 1714 } else if (selector.isSetter) {
1714 registerSetter(node); 1715 registerSetter(node);
1715 } else { 1716 } else {
1716 registerMethodInvoke(node); 1717 registerMethodInvoke(node);
1717 } 1718 }
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 } 3049 }
3049 3050
3050 void visitReadTypeVariable(HReadTypeVariable node) { 3051 void visitReadTypeVariable(HReadTypeVariable node) {
3051 TypeVariableEntity element = node.dartType.element; 3052 TypeVariableEntity element = node.dartType.element;
3052 FunctionEntity helperElement = helpers.convertRtiToRuntimeType; 3053 FunctionEntity helperElement = helpers.convertRtiToRuntimeType;
3053 registry.registerStaticUse( 3054 registry.registerStaticUse(
3054 new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG)); 3055 new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG));
3055 3056
3056 use(node.inputs[0]); 3057 use(node.inputs[0]);
3057 if (node.hasReceiver) { 3058 if (node.hasReceiver) {
3058 if (backend.isInterceptorClass(element.typeDeclaration)) { 3059 if (backend.interceptorData.isInterceptorClass(element.typeDeclaration)) {
3059 int index = element.index; 3060 int index = element.index;
3060 js.Expression receiver = pop(); 3061 js.Expression receiver = pop();
3061 js.Expression helper = 3062 js.Expression helper =
3062 backend.emitter.staticFunctionAccess(helperElement); 3063 backend.emitter.staticFunctionAccess(helperElement);
3063 js.Expression rtiFieldName = backend.namer.rtiFieldName; 3064 js.Expression rtiFieldName = backend.namer.rtiFieldName;
3064 push(js.js(r'#(#.# && #.#[#])', [ 3065 push(js.js(r'#(#.# && #.#[#])', [
3065 helper, 3066 helper,
3066 receiver, 3067 receiver,
3067 rtiFieldName, 3068 rtiFieldName,
3068 receiver, 3069 receiver,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 registry.registerStaticUse(new StaticUse.staticInvoke( 3116 registry.registerStaticUse(new StaticUse.staticInvoke(
3116 helper, new CallStructure.unnamed(argumentCount))); 3117 helper, new CallStructure.unnamed(argumentCount)));
3117 return backend.emitter.staticFunctionAccess(helper); 3118 return backend.emitter.staticFunctionAccess(helper);
3118 } 3119 }
3119 3120
3120 @override 3121 @override
3121 void visitRef(HRef node) { 3122 void visitRef(HRef node) {
3122 visit(node.value); 3123 visit(node.value);
3123 } 3124 }
3124 } 3125 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/codegen_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698