Ignore:
Timestamp:
Oct 24, 2008, 1:44:58 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-24 Cameron Zwarich <[email protected]>

Reviewed by Maciej Stachowiak.

Bug 21862: Create JSFunction prototype property lazily
<https://bugs.webkit.org/show_bug.cgi?id=21862>

This is a 1.5% speedup on SunSpider and a 1.4% speedup on the V8
benchmark suite, including a 3.8% speedup on Earley-Boyer.

  • kjs/JSFunction.cpp: (JSC::JSFunction::getOwnPropertySlot):
  • kjs/nodes.cpp: (JSC::FuncDeclNode::makeFunction): (JSC::FuncExprNode::makeFunction):
File:
1 edited

Legend:

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

    r37845 r37859  
    103103bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    104104{
     105    if (propertyName == exec->propertyNames().prototype) {
     106        JSValue** location = getDirectLocation(propertyName);
     107
     108        if (!location) {
     109            JSObject* prototype = new (exec) JSObject(m_scopeChain.globalObject()->emptyObjectStructure());
     110            prototype->putDirect(exec->propertyNames().constructor, this, DontEnum);
     111            putDirect(exec->propertyNames().prototype, prototype, DontDelete);
     112            location = getDirectLocation(propertyName);
     113        }
     114
     115        slot.setValueSlot(this, location, offsetForLocation(location));
     116    }
     117
    105118    if (propertyName == exec->propertyNames().arguments) {
    106119        slot.setCustom(this, argumentsGetter);
Note: See TracChangeset for help on using the changeset viewer.