Ignore:
Timestamp:
Dec 10, 2005, 4:38:07 PM (20 years ago)
Author:
darin
Message:

JavaScriptCore:

Reviewed by Maciej.

  • eliminated the old Undefined(), Null(), Boolean(), Number(), and String()

Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().

  • bindings/NP_jsobject.cpp: (_NPN_Evaluate):
  • bindings/c/c_instance.cpp: (KJS::Bindings::CInstance::invokeMethod): (KJS::Bindings::CInstance::invokeDefaultMethod):
  • bindings/c/c_runtime.cpp: (CField::valueFromInstance):
  • bindings/c/c_utility.cpp: (KJS::Bindings::convertNPVariantToValue):
  • bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): (JavaInstance::invokeDefaultMethod):
  • bindings/jni/jni_jsobject.cpp: (JSObject::eval): (JSObject::convertJObjectToValue):
  • bindings/jni/jni_runtime.cpp: (JavaArray::convertJObjectToArray): (JavaField::valueFromInstance): (JavaArray::valueAt):
  • bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject webScriptValueAtIndex:]):
  • bindings/objc/objc_instance.mm: (ObjcInstance::invokeMethod): (ObjcInstance::invokeDefaultMethod): (ObjcInstance::getValueOfUndefinedField):
  • bindings/objc/objc_runtime.mm: (ObjcField::valueFromInstance): (ObjcFallbackObjectImp::callAsFunction):
  • bindings/objc/objc_utility.mm: (KJS::Bindings::convertNSStringToString): (KJS::Bindings::convertObjcValueToValue):
  • bindings/runtime.h: (KJS::Bindings::Class::fallbackObject): (KJS::Bindings::Instance::getValueOfUndefinedField): (KJS::Bindings::Instance::valueOf):
  • bindings/runtime_array.cpp: (RuntimeArrayImp::lengthGetter):
  • bindings/runtime_method.cpp: (RuntimeMethodImp::lengthGetter): (RuntimeMethodImp::callAsFunction): (RuntimeMethodImp::execute):
  • kjs/array_object.cpp: (ArrayInstanceImp::lengthGetter): (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments): (ArrayPrototypeImp::ArrayPrototypeImp): (ArrayProtoFuncImp::ArrayProtoFuncImp): (ArrayProtoFuncImp::callAsFunction): (ArrayObjectImp::ArrayObjectImp):
  • kjs/bool_object.cpp: (BooleanPrototypeImp::BooleanPrototypeImp): (BooleanProtoFuncImp::callAsFunction): (BooleanObjectImp::BooleanObjectImp): (BooleanObjectImp::callAsFunction):
  • kjs/error_object.cpp: (ErrorPrototypeImp::ErrorPrototypeImp): (ErrorProtoFuncImp::ErrorProtoFuncImp): (ErrorProtoFuncImp::callAsFunction): (ErrorObjectImp::ErrorObjectImp): (NativeErrorImp::NativeErrorImp):
  • kjs/function.cpp: (KJS::FunctionImp::callAsFunction): (KJS::FunctionImp::processParameters): (KJS::FunctionImp::argumentsGetter): (KJS::FunctionImp::lengthGetter): (KJS::DeclaredFunctionImp::execute): (KJS::encode): (KJS::decode): (KJS::GlobalFuncImp::callAsFunction):
  • kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): (FunctionPrototypeImp::callAsFunction): (FunctionProtoFuncImp::callAsFunction): (FunctionObjectImp::FunctionObjectImp):
  • kjs/internal.cpp: (KJS::InterpreterImp::initGlobalObject):
  • kjs/interpreter.h:
  • kjs/lookup.h:
  • kjs/math_object.cpp: (MathObjectImp::getValueProperty): (MathFuncImp::callAsFunction):
  • kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): (NullNode::evaluate): (PropertyNode::evaluate): (FunctionCallBracketNode::evaluate): (FunctionCallDotNode::evaluate): (PostfixBracketNode::evaluate): (PostfixDotNode::evaluate): (VoidNode::evaluate): (PrefixBracketNode::evaluate): (PrefixDotNode::evaluate): (ShiftNode::evaluate): (valueForReadModifyAssignment): (AssignDotNode::evaluate): (AssignBracketNode::evaluate): (VarDeclNode::evaluate): (VarDeclNode::processVarDecls): (VarDeclListNode::evaluate): (ReturnNode::execute): (CaseClauseNode::evalStatements): (ParameterNode::evaluate): (FuncDeclNode::processFuncDecl):
  • kjs/nodes.h: (KJS::StatementNode::evaluate):
  • kjs/number_object.cpp: (NumberPrototypeImp::NumberPrototypeImp): (NumberProtoFuncImp::callAsFunction): (NumberObjectImp::NumberObjectImp): (NumberObjectImp::getValueProperty): (NumberObjectImp::callAsFunction):
  • kjs/object.cpp: (KJS::ObjectImp::get): (KJS::Error::create):
  • kjs/object_object.cpp: (ObjectPrototypeImp::ObjectPrototypeImp): (ObjectProtoFuncImp::callAsFunction): (ObjectObjectImp::ObjectObjectImp):
  • kjs/property_slot.cpp: (KJS::PropertySlot::undefinedGetter):
  • kjs/regexp_object.cpp: (RegExpPrototypeImp::RegExpPrototypeImp): (RegExpProtoFuncImp::callAsFunction): (RegExpObjectImp::RegExpObjectImp): (RegExpObjectImp::arrayOfMatches): (RegExpObjectImp::getBackref): (RegExpObjectImp::getLastMatch): (RegExpObjectImp::getLastParen): (RegExpObjectImp::getLeftContext): (RegExpObjectImp::getRightContext): (RegExpObjectImp::getValueProperty): (RegExpObjectImp::construct):
  • kjs/string_object.cpp: (StringInstanceImp::StringInstanceImp): (StringPrototypeImp::StringPrototypeImp): (replace): (StringProtoFuncImp::callAsFunction): (StringObjectImp::StringObjectImp): (StringObjectImp::callAsFunction): (StringObjectFuncImp::StringObjectFuncImp): (StringObjectFuncImp::callAsFunction):
  • kjs/testkjs.cpp: (TestFunctionImp::callAsFunction): (VersionFunctionImp::callAsFunction):
  • kjs/value.h:

WebCore:

Reviewed by Maciej.

  • eliminated the old Undefined(), Null(), Boolean(), Number(), and String()

Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().

  • khtml/ecma/domparser.cpp: (KJS::DOMParserProtoFunc::callAsFunction):
  • khtml/ecma/kjs_binding.cpp: (KJS::jsStringOrNull): (KJS::setDOMException):
  • khtml/ecma/kjs_binding.h: (KJS::DOMFunction::toPrimitive):
  • khtml/ecma/kjs_css.cpp: (KJS::DOMCSSStyleDeclaration::indexGetter): (KJS::DOMCSSStyleDeclaration::cssPropertyGetter): (KJS::DOMCSSStyleDeclaration::getValueProperty): (KJS::DOMCSSStyleDeclarationProtoFunc::callAsFunction): (KJS::DOMStyleSheet::getValueProperty): (KJS::getDOMStyleSheet): (KJS::DOMStyleSheetList::getValueProperty): (KJS::getDOMStyleSheetList): (KJS::DOMStyleSheetListFunc::callAsFunction): (KJS::DOMMediaList::getValueProperty): (KJS::DOMMediaList::indexGetter): (KJS::KJS::DOMMediaListProtoFunc::callAsFunction): (KJS::DOMCSSStyleSheet::getValueProperty): (KJS::DOMCSSStyleSheetProtoFunc::callAsFunction): (KJS::DOMCSSRuleList::getValueProperty): (KJS::DOMCSSRuleListFunc::callAsFunction): (KJS::DOMCSSRule::getValueProperty): (KJS::DOMCSSRuleFunc::callAsFunction): (KJS::CSSRuleConstructor::getValueProperty): (KJS::DOMCSSValue::getValueProperty): (KJS::getDOMCSSValue): (KJS::CSSValueConstructor::getValueProperty): (KJS::DOMCSSPrimitiveValue::getValueProperty): (KJS::DOMCSSPrimitiveValueProtoFunc::callAsFunction): (KJS::CSSPrimitiveValueConstructor::getValueProperty): (KJS::DOMCSSValueList::getValueProperty): (KJS::DOMCSSValueListFunc::callAsFunction): (KJS::DOMCounter::getValueProperty):
  • khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::getValueProperty): (KJS::DOMNode::toPrimitive): (KJS::DOMNode::getListener): (KJS::DOMNodeProtoFunc::callAsFunction): (KJS::DOMNodeList::toPrimitive): (KJS::DOMNodeList::getValueProperty): (KJS::DOMNodeList::callAsFunction): (KJS::DOMAttr::getValueProperty): (KJS::DOMDocument::getValueProperty): (KJS::DOMDocumentProtoFunc::callAsFunction): (KJS::DOMElement::getValueProperty): (KJS::DOMElement::attributeGetter): (KJS::DOMElementProtoFunc::callAsFunction): (KJS::DOMDOMImplementationProtoFunc::callAsFunction): (KJS::DOMDocumentType::getValueProperty): (KJS::DOMNamedNodeMap::lengthGetter): (KJS::DOMNamedNodeMapProtoFunc::callAsFunction): (KJS::DOMProcessingInstruction::getValueProperty): (KJS::DOMNotation::getValueProperty): (KJS::DOMEntity::getValueProperty): (KJS::getDOMNode): (KJS::NodeConstructor::getValueProperty): (KJS::DOMExceptionConstructor::getValueProperty): (KJS::DOMNamedNodesCollection::lengthGetter): (KJS::DOMCharacterData::getValueProperty): (KJS::DOMCharacterDataProtoFunc::callAsFunction): (KJS::DOMTextProtoFunc::callAsFunction):
  • khtml/ecma/kjs_events.cpp: (KJS::JSLazyEventListener::parseCode): (KJS::EventConstructor::getValueProperty): (KJS::DOMEvent::getValueProperty): (KJS::DOMEventProtoFunc::callAsFunction): (KJS::getDOMEvent): (KJS::EventExceptionConstructor::getValueProperty): (KJS::DOMUIEvent::getValueProperty): (KJS::DOMUIEventProtoFunc::callAsFunction): (KJS::DOMMouseEvent::getValueProperty): (KJS::DOMMouseEventProtoFunc::callAsFunction): (KJS::DOMKeyboardEvent::getValueProperty): (KJS::DOMKeyboardEventProtoFunc::callAsFunction): (KJS::MutationEventConstructor::getValueProperty): (KJS::DOMMutationEvent::getValueProperty): (KJS::DOMMutationEventProtoFunc::callAsFunction): (KJS::DOMWheelEvent::getValueProperty): (KJS::DOMWheelEventProtoFunc::callAsFunction): (KJS::stringOrUndefined): (KJS::Clipboard::getValueProperty): (KJS::ClipboardProtoFunc::callAsFunction):
  • khtml/ecma/kjs_html.cpp: (KJS::KJS::HTMLDocFunction::callAsFunction): (KJS::HTMLDocument::getValueProperty): (KJS::HTMLElement::framesetNameGetter): (KJS::HTMLElement::frameWindowPropertyGetter): (KJS::HTMLElement::runtimeObjectPropertyGetter): (KJS::KJS::HTMLElement::callAsFunction): (KJS::HTMLElement::htmlGetter): (KJS::HTMLElement::headGetter): (KJS::HTMLElement::linkGetter): (KJS::HTMLElement::titleGetter): (KJS::HTMLElement::metaGetter): (KJS::HTMLElement::baseGetter): (KJS::HTMLElement::isIndexGetter): (KJS::HTMLElement::styleGetter): (KJS::HTMLElement::bodyGetter): (KJS::HTMLElement::formGetter): (KJS::HTMLElement::selectGetter): (KJS::HTMLElement::optGroupGetter): (KJS::HTMLElement::optionGetter): (KJS::getInputSelectionStart): (KJS::getInputSelectionEnd): (KJS::HTMLElement::inputGetter): (KJS::HTMLElement::textAreaGetter): (KJS::HTMLElement::buttonGetter): (KJS::HTMLElement::labelGetter): (KJS::HTMLElement::fieldSetGetter): (KJS::HTMLElement::legendGetter): (KJS::HTMLElement::uListGetter): (KJS::HTMLElement::oListGetter): (KJS::HTMLElement::dListGetter): (KJS::HTMLElement::dirGetter): (KJS::HTMLElement::menuGetter): (KJS::HTMLElement::liGetter): (KJS::HTMLElement::divGetter): (KJS::HTMLElement::paragraphGetter): (KJS::HTMLElement::headingGetter): (KJS::HTMLElement::blockQuoteGetter): (KJS::HTMLElement::quoteGetter): (KJS::HTMLElement::preGetter): (KJS::HTMLElement::brGetter): (KJS::HTMLElement::baseFontGetter): (KJS::HTMLElement::fontGetter): (KJS::HTMLElement::hrGetter): (KJS::HTMLElement::modGetter): (KJS::HTMLElement::anchorGetter): (KJS::HTMLElement::imageGetter): (KJS::HTMLElement::objectGetter): (KJS::HTMLElement::paramGetter): (KJS::HTMLElement::appletGetter): (KJS::HTMLElement::mapGetter): (KJS::HTMLElement::areaGetter): (KJS::HTMLElement::scriptGetter): (KJS::HTMLElement::tableGetter): (KJS::HTMLElement::tableCaptionGetter): (KJS::HTMLElement::tableColGetter): (KJS::HTMLElement::tableSectionGetter): (KJS::HTMLElement::tableRowGetter): (KJS::HTMLElement::tableCellGetter): (KJS::HTMLElement::frameSetGetter): (KJS::HTMLElement::frameGetter): (KJS::HTMLElement::iFrameGetter): (KJS::HTMLElement::marqueeGetter): (KJS::HTMLElement::getValueProperty): (KJS::HTMLElementFunction::HTMLElementFunction): (KJS::KJS::HTMLElementFunction::callAsFunction): (KJS::HTMLCollection::lengthGetter): (KJS::KJS::HTMLCollection::callAsFunction): (KJS::KJS::HTMLCollection::getNamedItems): (KJS::KJS::HTMLCollectionProtoFunc::callAsFunction): (KJS::HTMLSelectCollection::selectedIndexGetter): (KJS::HTMLSelectCollection::getOwnPropertySlot): (KJS::OptionConstructorImp::OptionConstructorImp): (KJS::Image::getValueProperty): (KJS::KJS::Context2DFunction::callAsFunction): (KJS::Context2D::getValueProperty): (KJS::Context2D::Context2D): (KJS::GradientFunction::callAsFunction): (KJS::Gradient::getValueProperty): (KJS::ImagePattern::getValueProperty): (KJS::getSelectHTMLCollection):
  • khtml/ecma/kjs_navigator.cpp: (KJS::Navigator::getValueProperty): (KJS::Plugins::getValueProperty): (KJS::Plugins::nameGetter): (KJS::MimeTypes::getValueProperty): (KJS::MimeTypes::nameGetter): (KJS::Plugin::getValueProperty): (KJS::Plugin::nameGetter): (KJS::MimeType::getValueProperty): (KJS::PluginsFunc::callAsFunction): (KJS::NavigatorFunc::callAsFunction):
  • khtml/ecma/kjs_proxy.cpp: (TestFunctionImp::callAsFunction):
  • khtml/ecma/kjs_range.cpp: (KJS::DOMRange::getValueProperty): (KJS::DOMRangeProtoFunc::callAsFunction): (KJS::RangeConstructor::getValueProperty):
  • khtml/ecma/kjs_traversal.cpp: (KJS::DOMNodeIterator::getValueProperty): (KJS::DOMNodeIteratorProtoFunc::callAsFunction): (KJS::NodeFilterConstructor::getValueProperty): (KJS::DOMNodeFilterProtoFunc::callAsFunction): (KJS::DOMTreeWalker::getValueProperty): (KJS::DOMTreeWalkerProtoFunc::callAsFunction):
  • khtml/ecma/kjs_views.cpp: (KJS::DOMAbstractViewProtoFunc::callAsFunction):
  • khtml/ecma/kjs_window.cpp: (KJS::Screen::getValueProperty): (KJS::Window::retrieve): (KJS::showModalDialog): (KJS::Window::getValueProperty): (KJS::Window::getListener): (KJS::WindowFunc::callAsFunction): (KJS::FrameArray::getValueProperty): (KJS::FrameArray::indexGetter): (KJS::FrameArray::nameGetter): (KJS::Location::getValueProperty): (KJS::Location::toPrimitive): (KJS::LocationFunc::callAsFunction): (KJS::Selection::getValueProperty): (KJS::Selection::toPrimitive): (KJS::SelectionFunc::callAsFunction): (KJS::BarInfo::getValueProperty): (KJS::History::getValueProperty): (KJS::HistoryFunc::callAsFunction):
  • khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::getValueProperty): (KJS::XMLHttpRequest::getAllResponseHeaders): (KJS::XMLHttpRequest::getResponseHeader): (KJS::XMLHttpRequest::getStatus): (KJS::XMLHttpRequest::getStatusText): (KJS::XMLHttpRequestProtoFunc::callAsFunction):
  • khtml/ecma/xmlserializer.cpp: (KJS::XMLSerializerProtoFunc::callAsFunction):
  • ksvg2/ecma/Ecma.cpp: (KSVG::getSVGPathSeg):
  • ksvg2/ecma/GlobalObject.cpp: (GlobalObject::get):
  • kwq/WebCoreScriptDebugger.mm: (-[WebCoreScriptCallFrame evaluateWebScript:]):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/regexp_object.cpp

    r11034 r11525  
    5050  : ObjectImp(objProto)
    5151{
    52   setInternalValue(String(""));
     52  setInternalValue(jsString(""));
    5353
    5454  // The constructor will be added later in RegExpObject's constructor (?)
     
    8080    if (thisObj->inherits(&RegExpPrototypeImp::info)) {
    8181      switch (id) {
    82         case ToString: return String("//");
     82        case ToString: return jsString("//");
    8383      }
    8484    }
     
    106106      lastIndex = 0;
    107107    if (lastIndex < 0 || lastIndex > input.size()) {
    108       thisObj->put(exec, "lastIndex", jsZero(), DontDelete | DontEnum);
    109       return Null();
     108      thisObj->put(exec, "lastIndex", jsNumber(0), DontDelete | DontEnum);
     109      return jsNull();
    110110    }
    111111
     
    116116    // Test
    117117    if (id == Test)
    118       return Boolean(didMatch);
     118      return jsBoolean(didMatch);
    119119
    120120    // Exec
    121121    if (didMatch) {
    122122      if (globalFlag)
    123         thisObj->put(exec, "lastIndex", Number(foundIndex + match.size()), DontDelete | DontEnum);
     123        thisObj->put(exec, "lastIndex", jsNumber(foundIndex + match.size()), DontDelete | DontEnum);
    124124      return regExpObj->arrayOfMatches(exec, match);
    125125    } else {
    126126      if (globalFlag)
    127         thisObj->put(exec, "lastIndex", jsZero(), DontDelete | DontEnum);
    128       return Null();
     127        thisObj->put(exec, "lastIndex", jsNumber(0), DontDelete | DontEnum);
     128      return jsNull();
    129129    }
    130130  }
     
    141141      result += "m";
    142142    }
    143     return String(result);
    144   }
    145 
    146   return Undefined();
     143    return jsString(result);
     144  }
     145
     146  return jsUndefined();
    147147}
    148148
     
    201201
    202202  // no. of arguments for constructor
    203   putDirect(lengthPropertyName, jsTwo(), ReadOnly|DontDelete|DontEnum);
     203  putDirect(lengthPropertyName, jsNumber(2), ReadOnly|DontDelete|DontEnum);
    204204}
    205205
     
    241241  List list;
    242242  // The returned array contains 'result' as first item, followed by the list of matches
    243   list.append(String(result));
     243  list.append(jsString(result));
    244244  if ( lastOvector )
    245245    for ( unsigned i = 1 ; i < lastNumSubPatterns + 1 ; ++i )
     
    250250      else {
    251251        UString substring = lastInput.substr( start, lastOvector[2*i+1] - start );
    252         list.append(String(substring));
     252        list.append(jsString(substring));
    253253      }
    254254    }
    255255  ObjectImp *arr = exec->lexicalInterpreter()->builtinArray()->construct(exec, list);
    256   arr->put(exec, "index", Number(lastOvector[0]));
    257   arr->put(exec, "input", String(lastInput));
     256  arr->put(exec, "index", jsNumber(lastOvector[0]));
     257  arr->put(exec, "input", jsString(lastInput));
    258258  return arr;
    259259}
     
    263263  if (lastOvector && i < lastNumSubPatterns + 1) {
    264264    UString substring = lastInput.substr(lastOvector[2*i], lastOvector[2*i+1] - lastOvector[2*i] );
    265     return String(substring);
     265    return jsString(substring);
    266266  }
    267267
    268   return String("");
     268  return jsString("");
    269269}
    270270
     
    273273  if (lastOvector) {
    274274    UString substring = lastInput.substr(lastOvector[0], lastOvector[1] - lastOvector[0]);
    275     return String(substring);
    276   }
    277  
    278   return String("");
     275    return jsString(substring);
     276  }
     277 
     278  return jsString("");
    279279}
    280280
     
    285285    assert(lastOvector);
    286286    UString substring = lastInput.substr(lastOvector[2*i], lastOvector[2*i+1] - lastOvector[2*i]);
    287     return String(substring);
     287    return jsString(substring);
    288288  }
    289289   
    290   return String("");
     290  return jsString("");
    291291}
    292292
     
    295295  if (lastOvector) {
    296296    UString substring = lastInput.substr(0, lastOvector[0]);
    297     return String(substring);
    298   }
    299  
    300   return String("");
     297    return jsString(substring);
     298  }
     299 
     300  return jsString("");
    301301}
    302302
     
    306306    UString s = lastInput;
    307307    UString substring = s.substr(lastOvector[1], s.size() - lastOvector[1]);
    308     return String(substring);
    309   }
    310  
    311   return String("");
     308    return jsString(substring);
     309  }
     310 
     311  return jsString("");
    312312}
    313313
     
    354354  }
    355355
    356   return String("");
     356  return jsString("");
    357357}
    358358
     
    407407
    408408  dat->putDirect("source", jsString(p), DontDelete | ReadOnly | DontEnum);
    409   dat->putDirect("lastIndex", jsZero(), DontDelete | DontEnum);
     409  dat->putDirect("lastIndex", jsNumber(0), DontDelete | DontEnum);
    410410
    411411  int reflags = RegExp::None;
Note: See TracChangeset for help on using the changeset viewer.