Ignore:
Timestamp:
Sep 11, 2012, 11:14:56 PM (13 years ago)
Author:
[email protected]
Message:

Don't allocate a backing store just for a function's name
https://bugs.webkit.org/show_bug.cgi?id=96468

Reviewed by Oliver Hunt.

Treat function.name like function.length etc., and use a custom getter.
This saves space in closures.

  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::functionName):

  • debugger/DebuggerCallFrame.h:

(DebuggerCallFrame): Updated for interface change.

  • runtime/Executable.h:

(JSC::JSFunction::JSFunction): Do a little inlining.

  • runtime/JSFunction.cpp:

(JSC::JSFunction::finishCreation): Gone now. That's the point of the patch.

(JSC::JSFunction::name):
(JSC::JSFunction::displayName):
(JSC::JSFunction::nameGetter):
(JSC::JSFunction::getOwnPropertySlot):
(JSC::JSFunction::getOwnPropertyDescriptor):
(JSC::JSFunction::getOwnPropertyNames):
(JSC::JSFunction::put):
(JSC::JSFunction::deleteProperty):
(JSC::JSFunction::defineOwnProperty): Added custom accessors for .name
just like .length and others.

  • runtime/JSFunction.h:

(JSC::JSFunction::create):
(JSFunction): Updated for interface changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r127958 r128265  
    3232#include "JSFunction.h"
    3333#include "Interpreter.h"
     34#include "JSGlobalObject.h"
    3435#include "LLIntCLoop.h"
    3536#include "Nodes.h"
     
    754755        WriteBarrier<SharedSymbolTable> m_symbolTable;
    755756    };
     757
     758    inline JSFunction::JSFunction(JSGlobalData& globalData, FunctionExecutable* executable, JSScope* scope)
     759        : Base(globalData, scope->globalObject()->functionStructure())
     760        , m_executable(globalData, this, executable)
     761        , m_scope(globalData, this, scope)
     762    {
     763    }
    756764
    757765    inline FunctionExecutable* JSFunction::jsExecutable() const
Note: See TracChangeset for help on using the changeset viewer.