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

Side by Side Diff: pkg/compiler/lib/src/native/behavior.dart

Issue 1607373002: dart2js: switching isolate is not 'PURE' (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: fixed Created 4 years, 11 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 native; 5 part of native;
6 6
7 /// This class is a temporary work-around until we get a more powerful DartType. 7 /// This class is a temporary work-around until we get a more powerful DartType.
8 class SpecialType { 8 class SpecialType {
9 final String name; 9 final String name;
10 const SpecialType._(this.name); 10 const SpecialType._(this.name);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 NativeThrowBehavior throwBehavior = NativeThrowBehavior.MAY; 104 NativeThrowBehavior throwBehavior = NativeThrowBehavior.MAY;
105 105
106 bool isAllocation = false; 106 bool isAllocation = false;
107 bool useGvn = false; 107 bool useGvn = false;
108 108
109 // TODO(sra): Make NativeBehavior immutable so PURE and PURE_ALLOCATION can be 109 // TODO(sra): Make NativeBehavior immutable so PURE and PURE_ALLOCATION can be
110 // final constant-like objects. 110 // final constant-like objects.
111 static NativeBehavior get PURE => NativeBehavior._makePure(); 111 static NativeBehavior get PURE => NativeBehavior._makePure();
112 static NativeBehavior get PURE_ALLOCATION => 112 static NativeBehavior get PURE_ALLOCATION =>
113 NativeBehavior._makePure(isAllocation: true); 113 NativeBehavior._makePure(isAllocation: true);
114 static NativeBehavior get CHANGES_OTHER => NativeBehavior._makeChangesOther();
115 static NativeBehavior get DEPENDS_OTHER => NativeBehavior._makeDependsOther();
116
114 117
115 String toString() { 118 String toString() {
116 return 'NativeBehavior(' 119 return 'NativeBehavior('
117 'returns: ${typesReturned}' 120 'returns: ${typesReturned}'
118 ', creates: ${typesInstantiated}' 121 ', creates: ${typesInstantiated}'
119 ', sideEffects: ${sideEffects}' 122 ', sideEffects: ${sideEffects}'
120 ', throws: ${throwBehavior}' 123 ', throws: ${throwBehavior}'
121 '${isAllocation ? ", isAllocation" : ""}' 124 '${isAllocation ? ", isAllocation" : ""}'
122 '${useGvn ? ", useGvn" : ""}' 125 '${useGvn ? ", useGvn" : ""}'
123 ')'; 126 ')';
124 } 127 }
125 128
126 static NativeBehavior _makePure({bool isAllocation: false}) { 129 static NativeBehavior _makePure({bool isAllocation: false}) {
127 NativeBehavior behavior = new NativeBehavior(); 130 NativeBehavior behavior = new NativeBehavior();
128 behavior.sideEffects.clearAllDependencies(); 131 behavior.sideEffects.clearAllDependencies();
129 behavior.sideEffects.clearAllSideEffects(); 132 behavior.sideEffects.clearAllSideEffects();
130 behavior.throwBehavior = NativeThrowBehavior.NEVER; 133 behavior.throwBehavior = NativeThrowBehavior.NEVER;
131 behavior.isAllocation = isAllocation; 134 behavior.isAllocation = isAllocation;
132 return behavior; 135 return behavior;
133 } 136 }
134 137
138 static NativeBehavior _makeChangesOther() {
139 // TODO(25544): Have a distinct effect instead of using static properties to
140 // model 'other' effects.
141 return _makePure()..sideEffects.setChangesStaticProperty();
142 }
143
144 static NativeBehavior _makeDependsOther() {
145 // TODO(25544): Have a distinct effect instead of using static properties to
146 // model 'other' effects.
147 return _makePure()..sideEffects.setDependsOnStaticPropertyStore();
148 }
149
135 /// Processes the type specification string of a call to JS and stores the 150 /// Processes the type specification string of a call to JS and stores the
136 /// result in the [typesReturned] and [typesInstantiated]. It furthermore 151 /// result in the [typesReturned] and [typesInstantiated]. It furthermore
137 /// computes the side effects, and, if given, invokes [setSideEffects] with 152 /// computes the side effects, and, if given, invokes [setSideEffects] with
138 /// the computed effects. If no side effects are encoded in the [specString] 153 /// the computed effects. If no side effects are encoded in the [specString]
139 /// the [setSideEffects] method is not invoked. 154 /// the [setSideEffects] method is not invoked.
140 /// 155 ///
141 /// Two forms of the string is supported: 156 /// Two forms of the string is supported:
142 /// 157 ///
143 /// 1) A single type string of the form 'void', '', 'var' or 'T1|...|Tn' which 158 /// 1) A single type string of the form 'void', '', 'var' or 'T1|...|Tn' which
144 /// defines the types returned, and, for the last form, the types also 159 /// defines the types returned, and, for the last form, the types also
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 MessageKind.GENERIC, 890 MessageKind.GENERIC,
876 {'text': "Type '$typeString' not found."}); 891 {'text': "Type '$typeString' not found."});
877 return const DynamicType(); 892 return const DynamicType();
878 } 893 }
879 894
880 static _errorNode(locationNodeOrElement, Parsing parsing) { 895 static _errorNode(locationNodeOrElement, Parsing parsing) {
881 if (locationNodeOrElement is Node) return locationNodeOrElement; 896 if (locationNodeOrElement is Node) return locationNodeOrElement;
882 return locationNodeOrElement.parseNode(parsing); 897 return locationNodeOrElement.parseNode(parsing);
883 } 898 }
884 } 899 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698