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

Unified Diff: sdk/lib/_internal/js_runtime/lib/js_helper.dart

Issue 2072883004: Code changes to avoid Firefox debug 'error' lint warnings. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/js_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 6cfcda8d7cb9a8c1d3d255b436f073557cae38ee..1f7cc7bc27a63efb299d6494b7a639fed1f176e9 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -2456,7 +2456,7 @@ abstract class Closure implements Function {
*
* V8 will share the underlying function code objects when the same string is
* passed to "new Function". Shared function code objects can lead to
- * sub-optimal performance due to polymorhism, and can be prevented by
+ * sub-optimal performance due to polymorphism, and can be prevented by
* ensuring the strings are different.
*/
static int functionCounter = 0;
@@ -2559,8 +2559,9 @@ abstract class Closure implements Function {
: isCsp
? JS('', 'function(a,b,c,d) {this.\$initialize(a,b,c,d)}')
: JS('',
- 'new Function("a,b,c,d", "this.\$initialize(a,b,c,d);" + #)',
- functionCounter++);
+ 'new Function("a,b,c,d" + #,'
+ ' "this.\$initialize(a,b,c,d" + # + ")")',
+ functionCounter, functionCounter++);
// It is necessary to set the constructor property, otherwise it will be
// "Object".
@@ -2722,12 +2723,14 @@ abstract class Closure implements Function {
}
if (arity == 0) {
+ // Incorporate functionCounter into a local.
+ String selfName = 'self${functionCounter++}';
return JS(
'',
'(new Function(#))()',
'return function(){'
- 'return this.${BoundClosure.selfFieldName()}.$stubName();'
- '${functionCounter++}'
+ 'var $selfName = this.${BoundClosure.selfFieldName()};'
+ 'return $selfName.$stubName();'
'}');
}
assert (1 <= arity && arity < 27);
@@ -2735,12 +2738,12 @@ abstract class Closure implements Function {
'String',
'"abcdefghijklmnopqrstuvwxyz".split("").splice(0,#).join(",")',
arity);
+ arguments += '${functionCounter++}';
return JS(
'',
'(new Function(#))()',
'return function($arguments){'
'return this.${BoundClosure.selfFieldName()}.$stubName($arguments);'
- '${functionCounter++}'
'}');
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698