mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:49:43 +00:00
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:
parent
e99fb4fc26
commit
9a3b5614de
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue