[stdlib] use noinline to get rid of closure.

Remove wrapping the callee in a closure to disable inlining, instead mark callee
as noinline.

No performance change is observed.


Swift SVN r19194
This commit is contained in:
Manman Ren
2014-06-25 23:50:14 +00:00
parent c9a1027d2a
commit 0501da8f54

View File

@@ -137,10 +137,9 @@ extension String {
(other._base.elementShift != 1) |
(!self._base.hasContiguousStorage) |
(!other._base.hasContiguousStorage)) {
// We wrap this function with a closure to disable inlining.
// This is a cold path and inlining _compareUnicode may
// prevent the inlining of the compare function.
return {$0._compareUnicode($1)}(self, other)
return _compareUnicode(other)
}
while true {
@@ -157,8 +156,7 @@ extension String {
if _slowPath((e1 >= 0xD800) | (e2 >= 0xD800)) {
// Use slow unicode comparator if
// we found multi-byte scalar.
// Disable inlining by wrapping the callee in a closure.
return {$0._compareUnicode($1)}(self, other)
return _compareUnicode(other)
}
if e1 < e2 {
@@ -180,6 +178,7 @@ extension String {
}
}
@noinline
func _compareUnicode(other : UnicodeScalarView) -> Int {
var g1 = self.generate()
var g2 = other.generate()