Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
=================================================================== |
--- sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (revision 16103) |
+++ sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (working copy) |
@@ -1117,13 +1117,18 @@ |
if (closure == null) return null; |
var function = JS('var', r'#.$identity', closure); |
if (JS('bool', r'!!#', function)) return function; |
+ // Fetch the current isolate in a local variable to prevent the |
+ // compiler from inlining its use in the following JS expression: |
+ // the current isolate may have changed so if we read it from the JS |
+ // closure, it leads to the wrong isolate. |
+ var currentIsolate = JS_CURRENT_ISOLATE(); |
function = JS("var", r"""function() { |
ahe
2012/12/14 08:33:31
Why doesn't this function take two arguments?
ahe
2012/12/14 08:33:31
I think it would be cleaner if this expression was
ngeoffray
2012/12/14 09:13:16
That's a good question. I'll address it in a diffe
|
return #(#, #, #, arguments[0], arguments[1]); |
}""", |
DART_CLOSURE_TO_JS(invokeClosure), |
ahe
2012/12/14 08:33:31
Weird indentation.
|
closure, |
- JS_CURRENT_ISOLATE(), |
+ currentIsolate, |
arity); |
JS('void', r'#.$identity = #', closure, function); |