• jgruber's avatar
    [builtins] Implement lazy deserialization for TFJ builtins · 79aee245
    jgruber authored
    This adds support for lazy deserialization of JS-linkage (TFJ) builtins,
    still gated behind the --lazy-deserialization flag. If enabled, we
    proceed as follows:
    
    During isolate initialization, only eager builtins are deserialized. All
    references to lazy builtins are replaced by the DeserializeLazy builtin.
    In particular, this happens in the builtin table (Builtins::builtins_)
    and in SharedFunctionInfo objects.
    
    When calling into a not-yet deserialized function (i.e. the JSFunction's
    code object is the DeserializeLazy builtin), the DeserializeLazy builtin
    takes over.  It checks the builtin table to see if the target builtin
    (determined by looking at the builtin id stored on the
    SharedFunctionInfo) has already been deserialized. If so, it simply
    copies the builtin code object to the JSFunction and SharedFunctionInfo.
    Otherwise, we enter Runtime::kDeserializeLazy to deserialize the
    builtin.
    
    With --lazy-deserialization, isolate deserialization is 11% faster
    (1.5ms vs.  1.7ms), and code_space->Size() is 33% lower (984K vs.
    1475K).
    
    Moving relocation infos & handler tables out of the partial snapshot
    cache would additionally let us save up to 30K per isolate. Adding code
    stubs to that list increases further potential savings to 262K.
    
    Bug: v8:6624
    Change-Id: I0ac7d05d165d2466998269bd431ac076a311cbeb
    Reviewed-on: https://chromium-review.googlesource.com/649166
    Commit-Queue: Jakob Gruber <jgruber@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#47818}
    79aee245
external-reference-table.cc 18.8 KB