dart2js: Inline Primitives.identicalImplementation into identical patch.

This gets rid of one layer of indirection that was not necessary and implements the conditional completely in JavaScript which avoids the potential for recursion when generating the intermediate representation for boolean conversion.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1290433002 .
This commit is contained in:
Karl Klose 2015-08-26 11:25:12 +02:00
parent e99fb4fc26
commit 9a3b5614de
2 changed files with 3 additions and 7 deletions

View file

@ -20,6 +20,8 @@ import 'dart:_js_helper' show patch,
Closure,
readHttp;
import 'dart:_foreign_helper' show JS;
import 'dart:_native_typed_data' show NativeUint8List;
import 'dart:async' show StreamController;
@ -403,7 +405,7 @@ class RegExp {
// Patch for 'identical' function.
@patch
bool identical(Object a, Object b) {
return Primitives.identicalImplementation(a, b);
return JS('bool', '(# == null ? # == null : # === #)', a, b, a, b);
}
@patch

View file

@ -1510,12 +1510,6 @@ class Primitives {
return JS('', '#.apply(#, #)', jsFunction, function, positionalArguments);
}
static bool identicalImplementation(a, b) {
return JS('bool', '# == null', a)
? JS('bool', '# == null', b)
: JS('bool', '# === #', a, b);
}
static StackTrace extractStackTrace(Error error) {
return getTraceFromException(JS('', r'#.$thrownJsError', error));
}