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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_fragment.dart

Issue 1761903002: dart2js cps: Keep interceptors in a separate field. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 4 years, 9 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 cps_ir.cps_fragment; 5 library cps_ir.cps_fragment;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import '../constants/values.dart'; 8 import '../constants/values.dart';
9 import '../universe/selector.dart' show Selector; 9 import '../universe/selector.dart' show Selector;
10 import '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ApplyBuiltinMethod apply = 125 ApplyBuiltinMethod apply =
126 new ApplyBuiltinMethod(method, receiver, arguments, sourceInformation); 126 new ApplyBuiltinMethod(method, receiver, arguments, sourceInformation);
127 return letPrim(apply); 127 return letPrim(apply);
128 } 128 }
129 129
130 /// Inserts an invocation and returns a primitive holding the returned value. 130 /// Inserts an invocation and returns a primitive holding the returned value.
131 Primitive invokeMethod(Primitive receiver, 131 Primitive invokeMethod(Primitive receiver,
132 Selector selector, 132 Selector selector,
133 TypeMask mask, 133 TypeMask mask,
134 List<Primitive> arguments, 134 List<Primitive> arguments,
135 [CallingConvention callingConvention = CallingConvention.Normal]) { 135 {Primitive interceptor,
136 CallingConvention callingConvention}) {
136 InvokeMethod invoke = 137 InvokeMethod invoke =
137 new InvokeMethod(receiver, selector, mask, arguments, 138 new InvokeMethod(receiver, selector, mask, arguments,
138 sourceInformation: sourceInformation, 139 sourceInformation: sourceInformation,
139 callingConvention: callingConvention); 140 callingConvention: callingConvention,
141 interceptor: interceptor);
140 return letPrim(invoke); 142 return letPrim(invoke);
141 } 143 }
142 144
143 /// Inserts an invocation and returns a primitive holding the returned value. 145 /// Inserts an invocation and returns a primitive holding the returned value.
144 Primitive invokeStatic(FunctionElement target, List<Primitive> arguments) { 146 Primitive invokeStatic(FunctionElement target, List<Primitive> arguments) {
145 return letPrim(new InvokeStatic(target, new Selector.fromElement(target), 147 return letPrim(new InvokeStatic(target, new Selector.fromElement(target),
146 arguments, sourceInformation)); 148 arguments, sourceInformation));
147 } 149 }
148 150
149 /// Inserts an invocation to a static function that throws an error. 151 /// Inserts an invocation to a static function that throws an error.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 /// Inlines [target] at the current position, substituting the provided 271 /// Inlines [target] at the current position, substituting the provided
270 /// arguments. 272 /// arguments.
271 /// 273 ///
272 /// Returns a primitive containing the function's return value. 274 /// Returns a primitive containing the function's return value.
273 /// 275 ///
274 /// The new hole is the the point after [target] has returned. The fragment 276 /// The new hole is the the point after [target] has returned. The fragment
275 /// remains open, even if [target] never returns. 277 /// remains open, even if [target] never returns.
276 /// 278 ///
277 /// The [target] function is destroyed and should not be reused. 279 /// The [target] function is destroyed and should not be reused.
278 Primitive inlineFunction(FunctionDefinition target, 280 Primitive inlineFunction(FunctionDefinition target,
279 Primitive thisArgument, 281 Primitive receiver,
280 List<Primitive> arguments, 282 List<Primitive> arguments,
281 {Entity hint}) { 283 {Entity hint,
282 if (thisArgument != null) { 284 Primitive interceptor}) {
283 target.thisParameter.replaceUsesWith(thisArgument); 285 if (interceptor != null) {
286 target.interceptorParameter.replaceUsesWith(interceptor);
287 }
288 if (receiver != null) {
289 target.receiverParameter.replaceUsesWith(receiver);
284 } 290 }
285 for (int i = 0; i < arguments.length; ++i) { 291 for (int i = 0; i < arguments.length; ++i) {
286 target.parameters[i].replaceUsesWith(arguments[i]); 292 target.parameters[i].replaceUsesWith(arguments[i]);
287 } 293 }
288 Continuation returnCont = target.returnContinuation; 294 Continuation returnCont = target.returnContinuation;
289 bindContinuation(returnCont); 295 bindContinuation(returnCont);
290 put(target.body); 296 put(target.body);
291 Parameter returnValue = returnCont.parameters.single; 297 Parameter returnValue = returnCont.parameters.single;
292 returnValue.hint = hint; 298 returnValue.hint = hint;
293 context = returnCont; 299 context = returnCont;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 while (prim.firstRef != null) { 370 while (prim.firstRef != null) {
365 Refinement refine = prim.firstRef.parent; 371 Refinement refine = prim.firstRef.parent;
366 destroyRefinementsOfDeadPrimitive(refine); 372 destroyRefinementsOfDeadPrimitive(refine);
367 LetPrim letPrim = refine.parent; 373 LetPrim letPrim = refine.parent;
368 InteriorNode parent = letPrim.parent; 374 InteriorNode parent = letPrim.parent;
369 parent.body = letPrim.body; 375 parent.body = letPrim.body;
370 letPrim.body.parent = parent; 376 letPrim.body.parent = parent;
371 prim.firstRef.unlink(); 377 prim.firstRef.unlink();
372 } 378 }
373 } 379 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/bounds_checker.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698