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/profiler/Profiler.cpp

    r35756 r35807  
    3030#include "Profiler.h"
    3131
     32#include "CommonIdentifiers.h"
    3233#include "ExecState.h"
    3334#include "JSFunction.h"
     
    4445static unsigned ProfilesUID = 0;
    4546
    46 static CallIdentifier createCallIdentifier(JSObject*);
    47 static CallIdentifier createCallIdentifier(const UString& sourceURL, int startingLineNumber);
    48 static CallIdentifier createCallIdentifierFromFunctionImp(JSFunction*);
     47static CallIdentifier createCallIdentifier(ExecState*, JSObject*);
     48static CallIdentifier createCallIdentifier(ExecState*, const UString& sourceURL, int startingLineNumber);
     49static CallIdentifier createCallIdentifierFromFunctionImp(ExecState*, JSFunction*);
    4950
    5051Profiler* Profiler::s_sharedProfiler = 0;
     
    116117    ASSERT(!m_currentProfiles.isEmpty());
    117118
    118     dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier(calledFunction), exec->lexicalGlobalObject()->profileGroup());
     119    dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier(exec, calledFunction), exec->lexicalGlobalObject()->profileGroup());
    119120}
    120121
     
    123124    ASSERT(!m_currentProfiles.isEmpty());
    124125
    125     CallIdentifier callIdentifier = createCallIdentifier(sourceURL, startingLineNumber);
     126    CallIdentifier callIdentifier = createCallIdentifier(exec, sourceURL, startingLineNumber);
    126127
    127128    dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, callIdentifier, exec->lexicalGlobalObject()->profileGroup());
     
    132133    ASSERT(!m_currentProfiles.isEmpty());
    133134
    134     dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(calledFunction), exec->lexicalGlobalObject()->profileGroup());
     135    dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(exec, calledFunction), exec->lexicalGlobalObject()->profileGroup());
    135136}
    136137
     
    139140    ASSERT(!m_currentProfiles.isEmpty());
    140141
    141     dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());
     142    dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(exec, sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());
    142143}
    143144
    144 CallIdentifier createCallIdentifier(JSObject* calledFunction)
     145CallIdentifier createCallIdentifier(ExecState* exec, JSObject* calledFunction)
    145146{
    146147    if (calledFunction->inherits(&JSFunction::info))
    147         return createCallIdentifierFromFunctionImp(static_cast<JSFunction*>(calledFunction));
     148        return createCallIdentifierFromFunctionImp(exec, static_cast<JSFunction*>(calledFunction));
    148149    if (calledFunction->inherits(&InternalFunction::info))
    149         return CallIdentifier(static_cast<InternalFunction*>(calledFunction)->functionName().ustring(), "", 0);
     150        return CallIdentifier(static_cast<InternalFunction*>(calledFunction)->name(exec), "", 0);
    150151
    151152    UString name = "(" + calledFunction->className() + " object)";
     
    153154}
    154155
    155 CallIdentifier createCallIdentifier(const UString& sourceURL, int startingLineNumber)
     156CallIdentifier createCallIdentifier(ExecState*, const UString& sourceURL, int startingLineNumber)
    156157{
    157158    return CallIdentifier(GlobalCodeExecution, sourceURL, startingLineNumber);
    158159}
    159160
    160 CallIdentifier createCallIdentifierFromFunctionImp(JSFunction* functionImp)
     161CallIdentifier createCallIdentifierFromFunctionImp(ExecState* exec, JSFunction* function)
    161162{
    162     UString name = functionImp->functionName().ustring();
    163     if (name.isEmpty())
    164         name = AnonymousFunction;
    165 
    166     return CallIdentifier(name, functionImp->m_body->sourceURL(), functionImp->m_body->lineNo());
     163    const UString& name = function->name(exec);
     164    return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->m_body->sourceURL(), function->m_body->lineNo());
    167165}
    168166
Note: See TracChangeset for help on using the changeset viewer.