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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart

Issue 14015004: Remove call-indirections from type tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
index a6ed014c7407e8a713475228f31b037821955455..623878625db785bfb0c0005754242f2798589612 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -1139,28 +1139,28 @@ propertyTypeCast(value, property) {
}
/**
- * For types that are supertypes of native (eg DOM) types, we emit a
- * call because we cannot add a JS property to their prototype at load
- * time.
+ * For types that are supertypes of native (eg DOM) types, we use the
+ * interceptor for the class because we cannot add a JS property to the
+ * prototype at load time.
*/
-callTypeCheck(value, property) {
+interceptedTypeCheck(value, property) {
if (value == null) return value;
if ((identical(JS('String', 'typeof #', value), 'object'))
- && JS('bool', '#[#]()', getInterceptor(value), property)) {
+ && JS('bool', '#[#]', getInterceptor(value), property)) {
return value;
}
propertyTypeError(value, property);
}
/**
- * For types that are supertypes of native (eg DOM) types, we emit a
- * call because we cannot add a JS property to their prototype at load
- * time.
+ * For types that are supertypes of native (eg DOM) types, we use the
+ * interceptor for the class because we cannot add a JS property to the
+ * prototype at load time.
*/
-callTypeCast(value, property) {
+interceptedTypeCast(value, property) {
if (value == null
|| ((JS('bool', 'typeof # === "object"', value))
- && JS('bool', '#[#]()', getInterceptor(value), property))) {
+ && JS('bool', '#[#]', getInterceptor(value), property))) {
return value;
}
propertyTypeCastError(value, property);
@@ -1188,7 +1188,7 @@ numberOrStringSuperNativeTypeCheck(value, property) {
if (value == null) return value;
if (value is String) return value;
if (value is num) return value;
- if (JS('bool', '#[#]()', value, property)) return value;
+ if (JS('bool', '#[#]', getInterceptor(value), property)) return value;
propertyTypeError(value, property);
}
@@ -1196,7 +1196,7 @@ numberOrStringSuperNativeTypeCast(value, property) {
if (value == null) return value;
if (value is String) return value;
if (value is num) return value;
- if (JS('bool', '#[#]()', value, property)) return value;
+ if (JS('bool', '#[#]', getInterceptor(value), property)) return value;
propertyTypeCastError(value, property);
}
@@ -1219,13 +1219,13 @@ stringSuperTypeCast(value, property) {
stringSuperNativeTypeCheck(value, property) {
if (value == null) return value;
if (value is String) return value;
- if (JS('bool', '#[#]()', value, property)) return value;
+ if (JS('bool', '#[#]', getInterceptor(value), property)) return value;
propertyTypeError(value, property);
}
stringSuperNativeTypeCast(value, property) {
if (value is String || value == null) return value;
- if (JS('bool', '#[#]()', value, property)) return value;
+ if (JS('bool', '#[#]', getInterceptor(value), property)) return value;
propertyTypeCastError(value, property);
}
@@ -1260,13 +1260,13 @@ listSuperTypeCast(value, property) {
listSuperNativeTypeCheck(value, property) {
if (value == null) return value;
if (value is List) return value;
- if (JS('bool', '#[#]()', value, property)) return value;
+ if (JS('bool', '#[#]', getInterceptor(value), property)) return value;
propertyTypeError(value, property);
}
listSuperNativeTypeCast(value, property) {
if (value is List || value == null) return value;
- if (JS('bool', '#[#]()', value, property)) return value;
+ if (JS('bool', '#[#]', getInterceptor(value), property)) return value;
propertyTypeCastError(value, property);
}

Powered by Google App Engine
This is Rietveld 408576698