mirror of
https://github.com/dart-lang/sdk
synced 2024-09-06 00:59:09 +00:00
[ddc] Optimize checks for object constructor
Flipped the ordering of the equality operation so that the compiler can see it is being dispatched to a string literal and can generate a faster check. Change-Id: I5c2f6b123ebe0f6cb81efba94fe4bf81168bec74 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317261 Reviewed-by: Mark Zhou <markzipan@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
d9363a6639
commit
858badcf50
|
@ -35,7 +35,7 @@ void _copyMembers(@notNull Object to, @notNull Object from) {
|
|||
var names = getOwnNamesAndSymbols(from);
|
||||
for (int i = 0, n = JS('!', '#.length', names); i < n; ++i) {
|
||||
String name = JS('', '#[#]', names, i);
|
||||
if (name == 'constructor') continue;
|
||||
if ('constructor' == name) continue;
|
||||
_copyMember(to, from, name);
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ void _installPropertiesForObject(jsProto) {
|
|||
var names = getOwnPropertyNames(coreObjProto);
|
||||
for (int i = 0, n = JS('!', '#.length', names); i < n; ++i) {
|
||||
var name = JS<String>('!', '#[#]', names, i);
|
||||
if (name == 'constructor') continue;
|
||||
if ('constructor' == name) continue;
|
||||
var desc = getOwnPropertyDescriptor(coreObjProto, name);
|
||||
defineProperty(jsProto, JS('', '#.#', dartx, name), desc);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ safeGetOwnProperty(obj, name) {
|
|||
copyTheseProperties(to, from, names) {
|
||||
for (int i = 0, n = JS('!', '#.length', names); i < n; ++i) {
|
||||
var name = JS('', '#[#]', names, i);
|
||||
if (name == 'constructor') continue;
|
||||
if ('constructor' == name) continue;
|
||||
copyProperty(to, from, name);
|
||||
}
|
||||
return to;
|
||||
|
|
Loading…
Reference in a new issue