Ignore:
Timestamp:
Oct 31, 2011, 6:15:06 PM (14 years ago)
Author:
[email protected]
Message:

De-virtualize JSObject::defaultValue
https://bugs.webkit.org/show_bug.cgi?id=71146

Reviewed by Sam Weinig.

Source/JavaScriptCore:

Added defaultValue to the MethodTable. Replaced all virtual versions of
defaultValue with static versions. Replaced all call sites with lookups in the
MethodTable.

(JSC::InterruptedExecutionError::defaultValue):
(JSC::TerminatedExecutionError::defaultValue):

  • runtime/ExceptionHelpers.h:
  • runtime/JSCell.cpp:

(JSC::JSCell::defaultValue):

  • runtime/JSCell.h:
  • runtime/JSNotAnObject.cpp:

(JSC::JSNotAnObject::defaultValue):

  • runtime/JSNotAnObject.h:
  • runtime/JSObject.cpp:

(JSC::JSObject::getPrimitiveNumber):
(JSC::JSObject::defaultValue):

  • runtime/JSObject.h:

(JSC::JSObject::toPrimitive):

Source/WebCore:

No new tests.

Added defaultValue to the MethodTable. Replaced all virtual versions of
defaultValue with static versions. Replaced all call sites with lookups in the
MethodTable.

  • WebCore.exp.in:
  • bridge/objc/objc_runtime.h:
  • bridge/objc/objc_runtime.mm:

(JSC::Bindings::ObjcFallbackObjectImp::defaultValue):

  • bridge/runtime_object.cpp:

(JSC::Bindings::RuntimeObject::defaultValue):

  • bridge/runtime_object.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r98909 r98932  
    309309bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const
    310310{
    311     result = defaultValue(exec, PreferNumber);
     311    result = methodTable()->defaultValue(this, exec, PreferNumber);
    312312    number = result.toNumber(exec);
    313313    return !result.isString();
     
    315315
    316316// ECMA 8.6.2.6
    317 JSValue JSObject::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const
     317JSValue JSObject::defaultValue(const JSObject* object, ExecState* exec, PreferredPrimitiveType hint)
    318318{
    319319    // Must call toString first for Date objects.
    320     if ((hint == PreferString) || (hint != PreferNumber && prototype() == exec->lexicalGlobalObject()->datePrototype())) {
    321         JSValue value = callDefaultValueFunction(exec, this, exec->propertyNames().toString);
     320    if ((hint == PreferString) || (hint != PreferNumber && object->prototype() == exec->lexicalGlobalObject()->datePrototype())) {
     321        JSValue value = callDefaultValueFunction(exec, object, exec->propertyNames().toString);
    322322        if (value)
    323323            return value;
    324         value = callDefaultValueFunction(exec, this, exec->propertyNames().valueOf);
     324        value = callDefaultValueFunction(exec, object, exec->propertyNames().valueOf);
    325325        if (value)
    326326            return value;
    327327    } else {
    328         JSValue value = callDefaultValueFunction(exec, this, exec->propertyNames().valueOf);
     328        JSValue value = callDefaultValueFunction(exec, object, exec->propertyNames().valueOf);
    329329        if (value)
    330330            return value;
    331         value = callDefaultValueFunction(exec, this, exec->propertyNames().toString);
     331        value = callDefaultValueFunction(exec, object, exec->propertyNames().toString);
    332332        if (value)
    333333            return value;
Note: See TracChangeset for help on using the changeset viewer.