Changeset 96673 in webkit for trunk/Source/JavaScriptCore/API


Ignore:
Timestamp:
Oct 4, 2011, 7:38:49 PM (14 years ago)
Author:
[email protected]
Message:

Some JSValue cleanup
https://bugs.webkit.org/show_bug.cgi?id=69320

../JavaScriptCore:

Reviewed by Darin Adler.

No measurable performance change.

Removed some JSValue::get* functions. get* used to be an optimization
when every value operation was a virtual function call: get* would combine
two virtual calls into one. Now, with non-virtual, inlined functions, get*
isn't faster, and may be slightly slower.

Merged getBoolean(bool&) and getBoolean() into asBoolean().

Merged uncheckedGetNumber(), getJSNumber() and getNumber() into
asNumber().

  • runtime/JSValue.h:
  • runtime/JSValueInlineMethods.h:

(JSC::JSValue::asNumber):
(JSC::JSValue::asBoolean): As promised!

  • runtime/NumberPrototype.cpp:

(JSC::toThisNumber):
(JSC::numberProtoFuncToExponential):
(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToPrecision):
(JSC::numberProtoFuncToString):
(JSC::numberProtoFuncToLocaleString):
(JSC::numberProtoFuncValueOf): Removed a bunch of uses of getJSNumber()
by switching to toThisNumber().

  • API/JSCallbackObjectFunctions.h:

(JSC::::toNumber):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::valueOfNumberConstant):
(JSC::DFG::Graph::valueOfBooleanConstant):

  • dfg/DFGOperations.cpp:

(JSC::DFG::putByVal):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/DateInstance.h:

(JSC::DateInstance::internalNumber):

  • runtime/FunctionPrototype.cpp:

(JSC::functionProtoFuncBind):

  • runtime/JSArray.cpp:

(JSC::compareNumbersForQSort): Replaced getNumber() => isNumber() / asNumber().
getBoolean() => isBoolean() / asBoolean(), uncheckedGetNumber() => asNumber().

  • runtime/JSCell.cpp:
  • runtime/JSCell.h: Nixed getJSNumber().
  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncParseInt):

  • runtime/JSONObject.cpp:

(JSC::gap):
(JSC::Stringifier::Stringifier):
(JSC::Stringifier::appendStringifiedValue):

  • runtime/NumberObject.cpp:
  • runtime/NumberObject.h:

(JSC::NumberObject::createStructure):

  • runtime/Operations.h:

(JSC::JSValue::equalSlowCaseInline):
(JSC::JSValue::strictEqual):
(JSC::jsLess):
(JSC::jsLessEq):
(JSC::jsAdd): Replaced getNumber() => isNumber() / asNumber().
getBoolean() => isBoolean() / asBoolean(), uncheckedGetNumber() => asNumber().

../WebCore:

Reviewed by Darin Adler.

  • bindings/js/JSDOMBinding.cpp:

(WebCore::valueToDate):

  • bindings/js/JSErrorHandler.cpp:

(WebCore::JSErrorHandler::handleEvent):

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::handleEvent):

  • bindings/js/JSSQLTransactionCustom.cpp:

(WebCore::JSSQLTransaction::executeSql):

  • bindings/js/JSSQLTransactionSyncCustom.cpp:

(WebCore::JSSQLTransactionSync::executeSql):

  • bindings/js/ScriptValue.cpp:

(WebCore::jsToInspectorValue):

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneSerializer::dumpIfTerminal):

  • bindings/objc/WebScriptObject.mm:

(+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):

  • bridge/jni/jsc/JNIUtilityPrivate.cpp:

(JSC::Bindings::convertValueToJValue): Updated for JSC changes.

../WebKit/mac:

Reviewed by Darin Adler.

  • WebView/WebView.mm:

(aeDescFromJSValue): Updated for JSC changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r96465 r96673  
    481481                return 0;
    482482            }
    483 
    484             double dValue;
    485             if (value)
    486                 return toJS(exec, value).getNumber(dValue) ? dValue : std::numeric_limits<double>::quiet_NaN();
     483            if (!value)
     484                continue;
     485               
     486            JSValue jsValue = toJS(exec, value);
     487            if (!jsValue.isNumber())
     488                return std::numeric_limits<double>::quiet_NaN();
     489            return jsValue.asNumber();
    487490        }
    488491           
Note: See TracChangeset for help on using the changeset viewer.