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

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

Issue 2680823002: Extract InterceptorData from JavaScriptBackend. (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 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 receiver = js('this'); 339 receiver = js('this');
340 } 340 }
341 } 341 }
342 statements 342 statements
343 .add(js.statement('return #.#(#)', [receiver, target, arguments])); 343 .add(js.statement('return #.#(#)', [receiver, target, arguments]));
344 344
345 return statements; 345 return statements;
346 } 346 }
347 347
348 bool isSupertypeOfNativeClass(ClassEntity element) { 348 bool isSupertypeOfNativeClass(ClassEntity element) {
349 if (backend.classesMixedIntoInterceptedClasses.contains(element)) { 349 if (backend.interceptorData.classesMixedIntoInterceptedClasses
350 .contains(element)) {
350 return true; 351 return true;
351 } 352 }
352 353
353 return subtypes[element] != null; 354 return subtypes[element] != null;
354 } 355 }
355 356
356 bool requiresNativeIsCheck(ClassEntity element) { 357 bool requiresNativeIsCheck(ClassEntity element) {
357 // TODO(sra): Remove this function. It determines if a native type may 358 // TODO(sra): Remove this function. It determines if a native type may
358 // satisfy a check against [element], in which case an interceptor must be 359 // satisfy a check against [element], in which case an interceptor must be
359 // used. We should also use an interceptor if the check can't be satisfied 360 // used. We should also use an interceptor if the check can't be satisfied
360 // by a native class in case we get a native instance that tries to spoof 361 // by a native class in case we get a native instance that tries to spoof
361 // the type info. i.e the criteria for whether or not to use an interceptor 362 // the type info. i.e the criteria for whether or not to use an interceptor
362 // is whether the receiver can be native, not the type of the test. 363 // is whether the receiver can be native, not the type of the test.
363 ClassEntity cls = element; 364 ClassEntity cls = element;
364 if (backend.isNativeOrExtendsNative(cls)) return true; 365 if (backend.nativeData.isNativeOrExtendsNative(cls)) return true;
365 return isSupertypeOfNativeClass(element); 366 return isSupertypeOfNativeClass(element);
366 } 367 }
367 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698