If "otherOrigin == this" in SecurityOrigin::equal, it's obviously equal. From http://lists.macosforge.org/pipermail/webkit-dev/2009-June/008038.html > SecurityOrigin was created to cleanup the way we do same-origin checks in > the JavaScript bindings, and as such, carry some of that baggage (eg. domain > relaxing). The main design constraint then was that it was a cheap compare > for two origins representing the same document (pointer compare) as that is > common case. The code evolved from there. Makes sense. Note that SecurityOrigin::equal does not currently do a fast path check of "this == other" (to just do a pointer compare as you mentioned) so this is probably low hanging fruit to make things a bit faster. (Though, as you said, it's not showing up on current profiles...so it's probably not a huge deal.)
Created attachment 30937 [details] A fix.
Wouldn't it makes more sense to do this in isSameSchemeHostPort?
I don't think so. I only see isSameSchemeHostPort used a couple places, but they don't seem like they'd benefit from such an optimization [1]. ::equal, on the other hand, is called pretty often (it's used a lot in hash tables). It seems a bit painful to require another function call plus a branch or two for a function that's not called very often. We could put the == check in both places. Doing one additional branch isn't going to hurt the slow path. It doesn't seem necessary though. [1] http://www.google.com/codesearch?hl=en&q=isSameSchemeHostPort+package%3A%22git%3A%2F%2Fandroid.git.kernel.org%2Fplatform%2Fexternal%2Fwebkit.git%22
Comment on attachment 30937 [details] A fix. Seems fine. r=me
Assign for landing.
Landed in @r44420.