[JSC] Unify CodeBlock IsoSubspaces
authorysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 21:14:19 +0000 (21:14 +0000)
committerysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 21:14:19 +0000 (21:14 +0000)
commit8de301b225fe1d39a61986f3fb4df1cddea308eb
tree4cce1f4dcc8ec66de6bc2b2a0c1e0d7f74485175
parent3d69b690e9882bf36167307a6b316caae3bac8e2
[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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/bytecode/EvalCodeBlock.cpp
Source/JavaScriptCore/bytecode/EvalCodeBlock.h
Source/JavaScriptCore/bytecode/FunctionCodeBlock.cpp
Source/JavaScriptCore/bytecode/FunctionCodeBlock.h
Source/JavaScriptCore/bytecode/GlobalCodeBlock.h
Source/JavaScriptCore/bytecode/ModuleProgramCodeBlock.cpp
Source/JavaScriptCore/bytecode/ModuleProgramCodeBlock.h
Source/JavaScriptCore/bytecode/ProgramCodeBlock.cpp
Source/JavaScriptCore/bytecode/ProgramCodeBlock.h
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h