Ignore:
Timestamp:
Feb 1, 2019, 1:14:19 PM (7 years ago)
Author:
[email protected]
Message:

[JSC] Unify CodeBlock IsoSubspaces
https://bugs.webkit.org/show_bug.cgi?id=194167

Reviewed by Saam Barati.

When we move CodeBlock into its IsoSubspace, we create IsoSubspaces for each subclass of CodeBlock.
But this is not necessary since,

  1. They do not override the classInfo methods.
  2. sizeof(ProgramCodeBlock etc.) == sizeof(CodeBlock) since subclasses adds no additional fields.

Creating IsoSubspace for each subclass is costly in terms of memory. Especially, IsoSubspace for
ProgramCodeBlock is. We typically create only one ProgramCodeBlock, and it means the rest of the
MarkedBlock (16KB - sizeof(footer) - sizeof(ProgramCodeBlock)) is just wasted.

This patch unifies these IsoSubspaces into one.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::destroy):

  • bytecode/CodeBlock.h:
  • bytecode/EvalCodeBlock.cpp:

(JSC::EvalCodeBlock::destroy): Deleted.

  • bytecode/EvalCodeBlock.h: We drop some utility functions in EvalCodeBlock and use UnlinkedEvalCodeBlock's one directly.
  • bytecode/FunctionCodeBlock.cpp:

(JSC::FunctionCodeBlock::destroy): Deleted.

  • bytecode/FunctionCodeBlock.h:
  • bytecode/GlobalCodeBlock.h:
  • bytecode/ModuleProgramCodeBlock.cpp:

(JSC::ModuleProgramCodeBlock::destroy): Deleted.

  • bytecode/ModuleProgramCodeBlock.h:
  • bytecode/ProgramCodeBlock.cpp:

(JSC::ProgramCodeBlock::destroy): Deleted.

  • bytecode/ProgramCodeBlock.h:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):

  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:

(JSC::VM::forEachCodeBlockSpace):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/ModuleProgramCodeBlock.h

    r226783 r240864  
    4343    static IsoSubspace* subspaceFor(VM& vm)
    4444    {
    45         return &vm.moduleProgramCodeBlockSpace.space;
     45        return &vm.codeBlockSpace.space;
    4646    }
    4747
     
    8080    {
    8181    }
    82 
    83     static void destroy(JSCell*);
    8482};
     83static_assert(sizeof(ModuleProgramCodeBlock) == sizeof(CodeBlock), "Subclasses of CodeBlock should be the same size to share IsoSubspace");
    8584
    8685} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.