Changeset 34499 in webkit


Ignore:
Timestamp:
Jun 11, 2008 3:01:40 PM (16 years ago)
Author:
Darin Adler
Message:

2008-06-11 Darin Adler <Darin Adler>

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.
Location:
trunk/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34497 r34499  
     12008-06-11  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        - a little bit of cleanup and prep for some upcoming optimizations
     6
     7        * JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
     8        * VM/CodeBlock.cpp:
     9        (KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
     10        need to make sure the type is unsigned long.
     11        * kjs/object.cpp:
     12        (KJS::Error::create): Eliminated unused error names array, and also put
     13        the strings into the code since there was already a switch statment.
     14        This also avoids having to contemplate a hypothetical access past the
     15        end of the array.
     16        * kjs/object.h: Got rid of errorNames.
     17        * kjs/property_slot.cpp: Deleted unused ungettableGetter.
     18        * kjs/property_slot.h: Ditto.
     19        * wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.
     20
    1212008-06-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
    222
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r34412 r34499  
     1_JSCheckScriptSyntax
     2_JSClassCreate
     3_JSClassRelease
     4_JSClassRetain
     5_JSContextGetGlobalObject
     6_JSEvaluateScript
     7_JSGarbageCollect
     8_JSGlobalContextCreate
     9_JSGlobalContextRelease
     10_JSGlobalContextRetain
     11_JSObjectCallAsConstructor
     12_JSObjectCallAsFunction
     13_JSObjectCopyPropertyNames
     14_JSObjectDeleteProperty
     15_JSObjectGetPrivate
     16_JSObjectGetProperty
     17_JSObjectGetPropertyAtIndex
     18_JSObjectGetPrototype
     19_JSObjectHasProperty
     20_JSObjectIsConstructor
     21_JSObjectIsFunction
     22_JSObjectMake
     23_JSObjectMakeConstructor
     24_JSObjectMakeFunction
     25_JSObjectMakeFunctionWithCallback
     26_JSObjectSetPrivate
     27_JSObjectSetProperty
     28_JSObjectSetPropertyAtIndex
     29_JSObjectSetPrototype
     30_JSPropertyNameAccumulatorAddName
     31_JSPropertyNameArrayGetCount
     32_JSPropertyNameArrayGetNameAtIndex
     33_JSPropertyNameArrayRelease
     34_JSPropertyNameArrayRetain
     35_JSStringCopyCFString
     36_JSStringCreateWithCFString
     37_JSStringCreateWithCharacters
     38_JSStringCreateWithUTF8CString
     39_JSStringGetCharactersPtr
     40_JSStringGetLength
     41_JSStringGetMaximumUTF8CStringSize
     42_JSStringGetUTF8CString
     43_JSStringIsEqual
     44_JSStringIsEqualToUTF8CString
     45_JSStringRelease
     46_JSStringRetain
     47_JSValueGetType
     48_JSValueIsBoolean
     49_JSValueIsEqual
     50_JSValueIsInstanceOfConstructor
     51_JSValueIsNull
     52_JSValueIsNumber
     53_JSValueIsObject
     54_JSValueIsObjectOfClass
     55_JSValueIsStrictEqual
     56_JSValueIsString
     57_JSValueIsUndefined
     58_JSValueMakeBoolean
     59_JSValueMakeNull
     60_JSValueMakeNumber
     61_JSValueMakeString
     62_JSValueMakeUndefined
     63_JSValueProtect
     64_JSValueToBoolean
     65_JSValueToNumber
     66_JSValueToObject
     67_JSValueToStringCopy
     68_JSValueUnprotect
     69_WTFLog
     70_WTFLogVerbose
     71_WTFReportArgumentAssertionFailure
     72_WTFReportAssertionFailure
     73_WTFReportAssertionFailureWithMessage
     74_WTFReportError
     75_WTFReportFatalError
    176__Z12jsRegExpFreeP8JSRegExp
    277__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
     
    30105__ZN3KJS13ArrayInstance4infoE
    31106__ZN3KJS13CodeGenerator21setDumpsGeneratedCodeEb
     107__ZN3KJS13StatementNode6setLocEii
    32108__ZN3KJS13jsOwnedStringERKNS_7UStringE
    33 __ZN3KJS13StatementNode6setLocEii
    34109__ZN3KJS14JSGlobalObject10globalExecEv
    35110__ZN3KJS14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
     
    45120__ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    46121__ZN3KJS14StringInstance16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
     122__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
    47123__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    48 __ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
    49124__ZN3KJS14StringInstance3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    50125__ZN3KJS14StringInstance4infoE
     
    57132__ZN3KJS16ParserRefCounted5derefEv
    58133__ZN3KJS17PropertyNameArray3addEPNS_7UString3RepE
     134__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    59135__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    60 __ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    61136__ZN3KJS17RegisterFileStack20allocateRegisterFileEmPS0_
    62 __ZN3KJS19initializeThreadingEv
    63137__ZN3KJS19InternalFunctionImp11getCallDataERNS_8CallDataE
    64138__ZN3KJS19InternalFunctionImp4infoE
    65139__ZN3KJS19InternalFunctionImpC2EPNS_17FunctionPrototypeERKNS_10IdentifierE
     140__ZN3KJS19initializeThreadingEv
    66141__ZN3KJS23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectERKNS_4ListE
    67142__ZN3KJS4List15expandAndAppendEPNS_7JSValueE
     
    70145__ZN3KJS6JSCell11getCallDataERNS_8CallDataE
    71146__ZN3KJS6JSCell16getConstructDataERNS_13ConstructDataE
     147__ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
    72148__ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    73 __ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
     149__ZN3KJS6JSCell3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    74150__ZN3KJS6JSCell3putEPNS_9ExecStateEjPNS_7JSValueE
    75 __ZN3KJS6JSCell3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    76151__ZN3KJS6JSCell9getObjectEv
    77152__ZN3KJS6JSCellnwEm
     
    84159__ZN3KJS6Parser5parseEPNS_9ExecStateERKNS_7UStringEiN3WTF10PassRefPtrINS_14SourceProviderEEEPiSA_PS3_
    85160__ZN3KJS6strtodEPKcPPc
     161__ZN3KJS7CStringD1Ev
    86162__ZN3KJS7CStringaSERKS0_
    87 __ZN3KJS7CStringD1Ev
    88163__ZN3KJS7Machine13dumpCallFrameEPKNS_9CodeBlockEPNS_14ScopeChainNodeEPNS_12RegisterFileEPKNS_8RegisterE
     164__ZN3KJS7Profile10restoreAllEv
    89165__ZN3KJS7Profile7forEachEPFvPNS_11ProfileNodeEE
    90 __ZN3KJS7Profile10restoreAllEv
    91166__ZN3KJS7UString3Rep11computeHashEPKti
    92167__ZN3KJS7UString3Rep4nullE
     
    95170__ZN3KJS7UString6appendEPKc
    96171__ZN3KJS7UString6appendERKS0_
    97 __ZN3KJS7UStringaSEPKc
    98172__ZN3KJS7UStringC1EPKc
    99173__ZN3KJS7UStringC1EPKti
    100174__ZN3KJS7UStringC1ERKS0_S2_
     175__ZN3KJS7UStringaSEPKc
    101176__ZN3KJS8Debugger6attachEPNS_14JSGlobalObjectE
    102177__ZN3KJS8Debugger6detachEPNS_14JSGlobalObjectE
     
    110185__ZN3KJS8JSObject12removeDirectERKNS_10IdentifierE
    111186__ZN3KJS8JSObject14callAsFunctionEPNS_9ExecStateEPS0_RKNS_4ListE
     187__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    112188__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
    113 __ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    114189__ZN3KJS8JSObject14implementsCallEv
    115190__ZN3KJS8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
    116191__ZN3KJS8JSObject17putDirectFunctionEPNS_19InternalFunctionImpEi
     192__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
    117193__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
    118 __ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
    119194__ZN3KJS8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    120195__ZN3KJS8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRPNS_7JSValueE
    121196__ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
     197__ZN3KJS8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    122198__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
    123 __ZN3KJS8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    124199__ZN3KJS8JSObject4markEv
    125200__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListE
    126201__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListERKNS_10IdentifierERKNS_7UStringEi
    127 __ZN3KJS8jsStringEPKc
    128 __ZN3KJS8jsStringERKNS_7UStringE
    129202__ZN3KJS8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
    130203__ZN3KJS8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
    131204__ZN3KJS8Profiler8profilerEv
     205__ZN3KJS8jsStringEPKc
     206__ZN3KJS8jsStringERKNS_7UStringE
    132207__ZN3KJS9Collector14allocateNumberEm
    133208__ZN3KJS9Collector15recordExtraCostEm
     
    206281__ZNK3KJS7UString8toUInt32EPb
    207282__ZNK3KJS7UString8toUInt32EPbb
     283__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
    208284__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
    209 __ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
    210285__ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
    211286__ZNK3KJS8JSObject12toThisObjectEPNS_9ExecStateE
     
    230305__ZTVN3KJS8JSObjectE
    231306__ZTVN3KJS9NumberImpE
    232 _JSCheckScriptSyntax
    233 _JSClassCreate
    234 _JSClassRelease
    235 _JSClassRetain
    236 _JSContextGetGlobalObject
    237307_jscore_collector_introspection
    238308_jscore_fastmalloc_introspection
    239 _JSEvaluateScript
    240 _JSGarbageCollect
    241 _JSGlobalContextCreate
    242 _JSGlobalContextRelease
    243 _JSGlobalContextRetain
    244 _JSObjectCallAsConstructor
    245 _JSObjectCallAsFunction
    246 _JSObjectCopyPropertyNames
    247 _JSObjectDeleteProperty
    248 _JSObjectGetPrivate
    249 _JSObjectGetProperty
    250 _JSObjectGetPropertyAtIndex
    251 _JSObjectGetPrototype
    252 _JSObjectHasProperty
    253 _JSObjectIsConstructor
    254 _JSObjectIsFunction
    255 _JSObjectMake
    256 _JSObjectMakeConstructor
    257 _JSObjectMakeFunction
    258 _JSObjectMakeFunctionWithCallback
    259 _JSObjectSetPrivate
    260 _JSObjectSetProperty
    261 _JSObjectSetPropertyAtIndex
    262 _JSObjectSetPrototype
    263 _JSPropertyNameAccumulatorAddName
    264 _JSPropertyNameArrayGetCount
    265 _JSPropertyNameArrayGetNameAtIndex
    266 _JSPropertyNameArrayRelease
    267 _JSPropertyNameArrayRetain
    268 _JSStringCopyCFString
    269 _JSStringCreateWithCFString
    270 _JSStringCreateWithCharacters
    271 _JSStringCreateWithUTF8CString
    272 _JSStringGetCharactersPtr
    273 _JSStringGetLength
    274 _JSStringGetMaximumUTF8CStringSize
    275 _JSStringGetUTF8CString
    276 _JSStringIsEqual
    277 _JSStringIsEqualToUTF8CString
    278 _JSStringRelease
    279 _JSStringRetain
    280 _JSValueGetType
    281 _JSValueIsBoolean
    282 _JSValueIsEqual
    283 _JSValueIsInstanceOfConstructor
    284 _JSValueIsNull
    285 _JSValueIsNumber
    286 _JSValueIsObject
    287 _JSValueIsObjectOfClass
    288 _JSValueIsStrictEqual
    289 _JSValueIsString
    290 _JSValueIsUndefined
    291 _JSValueMakeBoolean
    292 _JSValueMakeNull
    293 _JSValueMakeNumber
    294 _JSValueMakeString
    295 _JSValueMakeUndefined
    296 _JSValueProtect
    297 _JSValueToBoolean
    298 _JSValueToNumber
    299 _JSValueToObject
    300 _JSValueToStringCopy
    301 _JSValueUnprotect
    302309_kJSClassDefinitionEmpty
    303310_releaseFastMallocFreeMemory
    304 _WTFLog
    305 _WTFLogVerbose
    306 _WTFReportArgumentAssertionFailure
    307 _WTFReportAssertionFailure
    308 _WTFReportAssertionFailureWithMessage
    309 _WTFReportError
    310 _WTFReportFatalError
  • trunk/JavaScriptCore/VM/CodeBlock.cpp

    r34497 r34499  
    155155            ++instructionCount;
    156156
    157     printf("%lu instructions; %lu bytes at %p; %d locals (%d parameters); %d temporaries\n\n", instructionCount, instructions.size() * sizeof(Instruction), this, numLocals, numParameters, numTemporaries);
     157    printf("%lu instructions; %lu bytes at %p; %d locals (%d parameters); %d temporaries\n\n",
     158        static_cast<unsigned long>(instructionCount),
     159        static_cast<unsigned long>(instructions.size() * sizeof(Instruction)),
     160        this, numLocals, numParameters, numTemporaries);
    158161   
    159162    for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
  • trunk/JavaScriptCore/kjs/object.cpp

    r34355 r34499  
    520520// ------------------------------ Error ----------------------------------------
    521521
    522 const char * const errorNamesArr[] = {
    523   I18N_NOOP("Error"), // GeneralError
    524   I18N_NOOP("Evaluation error"), // EvalError
    525   I18N_NOOP("Range error"), // RangeError
    526   I18N_NOOP("Reference error"), // ReferenceError
    527   I18N_NOOP("Syntax error"), // SyntaxError
    528   I18N_NOOP("Type error"), // TypeError
    529   I18N_NOOP("URI error"), // URIError
    530 };
    531 
    532 const char * const * const Error::errorNames = errorNamesArr;
    533 
    534 JSObject *Error::create(ExecState *exec, ErrorType errtype, const UString &message,
    535                          int lineno, int sourceId, const UString &sourceURL)
    536 {
    537   JSObject *cons;
     522JSObject* Error::create(ExecState* exec, ErrorType errtype, const UString& message,
     523    int lineno, int sourceId, const UString& sourceURL)
     524{
     525  JSObject* cons;
     526  const char* name;
    538527  switch (errtype) {
    539528  case EvalError:
    540529    cons = exec->lexicalGlobalObject()->evalErrorConstructor();
     530    name = "Evaluation error";
    541531    break;
    542532  case RangeError:
    543533    cons = exec->lexicalGlobalObject()->rangeErrorConstructor();
     534    name = "Range error";
    544535    break;
    545536  case ReferenceError:
    546537    cons = exec->lexicalGlobalObject()->referenceErrorConstructor();
     538    name = "Reference error";
    547539    break;
    548540  case SyntaxError:
    549541    cons = exec->lexicalGlobalObject()->syntaxErrorConstructor();
     542    name = "Syntax error";
    550543    break;
    551544  case TypeError:
    552545    cons = exec->lexicalGlobalObject()->typeErrorConstructor();
     546    name = "Type error";
    553547    break;
    554548  case URIError:
    555549    cons = exec->lexicalGlobalObject()->URIErrorConstructor();
     550    name = "URI error";
    556551    break;
    557552  default:
    558553    cons = exec->lexicalGlobalObject()->errorConstructor();
     554    name = "Error";
    559555    break;
    560556  }
     
    562558  List args;
    563559  if (message.isEmpty())
    564     args.append(jsString(errorNames[errtype]));
     560    args.append(jsString(name));
    565561  else
    566562    args.append(jsString(message));
  • trunk/JavaScriptCore/kjs/object.h

    r34355 r34499  
    11// -*- c-basic-offset: 2 -*-
    22/*
    3  *  This file is part of the KDE libraries
    43 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    54 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    6  *  Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
     5 *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    76 *
    87 *  This library is free software; you can redistribute it and/or
     
    477476    static JSObject *create(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
    478477    static JSObject *create(ExecState *, ErrorType, const char *message);
    479 
    480     /**
    481      * Array of error names corresponding to ErrorType
    482      */
    483     static const char * const * const errorNames;
    484478  };
    485479
  • trunk/JavaScriptCore/kjs/property_slot.cpp

    r34355 r34499  
    3535}
    3636
    37 JSValue* PropertySlot::ungettableGetter(ExecState*, const Identifier&, const PropertySlot&)
    38 {
    39     ASSERT_NOT_REACHED();
    40     return jsUndefined();
    41 }
    42 
    4337JSValue* PropertySlot::functionGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
    4438{
  • trunk/JavaScriptCore/kjs/property_slot.h

    r34355 r34499  
    153153private:
    154154    static JSValue* undefinedGetter(ExecState*, const Identifier&, const PropertySlot&);
    155     static JSValue* ungettableGetter(ExecState*, const Identifier&, const PropertySlot&);
    156155    static JSValue* functionGetter(ExecState*, const Identifier&, const PropertySlot&);
    157156   
  • trunk/JavaScriptCore/wtf/AlwaysInline.h

    r34355 r34499  
    4646#endif
    4747#endif
     48
     49#ifndef LIKELY
     50#if COMPILER(GCC)
     51#define LIKELY(x) __builtin_expect((x), 1)
     52#else
     53#define LIKELY(x) (x)
     54#endif
     55#endif
Note: See TracChangeset for help on using the changeset viewer.