Partial fix for <rdar://problem/9417875> REGRESSION: SunSpider ~17% slower
authorGeoffrey Garen <ggaren@apple.com>
Sun, 15 May 2011 22:31:31 +0000 (22:31 +0000)
committerAdemar de Souza Reis Jr <ademar.reis@openbossa.org>
Tue, 17 May 2011 14:55:26 +0000 (11:55 -0300)
commitf8e5f0115fea691db9eee9f843994a49639d5127
tree7860cdfd9bafd6197bc4840e02dd2548506bb357
parent3ffd91d20bd839eb0f21de3e21cad0c61e524ae7
Partial fix for <rdar://problem/9417875> REGRESSION: SunSpider ~17% slower
in browser than on command line

Reviewed by Maciej Stachowiak.

This patch fixes a few issues in generated code that could unreasonably
prolong object lifetimes.

* heap/Heap.cpp:
(JSC::Heap::collectAllGarbage): Throw away all function code before doing
a major collection. We want to clear polymorphic caches, since they can
keep alive large object graphs that have gone "stale". For the same reason,
but to a lesser extent, we also want to clear linked functions and other
one-off caches.

This has the side-benefit of reducing memory footprint from run-once
functions, and of allowing predictions and caches that have failed to
re-specialize.

Eventually, if compilation costs rise far enough, we may want a more
limited strategy for de-specializing code without throwing it away
completely, but this works for now, and it's the simplest solution.

* jit/JITStubs.cpp:
(JSC::JITThunks::hostFunctionStub):
* jit/JITStubs.h:
* runtime/JSFunction.cpp: Made the host function stub cache weak --
otherwise it's effectively a memory leak that can seriously fragment the
GC and JIT heaps.

(JSC::JSFunction::JSFunction):
(JSC::JSFunction::visitChildren): Cleared up some comments that confused
me when working with this code.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86510 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/jit/JITStubs.cpp
Source/JavaScriptCore/jit/JITStubs.h
Source/JavaScriptCore/runtime/JSFunction.cpp