Changeset 34499 in webkit for trunk/JavaScriptCore/kjs/object.cpp


Ignore:
Timestamp:
Jun 11, 2008, 3:01:40 PM (17 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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));
Note: See TracChangeset for help on using the changeset viewer.