Ignore:
Timestamp:
Aug 17, 2008, 1:23:49 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-08-17 Geoffrey Garen <[email protected]>

Reviewed by Cameron Zwarich.

Made room for a free word in JSCell.


SunSpider says no change.


I changed JSCallbackObjectData, Arguments, JSArray, and RegExpObject to
store auxiliary data in a secondary structure.

I changed InternalFunction to store the function's name in the property
map.


I changed JSGlobalObjectData to use a virtual destructor, so WebCore's
JSDOMWindowBaseData could inherit from it safely. (It's a strange design
for JSDOMWindowBase to allocate an object that JSGlobalObject deletes,
but that's really our only option, given the size constraint.)


I also added a bunch of compile-time ASSERTs, and removed lots of comments
in JSObject.h because they were often out of date, and they got in the
way of reading what was actually going on.


Also renamed JSArray::getLength to JSArray::length, to match our style
guidelines.

WebCore:

2008-08-17 Geoffrey Garen <[email protected]>

Reviewed by Cameron Zwarich.

Made room for a free word in JSCell.


Changed JSDOMWindowBase to store its auxiliary data in a subclass of
JSGlobalData, so the two could share a pointer.


Added a bunch of ASSERTs, to help catch over-sized objects.

WebKit/mac:

2008-08-17 Geoffrey Garen <[email protected]>

Reviewed by Cameron Zwarich.

Made room for a free word in JSCell.


(Updated for JavaScriptCore changes.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/RegExpObject.cpp

    r35291 r35807  
    3131namespace KJS {
    3232
     33ASSERT_CLASS_FITS_IN_CELL(RegExpObject);
     34
    3335const ClassInfo RegExpObject::info = { "RegExp", 0, 0, ExecState::regExpTable };
    3436
     
    4547RegExpObject::RegExpObject(RegExpPrototype* regExpPrototype, PassRefPtr<RegExp> regExp)
    4648    : JSObject(regExpPrototype)
    47     , m_regExp(regExp)
    48     , m_lastIndex(0)
     49    , d(new RegExpObjectData(regExp, 0))
    4950{
    5051}
     
    6364    switch (token) {
    6465        case Global:
    65             return jsBoolean(m_regExp->global());
     66            return jsBoolean(d->regExp->global());
    6667        case IgnoreCase:
    67             return jsBoolean(m_regExp->ignoreCase());
     68            return jsBoolean(d->regExp->ignoreCase());
    6869        case Multiline:
    69             return jsBoolean(m_regExp->multiline());
     70            return jsBoolean(d->regExp->multiline());
    7071        case Source:
    71             return jsString(exec, m_regExp->pattern());
     72            return jsString(exec, d->regExp->pattern());
    7273        case LastIndex:
    73             return jsNumber(exec, m_lastIndex);
     74            return jsNumber(exec, d->lastIndex);
    7475    }
    7576   
     
    8788    UNUSED_PARAM(token);
    8889    ASSERT(token == LastIndex);
    89     m_lastIndex = value->toInteger(exec);
     90    d->lastIndex = value->toInteger(exec);
    9091}
    9192
     
    108109    int lastIndex = 0;
    109110    if (global) {
    110         if (m_lastIndex < 0 || m_lastIndex > input.size()) {
    111             m_lastIndex = 0;
     111        if (d->lastIndex < 0 || d->lastIndex > input.size()) {
     112            d->lastIndex = 0;
    112113            return false;
    113114        }
    114         lastIndex = static_cast<int>(m_lastIndex);
     115        lastIndex = static_cast<int>(d->lastIndex);
    115116    }
    116117
    117118    int foundIndex;
    118119    int foundLength;
    119     regExpObj->performMatch(m_regExp.get(), input, lastIndex, foundIndex, foundLength);
     120    regExpObj->performMatch(d->regExp.get(), input, lastIndex, foundIndex, foundLength);
    120121
    121122    if (global) {
    122123        lastIndex = foundIndex < 0 ? 0 : foundIndex + foundLength;
    123         m_lastIndex = lastIndex;
     124        d->lastIndex = lastIndex;
    124125    }
    125126
Note: See TracChangeset for help on using the changeset viewer.