| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
| 8 show JsBuiltin, JsGetName; | 8 show JsBuiltin, JsGetName; |
| 9 | 9 |
| 10 import '../closure.dart' as closure; | 10 import '../closure.dart' as closure; |
| (...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2738 rhs, | 2738 rhs, |
| 2739 (ir.Primitive result) { | 2739 (ir.Primitive result) { |
| 2740 irBuilder.buildDynamicSet( | 2740 irBuilder.buildDynamicSet( |
| 2741 target, | 2741 target, |
| 2742 new Selector.setter(name), | 2742 new Selector.setter(name), |
| 2743 elements.getTypeMask(node), | 2743 elements.getTypeMask(node), |
| 2744 result, | 2744 result, |
| 2745 sourceInformationBuilder.buildAssignment(node)); | 2745 sourceInformationBuilder.buildAssignment(node)); |
| 2746 }); | 2746 }); |
| 2747 } | 2747 } |
| 2748 |
| 2748 return node.isConditional | 2749 return node.isConditional |
| 2749 ? irBuilder.buildIfNotNullSend( | 2750 ? irBuilder.buildIfNotNullSend( |
| 2750 target, nested(helper), sourceInformationBuilder.buildIf(node)) | 2751 target, nested(helper), sourceInformationBuilder.buildIf(node)) |
| 2751 : helper(); | 2752 : helper(); |
| 2752 } | 2753 } |
| 2753 | 2754 |
| 2754 @override | 2755 @override |
| 2755 ir.Primitive handleDynamicSetIfNulls( | 2756 ir.Primitive handleDynamicSetIfNulls( |
| 2756 ast.Send node, ast.Node receiver, Name name, ast.Node rhs, _) { | 2757 ast.Send node, ast.Node receiver, Name name, ast.Node rhs, _) { |
| 2757 ir.Primitive target = translateReceiver(receiver); | 2758 ir.Primitive target = translateReceiver(receiver); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2768 rhs, | 2769 rhs, |
| 2769 (ir.Primitive result) { | 2770 (ir.Primitive result) { |
| 2770 irBuilder.buildDynamicSet( | 2771 irBuilder.buildDynamicSet( |
| 2771 target, | 2772 target, |
| 2772 new Selector.setter(name), | 2773 new Selector.setter(name), |
| 2773 elements.getTypeMask(node), | 2774 elements.getTypeMask(node), |
| 2774 result, | 2775 result, |
| 2775 sourceInformationBuilder.buildAssignment(node)); | 2776 sourceInformationBuilder.buildAssignment(node)); |
| 2776 }); | 2777 }); |
| 2777 } | 2778 } |
| 2779 |
| 2778 return node.isConditional | 2780 return node.isConditional |
| 2779 ? irBuilder.buildIfNotNullSend( | 2781 ? irBuilder.buildIfNotNullSend( |
| 2780 target, nested(helper), sourceInformationBuilder.buildIf(node)) | 2782 target, nested(helper), sourceInformationBuilder.buildIf(node)) |
| 2781 : helper(); | 2783 : helper(); |
| 2782 } | 2784 } |
| 2783 | 2785 |
| 2784 ir.Primitive buildLocalNoSuchSetter(LocalElement local, ir.Primitive value, | 2786 ir.Primitive buildLocalNoSuchSetter(LocalElement local, ir.Primitive value, |
| 2785 SourceInformation sourceInformation) { | 2787 SourceInformation sourceInformation) { |
| 2786 Selector selector = new Selector.setter( | 2788 Selector selector = new Selector.setter( |
| 2787 new Name(local.name, local.library, isSetter: true)); | 2789 new Name(local.name, local.library, isSetter: true)); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3335 validateArgumentCount(exactly: 0); | 3337 validateArgumentCount(exactly: 0); |
| 3336 | 3338 |
| 3337 if (!compiler.hasIsolateSupport) { | 3339 if (!compiler.hasIsolateSupport) { |
| 3338 // If the isolate library is not used, we just generate code | 3340 // If the isolate library is not used, we just generate code |
| 3339 // to fetch the current isolate. | 3341 // to fetch the current isolate. |
| 3340 continue getStaticState; | 3342 continue getStaticState; |
| 3341 } | 3343 } |
| 3342 return buildIsolateHelperInvocation( | 3344 return buildIsolateHelperInvocation( |
| 3343 helpers.currentIsolate, CallStructure.NO_ARGS); | 3345 helpers.currentIsolate, CallStructure.NO_ARGS); |
| 3344 | 3346 |
| 3345 getStaticState: case 'JS_GET_STATIC_STATE': | 3347 getStaticState: |
| 3348 case 'JS_GET_STATIC_STATE': |
| 3346 validateArgumentCount(exactly: 0); | 3349 validateArgumentCount(exactly: 0); |
| 3347 | 3350 |
| 3348 return irBuilder.buildForeignCode( | 3351 return irBuilder.buildForeignCode( |
| 3349 js.js.parseForeignJS(backend.namer.staticStateHolder), | 3352 js.js.parseForeignJS(backend.namer.staticStateHolder), |
| 3350 const <ir.Primitive>[], | 3353 const <ir.Primitive>[], |
| 3351 NativeBehavior.DEPENDS_OTHER, | 3354 NativeBehavior.DEPENDS_OTHER, |
| 3352 sourceInformationBuilder.buildForeignCode(node)); | 3355 sourceInformationBuilder.buildForeignCode(node)); |
| 3353 | 3356 |
| 3354 case 'JS_SET_STATIC_STATE': | 3357 case 'JS_SET_STATIC_STATE': |
| 3355 validateArgumentCount(exactly: 1); | 3358 validateArgumentCount(exactly: 1); |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3916 // try { try S0 catch (ex, st) S1 } finally S2 | 3919 // try { try S0 catch (ex, st) S1 } finally S2 |
| 3917 // | 3920 // |
| 3918 // The analysis associates variables assigned in S0 with the catch clauses | 3921 // The analysis associates variables assigned in S0 with the catch clauses |
| 3919 // and variables assigned in S0 and S1 with the finally block. | 3922 // and variables assigned in S0 and S1 with the finally block. |
| 3920 TryStatementInfo enterTryFor(ast.Node node) { | 3923 TryStatementInfo enterTryFor(ast.Node node) { |
| 3921 TryStatementInfo info = new TryStatementInfo(); | 3924 TryStatementInfo info = new TryStatementInfo(); |
| 3922 tryStatements[node] = info; | 3925 tryStatements[node] = info; |
| 3923 tryNestingStack.add(info); | 3926 tryNestingStack.add(info); |
| 3924 return info; | 3927 return info; |
| 3925 } | 3928 } |
| 3929 |
| 3926 void leaveTryFor(TryStatementInfo info) { | 3930 void leaveTryFor(TryStatementInfo info) { |
| 3927 assert(tryNestingStack.last == info); | 3931 assert(tryNestingStack.last == info); |
| 3928 tryNestingStack.removeLast(); | 3932 tryNestingStack.removeLast(); |
| 3929 } | 3933 } |
| 3934 |
| 3930 bool hasCatch = !node.catchBlocks.isEmpty; | 3935 bool hasCatch = !node.catchBlocks.isEmpty; |
| 3931 bool hasFinally = node.finallyBlock != null; | 3936 bool hasFinally = node.finallyBlock != null; |
| 3932 TryStatementInfo catchInfo, finallyInfo; | 3937 TryStatementInfo catchInfo, finallyInfo; |
| 3933 // There is a nesting stack of try blocks, so the outer try/finally block | 3938 // There is a nesting stack of try blocks, so the outer try/finally block |
| 3934 // is added first. | 3939 // is added first. |
| 3935 if (hasFinally) finallyInfo = enterTryFor(node.finallyBlock); | 3940 if (hasFinally) finallyInfo = enterTryFor(node.finallyBlock); |
| 3936 if (hasCatch) catchInfo = enterTryFor(node.catchBlocks); | 3941 if (hasCatch) catchInfo = enterTryFor(node.catchBlocks); |
| 3937 visit(node.tryBlock); | 3942 visit(node.tryBlock); |
| 3938 | 3943 |
| 3939 if (hasCatch) { | 3944 if (hasCatch) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4024 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); | 4029 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); |
| 4025 | 4030 |
| 4026 String getJsInteropTargetPath(FunctionElement element) { | 4031 String getJsInteropTargetPath(FunctionElement element) { |
| 4027 return '${_backend.namer.fixedBackendPath(element)}.' | 4032 return '${_backend.namer.fixedBackendPath(element)}.' |
| 4028 '${_backend.nativeData.getFixedBackendName(element)}'; | 4033 '${_backend.nativeData.getFixedBackendName(element)}'; |
| 4029 } | 4034 } |
| 4030 | 4035 |
| 4031 DartType get jsJavascriptObjectType => | 4036 DartType get jsJavascriptObjectType => |
| 4032 _backend.helpers.jsJavaScriptObjectClass.thisType; | 4037 _backend.helpers.jsJavaScriptObjectClass.thisType; |
| 4033 } | 4038 } |
| OLD | NEW |