| OLD | NEW |
| 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:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3057 if (!node.arguments.isEmpty) { | 3057 if (!node.arguments.isEmpty) { |
| 3058 reporter.internalError(node.argumentsNode, 'Too many arguments.'); | 3058 reporter.internalError(node.argumentsNode, 'Too many arguments.'); |
| 3059 } | 3059 } |
| 3060 push(new HForeignCode(js.js.parseForeignJS(backend.namer.staticStateHolder), | 3060 push(new HForeignCode(js.js.parseForeignJS(backend.namer.staticStateHolder), |
| 3061 backend.dynamicType, <HInstruction>[], | 3061 backend.dynamicType, <HInstruction>[], |
| 3062 nativeBehavior: native.NativeBehavior.DEPENDS_OTHER)); | 3062 nativeBehavior: native.NativeBehavior.DEPENDS_OTHER)); |
| 3063 } | 3063 } |
| 3064 | 3064 |
| 3065 void handleForeignSend(ast.Send node, FunctionElement element) { | 3065 void handleForeignSend(ast.Send node, FunctionElement element) { |
| 3066 String name = element.name; | 3066 String name = element.name; |
| 3067 if (name == 'JS') { | 3067 if (name == BackendHelpers.JS) { |
| 3068 handleForeignJs(node); | 3068 handleForeignJs(node); |
| 3069 } else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') { | 3069 } else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') { |
| 3070 handleForeignJsCurrentIsolateContext(node); | 3070 handleForeignJsCurrentIsolateContext(node); |
| 3071 } else if (name == 'JS_CALL_IN_ISOLATE') { | 3071 } else if (name == 'JS_CALL_IN_ISOLATE') { |
| 3072 handleForeignJsCallInIsolate(node); | 3072 handleForeignJsCallInIsolate(node); |
| 3073 } else if (name == 'DART_CLOSURE_TO_JS') { | 3073 } else if (name == 'DART_CLOSURE_TO_JS') { |
| 3074 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); | 3074 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); |
| 3075 } else if (name == 'RAW_DART_FUNCTION_REF') { | 3075 } else if (name == 'RAW_DART_FUNCTION_REF') { |
| 3076 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); | 3076 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); |
| 3077 } else if (name == 'JS_SET_STATIC_STATE') { | 3077 } else if (name == 'JS_SET_STATIC_STATE') { |
| 3078 handleForeignJsSetStaticState(node); | 3078 handleForeignJsSetStaticState(node); |
| 3079 } else if (name == 'JS_GET_STATIC_STATE') { | 3079 } else if (name == 'JS_GET_STATIC_STATE') { |
| 3080 handleForeignJsGetStaticState(node); | 3080 handleForeignJsGetStaticState(node); |
| 3081 } else if (name == 'JS_GET_NAME') { | 3081 } else if (name == 'JS_GET_NAME') { |
| 3082 handleForeignJsGetName(node); | 3082 handleForeignJsGetName(node); |
| 3083 } else if (name == 'JS_EMBEDDED_GLOBAL') { | 3083 } else if (name == BackendHelpers.JS_EMBEDDED_GLOBAL) { |
| 3084 handleForeignJsEmbeddedGlobal(node); | 3084 handleForeignJsEmbeddedGlobal(node); |
| 3085 } else if (name == 'JS_BUILTIN') { | 3085 } else if (name == BackendHelpers.JS_BUILTIN) { |
| 3086 handleForeignJsBuiltin(node); | 3086 handleForeignJsBuiltin(node); |
| 3087 } else if (name == 'JS_GET_FLAG') { | 3087 } else if (name == 'JS_GET_FLAG') { |
| 3088 handleForeignJsGetFlag(node); | 3088 handleForeignJsGetFlag(node); |
| 3089 } else if (name == 'JS_EFFECT') { | 3089 } else if (name == 'JS_EFFECT') { |
| 3090 stack.add(graph.addConstantNull(compiler)); | 3090 stack.add(graph.addConstantNull(compiler)); |
| 3091 } else if (name == 'JS_INTERCEPTOR_CONSTANT') { | 3091 } else if (name == BackendHelpers.JS_INTERCEPTOR_CONSTANT) { |
| 3092 handleJsInterceptorConstant(node); | 3092 handleJsInterceptorConstant(node); |
| 3093 } else if (name == 'JS_STRING_CONCAT') { | 3093 } else if (name == 'JS_STRING_CONCAT') { |
| 3094 handleJsStringConcat(node); | 3094 handleJsStringConcat(node); |
| 3095 } else { | 3095 } else { |
| 3096 reporter.internalError(node, "Unknown foreign: ${element}"); | 3096 reporter.internalError(node, "Unknown foreign: ${element}"); |
| 3097 } | 3097 } |
| 3098 } | 3098 } |
| 3099 | 3099 |
| 3100 generateDeferredLoaderGet(ast.Send node, FunctionElement deferredLoader, | 3100 generateDeferredLoaderGet(ast.Send node, FunctionElement deferredLoader, |
| 3101 SourceInformation sourceInformation) { | 3101 SourceInformation sourceInformation) { |
| (...skipping 3944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7046 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 7046 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 7047 unaliased.accept(this, builder); | 7047 unaliased.accept(this, builder); |
| 7048 } | 7048 } |
| 7049 | 7049 |
| 7050 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 7050 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 7051 JavaScriptBackend backend = builder.compiler.backend; | 7051 JavaScriptBackend backend = builder.compiler.backend; |
| 7052 ClassElement cls = backend.helpers.DynamicRuntimeType; | 7052 ClassElement cls = backend.helpers.DynamicRuntimeType; |
| 7053 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); | 7053 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); |
| 7054 } | 7054 } |
| 7055 } | 7055 } |
| OLD | NEW |