Ignore:
Timestamp:
Jul 9, 2018, 2:29:41 PM (7 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] Embed RegExp into constant buffer in UnlinkedCodeBlock and CodeBlock
https://bugs.webkit.org/show_bug.cgi?id=187477

Reviewed by Mark Lam.

Before this patch, RegExp* is specially held in m_regexp buffer which resides in CodeBlock's RareData.
However, it is not necessary since JSCells can be reside in a constant buffer.
This patch embeds RegExp* to a constant buffer in UnlinkedCodeBlock and CodeBlock. And remove RegExp
vector from RareData.

We also move the code of dumping RegExp from BytecodeDumper to RegExp::dumpToStream.

  • bytecode/BytecodeDumper.cpp:

(JSC::BytecodeDumper<Block>::dumpBytecode):
(JSC::BytecodeDumper<Block>::dumpBlock):
(JSC::regexpToSourceString): Deleted.
(JSC::regexpName): Deleted.
(JSC::BytecodeDumper<Block>::dumpRegExps): Deleted.

  • bytecode/BytecodeDumper.h:
  • bytecode/CodeBlock.h:

(JSC::CodeBlock::regexp const): Deleted.
(JSC::CodeBlock::numberOfRegExps const): Deleted.

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::visitChildren):
(JSC::UnlinkedCodeBlock::shrinkToFit):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::addRegExp): Deleted.
(JSC::UnlinkedCodeBlock::numberOfRegExps const): Deleted.
(JSC::UnlinkedCodeBlock::regexp const): Deleted.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitNewRegExp):
(JSC::BytecodeGenerator::addRegExp): Deleted.

  • bytecompiler/BytecodeGenerator.h:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_new_regexp):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::dumpInContextAssumingStructure const):

  • runtime/RegExp.cpp:

(JSC::regexpToSourceString):
(JSC::RegExp::dumpToStream):

  • runtime/RegExp.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/RegExp.cpp

    r233621 r233657  
    506506#endif
    507507
     508static CString regexpToSourceString(const RegExp* regExp)
     509{
     510    char postfix[7] = { '/', 0, 0, 0, 0, 0, 0 };
     511    int index = 1;
     512    if (regExp->global())
     513        postfix[index++] = 'g';
     514    if (regExp->ignoreCase())
     515        postfix[index++] = 'i';
     516    if (regExp->multiline())
     517        postfix[index] = 'm';
     518    if (regExp->dotAll())
     519        postfix[index++] = 's';
     520    if (regExp->unicode())
     521        postfix[index++] = 'u';
     522    if (regExp->sticky())
     523        postfix[index++] = 'y';
     524
     525    return toCString("/", regExp->pattern().impl(), postfix);
     526}
     527
     528void RegExp::dumpToStream(const JSCell* cell, PrintStream& out)
     529{
     530    out.print(regexpToSourceString(jsCast<const RegExp*>(cell)));
     531}
     532
    508533} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.