Ignore:
Timestamp:
May 9, 2010, 6:41:07 PM (15 years ago)
Author:
[email protected]
Message:

2010-05-09 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.

Reserve a large-ish initial capacity for Lexer::m_buffer16.

SunSpider says 0.3% faster.

m_buffer16 is used when parsing complex strings -- for example, strings
with escape sequences in them. These kinds of strings can be really long,
and we want to avoid repeatedly copying as we grow m_buffer16.

The net memory cost is quite low, since it's proporitional to source
code we already have in memory, and we throw away m_buffer16 right when
we're done parsing.

  • parser/Lexer.cpp: (JSC::Lexer::Lexer): No need to reserve initial capacity in our constructor, since setCode will be called before we're asked to lex anything. (JSC::Lexer::setCode): Reserve enough space to lex half the source code as a complex string without having to copy. (JSC::Lexer::clear): No need to reserve initial capacity here either, since setCode will be called before we're asked to lex anything.

2010-05-09 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

REGRESSION(r57955): RegExp literals should not actually be cached, so r57955 should be rolled out.
https://bugs.webkit.org/show_bug.cgi?id=38828

Replace incorrect test for caching regexp literals with ones that tests that they are not cached.

  • fast/js/regexp-literals-are-constants-expected.txt: Removed.
  • fast/js/regexp-literals-are-constants.html: Removed.
  • fast/js/regexp-literals-arent-constants-expected.txt: Added.
  • fast/js/regexp-literals-arent-constants.html: Added.
  • fast/js/script-tests/regexp-literals-are-constants.js: Removed.
  • fast/js/script-tests/regexp-literals-arent-constants.js: Added. (test1): (returnRegExpLiteral): (returnConditionalRegExpLiteral):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r59005 r59064  
    3535#include "JSFunction.h"
    3636#include "Interpreter.h"
    37 #include "RegExp.h"
    38 #include "RegExpObject.h"
    3937#include "UString.h"
    4038
     
    828826
    829827    return &m_constantPoolRegisters[index];
     828}
     829
     830unsigned BytecodeGenerator::addRegExp(RegExp* r)
     831{
     832    return m_codeBlock->addRegExp(r);
    830833}
    831834
     
    980983}
    981984
    982 RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, RegExp* regExp)
    983 {
    984     JSValue jsRegExp = new (globalData()) RegExpObject(m_scopeChain->globalObject()->regExpStructure(), regExp);
    985     return emitLoad(dst, jsRegExp);
    986 }
    987 
    988985RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, JSValue v)
    989986{
     
    13811378}
    13821379
     1380RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp)
     1381{
     1382    emitOpcode(op_new_regexp);
     1383    instructions().append(dst->index());
     1384    instructions().append(addRegExp(regExp));
     1385    return dst;
     1386}
     1387
     1388
    13831389RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n)
    13841390{
Note: See TracChangeset for help on using the changeset viewer.