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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/native_emitter.dart

Issue 2731163002: Split js interop registration into library/class/member elements (Closed)
Patch Set: Updated cf. comments Created 3 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) 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 library dart2js.js_emitter.native_emitter; 5 library dart2js.js_emitter.native_emitter;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../elements/types.dart' show DartType, FunctionType; 9 import '../elements/types.dart' show DartType, FunctionType;
10 import '../elements/entities.dart'; 10 import '../elements/entities.dart';
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 arguments = argumentsBuffer.sublist( 332 arguments = argumentsBuffer.sublist(
333 0, indexOfLastOptionalArgumentInParameters + 1); 333 0, indexOfLastOptionalArgumentInParameters + 1);
334 if (nativeData.isJsInteropMember(member)) { 334 if (nativeData.isJsInteropMember(member)) {
335 // fixedBackendPath is allowed to have the form foo.bar.baz for 335 // fixedBackendPath is allowed to have the form foo.bar.baz for
336 // interop. This template is uncached to avoid possibly running out of 336 // interop. This template is uncached to avoid possibly running out of
337 // memory when Dart2Js is run in server mode. In reality the risk of 337 // memory when Dart2Js is run in server mode. In reality the risk of
338 // caching these templates causing an issue is very low as each class 338 // caching these templates causing an issue is very low as each class
339 // and library that uses typed JavaScript interop will create only 1 339 // and library that uses typed JavaScript interop will create only 1
340 // unique template. 340 // unique template.
341 receiver = js 341 receiver = js
342 .uncachedExpressionTemplate(namer.fixedBackendMethodPath(member)) 342 .uncachedExpressionTemplate(
343 nativeData.getFixedBackendMethodPath(member))
343 .instantiate([]); 344 .instantiate([]);
344 } else { 345 } else {
345 receiver = js('this'); 346 receiver = js('this');
346 } 347 }
347 } 348 }
348 statements 349 statements
349 .add(js.statement('return #.#(#)', [receiver, target, arguments])); 350 .add(js.statement('return #.#(#)', [receiver, target, arguments]));
350 351
351 return statements; 352 return statements;
352 } 353 }
(...skipping 11 matching lines...) Expand all
364 // satisfy a check against [element], in which case an interceptor must be 365 // satisfy a check against [element], in which case an interceptor must be
365 // used. We should also use an interceptor if the check can't be satisfied 366 // used. We should also use an interceptor if the check can't be satisfied
366 // by a native class in case we get a native instance that tries to spoof 367 // by a native class in case we get a native instance that tries to spoof
367 // the type info. i.e the criteria for whether or not to use an interceptor 368 // the type info. i.e the criteria for whether or not to use an interceptor
368 // is whether the receiver can be native, not the type of the test. 369 // is whether the receiver can be native, not the type of the test.
369 ClassEntity cls = element; 370 ClassEntity cls = element;
370 if (nativeData.isNativeOrExtendsNative(cls)) return true; 371 if (nativeData.isNativeOrExtendsNative(cls)) return true;
371 return isSupertypeOfNativeClass(element); 372 return isSupertypeOfNativeClass(element);
372 } 373 }
373 } 374 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/native_data.dart ('k') | pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698