[stdlib-js-ir] Remove BitUtils object and make all members toplevel

It works slightly better with IR DCE --
we get about 6% less code on box tests.
This commit is contained in:
Zalim Bashorov
2020-01-13 20:54:37 +03:00
parent 62014e6711
commit 9e7f72382f
4 changed files with 62 additions and 71 deletions
@@ -1,12 +1,10 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.js
import kotlin.js.internal.BitUtils
fun equals(obj1: dynamic, obj2: dynamic): Boolean {
if (obj1 == null) {
return obj2 == null
@@ -49,7 +47,7 @@ fun hashCode(obj: dynamic): Int {
return when (jsTypeOf(obj)) {
"object" -> if ("function" === jsTypeOf(obj.hashCode)) (obj.hashCode)() else getObjectHashCode(obj)
"function" -> getObjectHashCode(obj)
"number" -> BitUtils.getNumberHashCode(obj)
"number" -> getNumberHashCode(obj)
"boolean" -> if(obj.unsafeCast<Boolean>()) 1 else 0
else -> getStringHashCode(js("String(obj)"))
}