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

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

Issue 1154073004: Change more JS foreign methods to JS_GET_NAME. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 SsaCodeGeneratorTask generator; 8 SsaCodeGeneratorTask generator;
9 SsaBuilderTask builder; 9 SsaBuilderTask builder;
10 SsaOptimizerTask optimizer; 10 SsaOptimizerTask optimizer;
(...skipping 4240 matching lines...) Expand 10 before | Expand all | Expand 10 after
4251 } else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') { 4251 } else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') {
4252 handleForeignJsCurrentIsolateContext(node); 4252 handleForeignJsCurrentIsolateContext(node);
4253 } else if (name == 'JS_CALL_IN_ISOLATE') { 4253 } else if (name == 'JS_CALL_IN_ISOLATE') {
4254 handleForeignJsCallInIsolate(node); 4254 handleForeignJsCallInIsolate(node);
4255 } else if (name == 'DART_CLOSURE_TO_JS') { 4255 } else if (name == 'DART_CLOSURE_TO_JS') {
4256 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); 4256 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS');
4257 } else if (name == 'RAW_DART_FUNCTION_REF') { 4257 } else if (name == 'RAW_DART_FUNCTION_REF') {
4258 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); 4258 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF');
4259 } else if (name == 'JS_SET_CURRENT_ISOLATE') { 4259 } else if (name == 'JS_SET_CURRENT_ISOLATE') {
4260 handleForeignSetCurrentIsolate(node); 4260 handleForeignSetCurrentIsolate(node);
4261 } else if (name == 'JS_OPERATOR_AS_PREFIX') {
4262 // TODO(floitsch): this should be a JS_NAME.
4263 stack.add(addConstantString(backend.namer.operatorAsPrefix));
4264 } else if (name == 'JS_SIGNATURE_NAME') {
4265 // TODO(floitsch): this should be a JS_NAME.
4266 stack.add(addConstantString(backend.namer.operatorSignature));
4267 } else if (name == 'JS_TYPEDEF_TAG') {
4268 // TODO(floitsch): this should be a JS_NAME.
4269 stack.add(addConstantString(backend.namer.typedefTag));
4270 } else if (name == 'JS_FUNCTION_TYPE_VOID_RETURN_TAG') {
4271 // TODO(floitsch): this should be a JS_NAME.
4272 stack.add(addConstantString(backend.namer.functionTypeVoidReturnTag));
4273 } else if (name == 'JS_FUNCTION_TYPE_RETURN_TYPE_TAG') {
4274 // TODO(floitsch): this should be a JS_NAME.
4275 stack.add(addConstantString(backend.namer.functionTypeReturnTypeTag));
4276 } else if (name ==
4277 'JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG') {
4278 // TODO(floitsch): this should be a JS_NAME.
4279 stack.add(addConstantString(
4280 backend.namer.functionTypeRequiredParametersTag));
4281 } else if (name ==
4282 'JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG') {
4283 // TODO(floitsch): this should be a JS_NAME.
4284 stack.add(addConstantString(
4285 backend.namer.functionTypeOptionalParametersTag));
4286 } else if (name ==
4287 'JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG') {
4288 // TODO(floitsch): this should be a JS_NAME.
4289 stack.add(addConstantString(
4290 backend.namer.functionTypeNamedParametersTag));
4291 } else if (name == 'JS_IS_INDEXABLE_FIELD_NAME') { 4261 } else if (name == 'JS_IS_INDEXABLE_FIELD_NAME') {
4292 // TODO(floitsch): this should be a JS_NAME. 4262 // TODO(floitsch): this should be a JS_NAME.
4293 Element element = backend.findHelper('JavaScriptIndexingBehavior'); 4263 Element element = backend.findHelper('JavaScriptIndexingBehavior');
4294 stack.add(addConstantString(backend.namer.operatorIs(element))); 4264 stack.add(addConstantString(backend.namer.operatorIs(element)));
4295 } else if (name == 'JS_CURRENT_ISOLATE') { 4265 } else if (name == 'JS_CURRENT_ISOLATE') {
4296 handleForeignJsCurrentIsolate(node); 4266 handleForeignJsCurrentIsolate(node);
4297 } else if (name == 'JS_GET_NAME') { 4267 } else if (name == 'JS_GET_NAME') {
4298 handleForeignJsGetName(node); 4268 handleForeignJsGetName(node);
4299 } else if (name == 'JS_EMBEDDED_GLOBAL') { 4269 } else if (name == 'JS_EMBEDDED_GLOBAL') {
4300 handleForeignJsEmbeddedGlobal(node); 4270 handleForeignJsEmbeddedGlobal(node);
4301 } else if (name == 'JS_BUILTIN') { 4271 } else if (name == 'JS_BUILTIN') {
4302 handleForeignJsBuiltin(node); 4272 handleForeignJsBuiltin(node);
4303 } else if (name == 'JS_GET_FLAG') { 4273 } else if (name == 'JS_GET_FLAG') {
4304 handleForeingJsGetFlag(node); 4274 handleForeingJsGetFlag(node);
4305 } else if (name == 'JS_EFFECT') { 4275 } else if (name == 'JS_EFFECT') {
4306 stack.add(graph.addConstantNull(compiler)); 4276 stack.add(graph.addConstantNull(compiler));
4307 } else if (name == 'JS_INTERCEPTOR_CONSTANT') { 4277 } else if (name == 'JS_INTERCEPTOR_CONSTANT') {
4308 handleJsInterceptorConstant(node); 4278 handleJsInterceptorConstant(node);
4309 } else if (name == 'JS_STRING_CONCAT') { 4279 } else if (name == 'JS_STRING_CONCAT') {
4310 handleJsStringConcat(node); 4280 handleJsStringConcat(node);
4311 } else { 4281 } else {
4312 throw "Unknown foreign: ${element}"; 4282 compiler.internalError(node, "Unknown foreign: ${element}");
4313 } 4283 }
4314 } 4284 }
4315 4285
4316 generateDeferredLoaderGet(ast.Send node, FunctionElement deferredLoader) { 4286 generateDeferredLoaderGet(ast.Send node, FunctionElement deferredLoader) {
4317 // Until now we only handle these as getters. 4287 // Until now we only handle these as getters.
4318 invariant(node, deferredLoader.isDeferredLoaderGetter); 4288 invariant(node, deferredLoader.isDeferredLoaderGetter);
4319 Element loadFunction = compiler.loadLibraryFunction; 4289 Element loadFunction = compiler.loadLibraryFunction;
4320 PrefixElement prefixElement = deferredLoader.enclosingElement; 4290 PrefixElement prefixElement = deferredLoader.enclosingElement;
4321 String loadId = compiler.deferredLoadTask 4291 String loadId = compiler.deferredLoadTask
4322 .importDeferName[prefixElement.deferredImport]; 4292 .importDeferName[prefixElement.deferredImport];
(...skipping 3529 matching lines...) Expand 10 before | Expand all | Expand 10 after
7852 if (unaliased is TypedefType) throw 'unable to unalias $type'; 7822 if (unaliased is TypedefType) throw 'unable to unalias $type';
7853 unaliased.accept(this, builder); 7823 unaliased.accept(this, builder);
7854 } 7824 }
7855 7825
7856 void visitDynamicType(DynamicType type, SsaBuilder builder) { 7826 void visitDynamicType(DynamicType type, SsaBuilder builder) {
7857 JavaScriptBackend backend = builder.compiler.backend; 7827 JavaScriptBackend backend = builder.compiler.backend;
7858 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 7828 ClassElement cls = backend.findHelper('DynamicRuntimeType');
7859 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 7829 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
7860 } 7830 }
7861 } 7831 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698