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

Unified Diff: pkg/compiler/lib/src/native/behavior.dart

Issue 1457383003: Alternative fix for the js-interop crash. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_interop_analysis.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/native/behavior.dart
diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart
index 7dbab30fe5e6f1e7f29b4a3b0715474e6abca661..3bee9aa5245e08835f64d8159ee189d09b5c6d9f 100644
--- a/pkg/compiler/lib/src/native/behavior.dart
+++ b/pkg/compiler/lib/src/native/behavior.dart
@@ -646,6 +646,17 @@ class NativeBehavior {
FunctionType type = method.computeType(compiler.resolution);
var behavior = new NativeBehavior();
behavior.typesReturned.add(type.returnType);
+ JavaScriptBackend backend = compiler.backend;
+ // Note: For dart:html and other internal libraries, we trust the return
+ // type and use it to limit what we enqueue. We are more conservative about
+ // JS interop types and assume any other JS interop type can be returned
+ // from an interop call or getter.
+ if (backend.isJsInterop(method)) {
+ behavior.typesReturned.add(
+ backend.helpers.jsJavaScriptObjectClass.thisType);
sra1 2015/11/20 19:06:24 It does seem crazy to do this for 'int'. Perhaps
Siggi Cherem (dart-lang) 2015/11/25 21:15:25 Agree - I can't do anything for int to be sound, b
+ behavior.typesInstantiated.add(
+ backend.helpers.jsJavaScriptObjectClass.thisType);
+ }
if (!type.returnType.isVoid) {
// Declared types are nullable.
behavior.typesReturned.add(compiler.coreTypes.nullType);
@@ -669,6 +680,14 @@ class NativeBehavior {
DartType type = field.computeType(resolution);
var behavior = new NativeBehavior();
behavior.typesReturned.add(type);
+ JavaScriptBackend backend = compiler.backend;
+ // See comment above on ofMethod
+ if (backend.isJsInterop(field)) {
+ behavior.typesReturned.add(
+ backend.helpers.jsJavaScriptObjectClass.thisType);
+ behavior.typesInstantiated.add(
+ backend.helpers.jsJavaScriptObjectClass.thisType);
+ }
// Declared types are nullable.
behavior.typesReturned.add(resolution.coreTypes.nullType);
behavior._capture(type, resolution);
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_interop_analysis.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698