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

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

Issue 2693163002: Split backend implementation of EnqueuerListener (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
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: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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 index++; 400 index++;
401 }); 401 });
402 } 402 }
403 return compiledArguments; 403 return compiledArguments;
404 } 404 }
405 405
406 /** 406 /**
407 * Try to inline [element] within the correct context of the builder. The 407 * Try to inline [element] within the correct context of the builder. The
408 * insertion point is the state of the builder. 408 * insertion point is the state of the builder.
409 */ 409 */
410 bool tryInlineMethod(Element element, Selector selector, TypeMask mask, 410 bool tryInlineMethod(MethodElement element, Selector selector, TypeMask mask,
411 List<HInstruction> providedArguments, ast.Node currentNode, 411 List<HInstruction> providedArguments, ast.Node currentNode,
412 {ResolutionInterfaceType instanceType}) { 412 {ResolutionInterfaceType instanceType}) {
413 registry 413 registry.addImpact(
414 .addImpact(backend.registerUsedElement(element, forResolution: false)); 414 backend.codegenEnqueuerListener.registerUsedElement(element));
415 415
416 if (backend.isJsInterop(element) && !element.isFactoryConstructor) { 416 if (backend.isJsInterop(element) && !element.isFactoryConstructor) {
417 // We only inline factory JavaScript interop constructors. 417 // We only inline factory JavaScript interop constructors.
418 return false; 418 return false;
419 } 419 }
420 420
421 // Ensure that [element] is an implementation element. 421 // Ensure that [element] is an implementation element.
422 element = element.implementation; 422 element = element.implementation;
423 423
424 if (compiler.elementHasCompileTimeError(element)) return false; 424 if (compiler.elementHasCompileTimeError(element)) return false;
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 } 2678 }
2679 push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType)); 2679 push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType));
2680 } 2680 }
2681 2681
2682 void handleForeignJsCurrentIsolateContext(ast.Send node) { 2682 void handleForeignJsCurrentIsolateContext(ast.Send node) {
2683 if (!node.arguments.isEmpty) { 2683 if (!node.arguments.isEmpty) {
2684 reporter.internalError( 2684 reporter.internalError(
2685 node, 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT.'); 2685 node, 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT.');
2686 } 2686 }
2687 2687
2688 if (!backend.hasIsolateSupport) { 2688 if (!backend.backendUsage.isIsolateInUse) {
2689 // If the isolate library is not used, we just generate code 2689 // If the isolate library is not used, we just generate code
2690 // to fetch the static state. 2690 // to fetch the static state.
2691 String name = backend.namer.staticStateHolder; 2691 String name = backend.namer.staticStateHolder;
2692 push(new HForeignCode( 2692 push(new HForeignCode(
2693 js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[], 2693 js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
2694 nativeBehavior: native.NativeBehavior.DEPENDS_OTHER)); 2694 nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
2695 } else { 2695 } else {
2696 // Call a helper method from the isolate library. The isolate 2696 // Call a helper method from the isolate library. The isolate
2697 // library uses its own isolate structure, that encapsulates 2697 // library uses its own isolate structure, that encapsulates
2698 // Leg's isolate. 2698 // Leg's isolate.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2875 } 2875 }
2876 } 2876 }
2877 } 2877 }
2878 reporter.reportErrorMessage( 2878 reporter.reportErrorMessage(
2879 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); 2879 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
2880 stack.add(graph.addConstantNull(closedWorld)); 2880 stack.add(graph.addConstantNull(closedWorld));
2881 } 2881 }
2882 2882
2883 void handleForeignJsCallInIsolate(ast.Send node) { 2883 void handleForeignJsCallInIsolate(ast.Send node) {
2884 Link<ast.Node> link = node.arguments; 2884 Link<ast.Node> link = node.arguments;
2885 if (!backend.hasIsolateSupport) { 2885 if (!backend.backendUsage.isIsolateInUse) {
2886 // If the isolate library is not used, we just invoke the 2886 // If the isolate library is not used, we just invoke the
2887 // closure. 2887 // closure.
2888 visit(link.tail.head); 2888 visit(link.tail.head);
2889 push(new HInvokeClosure(new Selector.callClosure(0), 2889 push(new HInvokeClosure(new Selector.callClosure(0),
2890 <HInstruction>[pop()], commonMasks.dynamicType)); 2890 <HInstruction>[pop()], commonMasks.dynamicType));
2891 } else { 2891 } else {
2892 // Call a helper method from the isolate library. 2892 // Call a helper method from the isolate library.
2893 MethodElement element = helpers.callInIsolate; 2893 MethodElement element = helpers.callInIsolate;
2894 if (element == null) { 2894 if (element == null) {
2895 reporter.internalError(node, 'Isolate library and compiler mismatch.'); 2895 reporter.internalError(node, 'Isolate library and compiler mismatch.');
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 generateSuperNoSuchMethodSend( 3017 generateSuperNoSuchMethodSend(
3018 ast.Send node, Selector selector, List<HInstruction> arguments) { 3018 ast.Send node, Selector selector, List<HInstruction> arguments) {
3019 String name = selector.name; 3019 String name = selector.name;
3020 3020
3021 ClassElement cls = currentNonClosureClass; 3021 ClassElement cls = currentNonClosureClass;
3022 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); 3022 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_);
3023 if (!Selectors.noSuchMethod_.signatureApplies(element)) { 3023 if (!Selectors.noSuchMethod_.signatureApplies(element)) {
3024 ClassElement objectClass = commonElements.objectClass; 3024 ClassElement objectClass = commonElements.objectClass;
3025 element = objectClass.lookupMember(Identifiers.noSuchMethod_); 3025 element = objectClass.lookupMember(Identifiers.noSuchMethod_);
3026 } 3026 }
3027 if (backend.hasInvokeOnSupport && !element.enclosingClass.isObject) { 3027 if (backend.backendUsage.isInvokeOnUsed &&
3028 !element.enclosingClass.isObject) {
3028 // Register the call as dynamic if [noSuchMethod] on the super 3029 // Register the call as dynamic if [noSuchMethod] on the super
3029 // class is _not_ the default implementation from [Object], in 3030 // class is _not_ the default implementation from [Object], in
3030 // case the [noSuchMethod] implementation calls 3031 // case the [noSuchMethod] implementation calls
3031 // [JSInvocationMirror._invokeOn]. 3032 // [JSInvocationMirror._invokeOn].
3032 // TODO(johnniwinther): Register this more precisely. 3033 // TODO(johnniwinther): Register this more precisely.
3033 registry?.registerDynamicUse(new DynamicUse(selector, null)); 3034 registry?.registerDynamicUse(new DynamicUse(selector, null));
3034 } 3035 }
3035 String publicName = name; 3036 String publicName = name;
3036 if (selector.isSetter) publicName += '='; 3037 if (selector.isSetter) publicName += '=';
3037 3038
(...skipping 3693 matching lines...) Expand 10 before | Expand all | Expand 10 after
6731 this.oldReturnLocal, 6732 this.oldReturnLocal,
6732 this.oldReturnType, 6733 this.oldReturnType,
6733 this.oldResolvedAst, 6734 this.oldResolvedAst,
6734 this.oldStack, 6735 this.oldStack,
6735 this.oldLocalsHandler, 6736 this.oldLocalsHandler,
6736 this.inTryStatement, 6737 this.inTryStatement,
6737 this.allFunctionsCalledOnce, 6738 this.allFunctionsCalledOnce,
6738 this.oldElementInferenceResults) 6739 this.oldElementInferenceResults)
6739 : super(function); 6740 : super(function);
6740 } 6741 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698