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

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

Issue 2700053003: Don't use magic strings/properties to communicate between compiler and runtime. (Closed)
Patch Set: 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
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 2951 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 new js.ObjectInitializer(namedParameters) 2962 new js.ObjectInitializer(namedParameters)
2963 ]; 2963 ];
2964 push(js.js( 2964 push(js.js(
2965 '#(#)', [accessHelper(helpers.buildNamedFunctionType), arguments])); 2965 '#(#)', [accessHelper(helpers.buildNamedFunctionType), arguments]));
2966 } 2966 }
2967 } 2967 }
2968 2968
2969 void visitTypeInfoReadRaw(HTypeInfoReadRaw node) { 2969 void visitTypeInfoReadRaw(HTypeInfoReadRaw node) {
2970 use(node.inputs[0]); 2970 use(node.inputs[0]);
2971 js.Expression receiver = pop(); 2971 js.Expression receiver = pop();
2972 push(js.js(r'#.#', [receiver, backend.namer.rtiFieldName])); 2972 push(js.js(r'#.#', [receiver, backend.namer.rtiFieldJsName]));
2973 } 2973 }
2974 2974
2975 void visitTypeInfoReadVariable(HTypeInfoReadVariable node) { 2975 void visitTypeInfoReadVariable(HTypeInfoReadVariable node) {
2976 TypeVariableEntity element = node.variable.element; 2976 TypeVariableEntity element = node.variable.element;
2977 2977
2978 int index = element.index; 2978 int index = element.index;
2979 HInstruction object = node.object; 2979 HInstruction object = node.object;
2980 use(object); 2980 use(object);
2981 js.Expression receiver = pop(); 2981 js.Expression receiver = pop();
2982 2982
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 registry.registerStaticUse( 3054 registry.registerStaticUse(
3055 new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG)); 3055 new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG));
3056 3056
3057 use(node.inputs[0]); 3057 use(node.inputs[0]);
3058 if (node.hasReceiver) { 3058 if (node.hasReceiver) {
3059 if (backend.interceptorData.isInterceptorClass(element.typeDeclaration)) { 3059 if (backend.interceptorData.isInterceptorClass(element.typeDeclaration)) {
3060 int index = element.index; 3060 int index = element.index;
3061 js.Expression receiver = pop(); 3061 js.Expression receiver = pop();
3062 js.Expression helper = 3062 js.Expression helper =
3063 backend.emitter.staticFunctionAccess(helperElement); 3063 backend.emitter.staticFunctionAccess(helperElement);
3064 js.Expression rtiFieldName = backend.namer.rtiFieldName; 3064 js.Expression rtiFieldName = backend.namer.rtiFieldJsName;
3065 push(js.js(r'#(#.# && #.#[#])', [ 3065 push(js.js(r'#(#.# && #.#[#])', [
3066 helper, 3066 helper,
3067 receiver, 3067 receiver,
3068 rtiFieldName, 3068 rtiFieldName,
3069 receiver, 3069 receiver,
3070 rtiFieldName, 3070 rtiFieldName,
3071 js.js.number(index) 3071 js.js.number(index)
3072 ])); 3072 ]));
3073 } else { 3073 } else {
3074 backend.emitter.registerReadTypeVariable(element); 3074 backend.emitter.registerReadTypeVariable(element);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 registry.registerStaticUse(new StaticUse.staticInvoke( 3116 registry.registerStaticUse(new StaticUse.staticInvoke(
3117 helper, new CallStructure.unnamed(argumentCount))); 3117 helper, new CallStructure.unnamed(argumentCount)));
3118 return backend.emitter.staticFunctionAccess(helper); 3118 return backend.emitter.staticFunctionAccess(helper);
3119 } 3119 }
3120 3120
3121 @override 3121 @override
3122 void visitRef(HRef node) { 3122 void visitRef(HRef node) {
3123 visit(node.value); 3123 visit(node.value);
3124 } 3124 }
3125 } 3125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698