Commit 1ac13a61 authored by darin@apple.com's avatar darin@apple.com

2008-06-11 Darin Adler <darin@apple.com>

        Reviewed by Maciej.

        - a little bit of cleanup and prep for some upcoming optimizations

        * JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
        * VM/CodeBlock.cpp:
        (KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
        need to make sure the type is unsigned long.
        * kjs/object.cpp:
        (KJS::Error::create): Eliminated unused error names array, and also put
        the strings into the code since there was already a switch statment.
        This also avoids having to contemplate a hypothetical access past the
        end of the array.
        * kjs/object.h: Got rid of errorNames.
        * kjs/property_slot.cpp: Deleted unused ungettableGetter.
        * kjs/property_slot.h: Ditto.
        * wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 92108505
2008-06-11 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- a little bit of cleanup and prep for some upcoming optimizations
* JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
need to make sure the type is unsigned long.
* kjs/object.cpp:
(KJS::Error::create): Eliminated unused error names array, and also put
the strings into the code since there was already a switch statment.
This also avoids having to contemplate a hypothetical access past the
end of the array.
* kjs/object.h: Got rid of errorNames.
* kjs/property_slot.cpp: Deleted unused ungettableGetter.
* kjs/property_slot.h: Ditto.
* wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.
2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
......
_JSCheckScriptSyntax
_JSClassCreate
_JSClassRelease
_JSClassRetain
_JSContextGetGlobalObject
_JSEvaluateScript
_JSGarbageCollect
_JSGlobalContextCreate
_JSGlobalContextRelease
_JSGlobalContextRetain
_JSObjectCallAsConstructor
_JSObjectCallAsFunction
_JSObjectCopyPropertyNames
_JSObjectDeleteProperty
_JSObjectGetPrivate
_JSObjectGetProperty
_JSObjectGetPropertyAtIndex
_JSObjectGetPrototype
_JSObjectHasProperty
_JSObjectIsConstructor
_JSObjectIsFunction
_JSObjectMake
_JSObjectMakeConstructor
_JSObjectMakeFunction
_JSObjectMakeFunctionWithCallback
_JSObjectSetPrivate
_JSObjectSetProperty
_JSObjectSetPropertyAtIndex
_JSObjectSetPrototype
_JSPropertyNameAccumulatorAddName
_JSPropertyNameArrayGetCount
_JSPropertyNameArrayGetNameAtIndex
_JSPropertyNameArrayRelease
_JSPropertyNameArrayRetain
_JSStringCopyCFString
_JSStringCreateWithCFString
_JSStringCreateWithCharacters
_JSStringCreateWithUTF8CString
_JSStringGetCharactersPtr
_JSStringGetLength
_JSStringGetMaximumUTF8CStringSize
_JSStringGetUTF8CString
_JSStringIsEqual
_JSStringIsEqualToUTF8CString
_JSStringRelease
_JSStringRetain
_JSValueGetType
_JSValueIsBoolean
_JSValueIsEqual
_JSValueIsInstanceOfConstructor
_JSValueIsNull
_JSValueIsNumber
_JSValueIsObject
_JSValueIsObjectOfClass
_JSValueIsStrictEqual
_JSValueIsString
_JSValueIsUndefined
_JSValueMakeBoolean
_JSValueMakeNull
_JSValueMakeNumber
_JSValueMakeString
_JSValueMakeUndefined
_JSValueProtect
_JSValueToBoolean
_JSValueToNumber
_JSValueToObject
_JSValueToStringCopy
_JSValueUnprotect
_WTFLog
_WTFLogVerbose
_WTFReportArgumentAssertionFailure
_WTFReportAssertionFailure
_WTFReportAssertionFailureWithMessage
_WTFReportError
_WTFReportFatalError
__Z12jsRegExpFreeP8JSRegExp
__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
......@@ -29,8 +104,8 @@ __ZN3KJS12PropertySlot15undefinedGetterEPNS_9ExecStateERKNS_10IdentifierERKS0_
__ZN3KJS12RegisterFile14addGlobalSlotsEm
__ZN3KJS13ArrayInstance4infoE
__ZN3KJS13CodeGenerator21setDumpsGeneratedCodeEb
__ZN3KJS13jsOwnedStringERKNS_7UStringE
__ZN3KJS13StatementNode6setLocEii
__ZN3KJS13jsOwnedStringERKNS_7UStringE
__ZN3KJS14JSGlobalObject10globalExecEv
__ZN3KJS14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
__ZN3KJS14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
......@@ -44,8 +119,8 @@ __ZN3KJS14JSGlobalObject5resetEPNS_7JSValueE
__ZN3KJS14JSGlobalObjectD2Ev
__ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3KJS14StringInstance16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3KJS14StringInstance3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
__ZN3KJS14StringInstance4infoE
__ZN3KJS14StringInstanceC1EPNS_8JSObjectERKNS_7UStringE
......@@ -56,23 +131,23 @@ __ZN3KJS16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameAr
__ZN3KJS16ParserRefCounted3refEv
__ZN3KJS16ParserRefCounted5derefEv
__ZN3KJS17PropertyNameArray3addEPNS_7UString3RepE
__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
__ZN3KJS17RegisterFileStack20allocateRegisterFileEmPS0_
__ZN3KJS19initializeThreadingEv
__ZN3KJS19InternalFunctionImp11getCallDataERNS_8CallDataE
__ZN3KJS19InternalFunctionImp4infoE
__ZN3KJS19InternalFunctionImpC2EPNS_17FunctionPrototypeERKNS_10IdentifierE
__ZN3KJS19initializeThreadingEv
__ZN3KJS23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectERKNS_4ListE
__ZN3KJS4List15expandAndAppendEPNS_7JSValueE
__ZN3KJS4List7markSetEv
__ZN3KJS5equalEPKNS_7UString3RepES3_
__ZN3KJS6JSCell11getCallDataERNS_8CallDataE
__ZN3KJS6JSCell16getConstructDataERNS_13ConstructDataE
__ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
__ZN3KJS6JSCell3putEPNS_9ExecStateEjPNS_7JSValueE
__ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3KJS6JSCell3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
__ZN3KJS6JSCell3putEPNS_9ExecStateEjPNS_7JSValueE
__ZN3KJS6JSCell9getObjectEv
__ZN3KJS6JSCellnwEm
__ZN3KJS6JSLock12DropAllLocksC1Ev
......@@ -83,21 +158,21 @@ __ZN3KJS6JSLock6unlockEv
__ZN3KJS6JSLock9lockCountEv
__ZN3KJS6Parser5parseEPNS_9ExecStateERKNS_7UStringEiN3WTF10PassRefPtrINS_14SourceProviderEEEPiSA_PS3_
__ZN3KJS6strtodEPKcPPc
__ZN3KJS7CStringaSERKS0_
__ZN3KJS7CStringD1Ev
__ZN3KJS7CStringaSERKS0_
__ZN3KJS7Machine13dumpCallFrameEPKNS_9CodeBlockEPNS_14ScopeChainNodeEPNS_12RegisterFileEPKNS_8RegisterE
__ZN3KJS7Profile7forEachEPFvPNS_11ProfileNodeEE
__ZN3KJS7Profile10restoreAllEv
__ZN3KJS7Profile7forEachEPFvPNS_11ProfileNodeEE
__ZN3KJS7UString3Rep11computeHashEPKti
__ZN3KJS7UString3Rep4nullE
__ZN3KJS7UString3Rep7destroyEv
__ZN3KJS7UString4fromEj
__ZN3KJS7UString6appendEPKc
__ZN3KJS7UString6appendERKS0_
__ZN3KJS7UStringaSEPKc
__ZN3KJS7UStringC1EPKc
__ZN3KJS7UStringC1EPKti
__ZN3KJS7UStringC1ERKS0_S2_
__ZN3KJS7UStringaSEPKc
__ZN3KJS8Debugger6attachEPNS_14JSGlobalObjectE
__ZN3KJS8Debugger6detachEPNS_14JSGlobalObjectE
__ZN3KJS8DebuggerC2Ev
......@@ -109,26 +184,26 @@ __ZN3KJS8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
__ZN3KJS8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
__ZN3KJS8JSObject12removeDirectERKNS_10IdentifierE
__ZN3KJS8JSObject14callAsFunctionEPNS_9ExecStateEPS0_RKNS_4ListE
__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
__ZN3KJS8JSObject14implementsCallEv
__ZN3KJS8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZN3KJS8JSObject17putDirectFunctionEPNS_19InternalFunctionImpEi
__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
__ZN3KJS8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3KJS8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRPNS_7JSValueE
__ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
__ZN3KJS8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
__ZN3KJS8JSObject4markEv
__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListE
__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListERKNS_10IdentifierERKNS_7UStringEi
__ZN3KJS8jsStringEPKc
__ZN3KJS8jsStringERKNS_7UStringE
__ZN3KJS8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
__ZN3KJS8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
__ZN3KJS8Profiler8profilerEv
__ZN3KJS8jsStringEPKc
__ZN3KJS8jsStringERKNS_7UStringE
__ZN3KJS9Collector14allocateNumberEm
__ZN3KJS9Collector15recordExtraCostEm
__ZN3KJS9Collector17globalObjectCountEv
......@@ -205,8 +280,8 @@ __ZNK3KJS7UString6is8BitEv
__ZNK3KJS7UString6substrEii
__ZNK3KJS7UString8toUInt32EPb
__ZNK3KJS7UString8toUInt32EPbb
__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
__ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
__ZNK3KJS8JSObject12toThisObjectEPNS_9ExecStateE
__ZNK3KJS8JSObject14toGlobalObjectEPNS_9ExecStateE
......@@ -229,82 +304,7 @@ __ZTVN3KJS16JSVariableObjectE
__ZTVN3KJS19InternalFunctionImpE
__ZTVN3KJS8JSObjectE
__ZTVN3KJS9NumberImpE
_JSCheckScriptSyntax
_JSClassCreate
_JSClassRelease
_JSClassRetain
_JSContextGetGlobalObject
_jscore_collector_introspection
_jscore_fastmalloc_introspection
_JSEvaluateScript
_JSGarbageCollect
_JSGlobalContextCreate
_JSGlobalContextRelease
_JSGlobalContextRetain
_JSObjectCallAsConstructor
_JSObjectCallAsFunction
_JSObjectCopyPropertyNames
_JSObjectDeleteProperty
_JSObjectGetPrivate
_JSObjectGetProperty
_JSObjectGetPropertyAtIndex
_JSObjectGetPrototype
_JSObjectHasProperty
_JSObjectIsConstructor
_JSObjectIsFunction
_JSObjectMake
_JSObjectMakeConstructor
_JSObjectMakeFunction
_JSObjectMakeFunctionWithCallback
_JSObjectSetPrivate
_JSObjectSetProperty
_JSObjectSetPropertyAtIndex
_JSObjectSetPrototype
_JSPropertyNameAccumulatorAddName
_JSPropertyNameArrayGetCount
_JSPropertyNameArrayGetNameAtIndex
_JSPropertyNameArrayRelease
_JSPropertyNameArrayRetain
_JSStringCopyCFString
_JSStringCreateWithCFString
_JSStringCreateWithCharacters
_JSStringCreateWithUTF8CString
_JSStringGetCharactersPtr
_JSStringGetLength
_JSStringGetMaximumUTF8CStringSize
_JSStringGetUTF8CString
_JSStringIsEqual
_JSStringIsEqualToUTF8CString
_JSStringRelease
_JSStringRetain
_JSValueGetType
_JSValueIsBoolean
_JSValueIsEqual
_JSValueIsInstanceOfConstructor
_JSValueIsNull
_JSValueIsNumber
_JSValueIsObject
_JSValueIsObjectOfClass
_JSValueIsStrictEqual
_JSValueIsString
_JSValueIsUndefined
_JSValueMakeBoolean
_JSValueMakeNull
_JSValueMakeNumber
_JSValueMakeString
_JSValueMakeUndefined
_JSValueProtect
_JSValueToBoolean
_JSValueToNumber
_JSValueToObject
_JSValueToStringCopy
_JSValueUnprotect
_kJSClassDefinitionEmpty
_releaseFastMallocFreeMemory
_WTFLog
_WTFLogVerbose
_WTFReportArgumentAssertionFailure
_WTFReportAssertionFailure
_WTFReportAssertionFailureWithMessage
_WTFReportError
_WTFReportFatalError
......@@ -154,7 +154,10 @@ void CodeBlock::dump(ExecState* exec) const
if (machine().isOpcode(it->u.opcode))
++instructionCount;
printf("%lu instructions; %lu bytes at %p; %d locals (%d parameters); %d temporaries\n\n", instructionCount, instructions.size() * sizeof(Instruction), this, numLocals, numParameters, numTemporaries);
printf("%lu instructions; %lu bytes at %p; %d locals (%d parameters); %d temporaries\n\n",
static_cast<unsigned long>(instructionCount),
static_cast<unsigned long>(instructions.size() * sizeof(Instruction)),
this, numLocals, numParameters, numTemporaries);
for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
dump(exec, begin, it);
......
......@@ -519,49 +519,45 @@ void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue **location)
// ------------------------------ Error ----------------------------------------
const char * const errorNamesArr[] = {
I18N_NOOP("Error"), // GeneralError
I18N_NOOP("Evaluation error"), // EvalError
I18N_NOOP("Range error"), // RangeError
I18N_NOOP("Reference error"), // ReferenceError
I18N_NOOP("Syntax error"), // SyntaxError
I18N_NOOP("Type error"), // TypeError
I18N_NOOP("URI error"), // URIError
};
const char * const * const Error::errorNames = errorNamesArr;
JSObject *Error::create(ExecState *exec, ErrorType errtype, const UString &message,
int lineno, int sourceId, const UString &sourceURL)
{
JSObject *cons;
JSObject* Error::create(ExecState* exec, ErrorType errtype, const UString& message,
int lineno, int sourceId, const UString& sourceURL)
{
JSObject* cons;
const char* name;
switch (errtype) {
case EvalError:
cons = exec->lexicalGlobalObject()->evalErrorConstructor();
name = "Evaluation error";
break;
case RangeError:
cons = exec->lexicalGlobalObject()->rangeErrorConstructor();
name = "Range error";
break;
case ReferenceError:
cons = exec->lexicalGlobalObject()->referenceErrorConstructor();
name = "Reference error";
break;
case SyntaxError:
cons = exec->lexicalGlobalObject()->syntaxErrorConstructor();
name = "Syntax error";
break;
case TypeError:
cons = exec->lexicalGlobalObject()->typeErrorConstructor();
name = "Type error";
break;
case URIError:
cons = exec->lexicalGlobalObject()->URIErrorConstructor();
name = "URI error";
break;
default:
cons = exec->lexicalGlobalObject()->errorConstructor();
name = "Error";
break;
}
List args;
if (message.isEmpty())
args.append(jsString(errorNames[errtype]));
args.append(jsString(name));
else
args.append(jsString(message));
JSObject *err = static_cast<JSObject *>(cons->construct(exec,args));
......
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
* Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -476,11 +475,6 @@ namespace KJS {
*/
static JSObject *create(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
static JSObject *create(ExecState *, ErrorType, const char *message);
/**
* Array of error names corresponding to ErrorType
*/
static const char * const * const errorNames;
};
JSObject *throwError(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
......
......@@ -34,12 +34,6 @@ JSValue* PropertySlot::undefinedGetter(ExecState*, const Identifier&, const Prop
return jsUndefined();
}
JSValue* PropertySlot::ungettableGetter(ExecState*, const Identifier&, const PropertySlot&)
{
ASSERT_NOT_REACHED();
return jsUndefined();
}
JSValue* PropertySlot::functionGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
CallData data;
......
......@@ -152,7 +152,6 @@ public:
private:
static JSValue* undefinedGetter(ExecState*, const Identifier&, const PropertySlot&);
static JSValue* ungettableGetter(ExecState*, const Identifier&, const PropertySlot&);
static JSValue* functionGetter(ExecState*, const Identifier&, const PropertySlot&);
GetValueFunc m_getValue;
......
......@@ -45,3 +45,11 @@
#define UNLIKELY(x) (x)
#endif
#endif
#ifndef LIKELY
#if COMPILER(GCC)
#define LIKELY(x) __builtin_expect((x), 1)
#else
#define LIKELY(x) (x)
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment