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/InternalFunction.cpp

    r35229 r35807  
    2929namespace KJS {
    3030
     31ASSERT_CLASS_FITS_IN_CELL(InternalFunction);
     32
    3133const ClassInfo InternalFunction::info = { "Function", 0, 0, 0 };
    3234
    33 InternalFunction::InternalFunction()
     35InternalFunction::InternalFunction(ExecState* exec)
    3436{
     37    putDirect(exec->propertyNames().name, jsString(exec, exec->propertyNames().nullIdentifier.ustring()), DontDelete | ReadOnly | DontEnum);
    3538}
    3639
    37 InternalFunction::InternalFunction(FunctionPrototype* prototype, const Identifier& name)
     40InternalFunction::InternalFunction(ExecState* exec, FunctionPrototype* prototype, const Identifier& name)
    3841    : JSObject(prototype)
    39     , m_name(name)
    4042{
     43    putDirect(exec->propertyNames().name, jsString(exec, name.ustring()), DontDelete | ReadOnly | DontEnum);
     44}
     45
     46const UString& InternalFunction::name(ExecState* exec)
     47{
     48    JSValue* v = getDirect(exec->propertyNames().name);
     49    ASSERT(v->isString());
     50    return static_cast<JSString*>(v)->value();
    4151}
    4252
     
    4656}
    4757
    48 bool InternalFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    49 {
    50     if (propertyName == exec->propertyNames().name) {
    51         slot.setCustom(this, nameGetter);
    52         return true;
    53     }
    54 
    55     return JSObject::getOwnPropertySlot(exec, propertyName, slot);
    56 }
    57 
    58 void InternalFunction::put(ExecState* exec, const Identifier& propertyName, JSValue* value)
    59 {
    60     if (propertyName == exec->propertyNames().name)
    61         return;
    62     JSObject::put(exec, propertyName, value);
    63 }
    64 
    65 bool InternalFunction::deleteProperty(ExecState* exec, const Identifier& propertyName)
    66 {
    67     if (propertyName == exec->propertyNames().name)
    68         return false;
    69     return JSObject::deleteProperty(exec, propertyName);
    70 }
    71 
    72 JSValue* InternalFunction::nameGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
    73 {
    74     InternalFunction* thisObj = static_cast<InternalFunction*>(slot.slotBase());
    75     return jsString(exec, thisObj->functionName().ustring());
    76 }
    77 
    7858} // namespace KJS
Note: See TracChangeset for help on using the changeset viewer.