Commit ae0687ba authored by oliver@apple.com's avatar oliver@apple.com

Refactor static getter function prototype to include thisValue in addition to the base object

https://bugs.webkit.org/show_bug.cgi?id=124461

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Add thisValue parameter to static getter prototype, and switch
from JSValue to EncodedJSValue for parameters and return value.

Currently none of the static getters use the thisValue, but
separating out the refactoring will prevent future changes
from getting lost in the noise of refactoring.  This means
that this patch does not result in any change in behaviour.

* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::asCallbackObject):
(JSC::::staticFunctionGetter):
(JSC::::callbackGetter):
* jit/JITOperations.cpp:
* runtime/JSActivation.cpp:
(JSC::JSActivation::argumentsGetter):
* runtime/JSActivation.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::argumentsGetter):
(JSC::JSFunction::callerGetter):
(JSC::JSFunction::lengthGetter):
(JSC::JSFunction::nameGetter):
* runtime/JSFunction.h:
* runtime/JSObject.h:
(JSC::PropertySlot::getValue):
* runtime/NumberConstructor.cpp:
(JSC::numberConstructorNaNValue):
(JSC::numberConstructorNegInfinity):
(JSC::numberConstructorPosInfinity):
(JSC::numberConstructorMaxValue):
(JSC::numberConstructorMinValue):
* runtime/PropertySlot.h:
* runtime/RegExpConstructor.cpp:
(JSC::asRegExpConstructor):
(JSC::regExpConstructorDollar1):
(JSC::regExpConstructorDollar2):
(JSC::regExpConstructorDollar3):
(JSC::regExpConstructorDollar4):
(JSC::regExpConstructorDollar5):
(JSC::regExpConstructorDollar6):
(JSC::regExpConstructorDollar7):
(JSC::regExpConstructorDollar8):
(JSC::regExpConstructorDollar9):
(JSC::regExpConstructorInput):
(JSC::regExpConstructorMultiline):
(JSC::regExpConstructorLastMatch):
(JSC::regExpConstructorLastParen):
(JSC::regExpConstructorLeftContext):
(JSC::regExpConstructorRightContext):
* runtime/RegExpObject.cpp:
(JSC::asRegExpObject):
(JSC::regExpObjectGlobal):
(JSC::regExpObjectIgnoreCase):
(JSC::regExpObjectMultiline):
(JSC::regExpObjectSource):

Source/WebCore:

Change bindings codegen to produce static getter functions
with the correct types.  Also update the many custom implementations
to the new type.

No change in behaviour.

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::cssPropertyGetterPixelOrPosPrefixCallback):
(WebCore::cssPropertyGetterCallback):
* bindings/js/JSDOMBinding.cpp:
(WebCore::objectToStringFunctionGetter):
* bindings/js/JSDOMBinding.h:
* bindings/js/JSDOMMimeTypeArrayCustom.cpp:
(WebCore::JSDOMMimeTypeArray::nameGetter):
* bindings/js/JSDOMPluginArrayCustom.cpp:
(WebCore::JSDOMPluginArray::nameGetter):
* bindings/js/JSDOMPluginCustom.cpp:
(WebCore::JSDOMPlugin::nameGetter):
* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::nameGetter):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::nonCachingStaticFunctionGetter):
(WebCore::childFrameGetter):
(WebCore::indexGetter):
(WebCore::namedItemGetter):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::JSHTMLAllCollection::nameGetter):
* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::JSHTMLCollection::nameGetter):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::nameGetter):
* bindings/js/JSHTMLFormControlsCollectionCustom.cpp:
(WebCore::JSHTMLFormControlsCollection::nameGetter):
* bindings/js/JSHTMLFormElementCustom.cpp:
(WebCore::JSHTMLFormElement::nameGetter):
* bindings/js/JSHTMLFrameSetElementCustom.cpp:
(WebCore::JSHTMLFrameSetElement::nameGetter):
* bindings/js/JSHistoryCustom.cpp:
(WebCore::nonCachingStaticBackFunctionGetter):
(WebCore::nonCachingStaticForwardFunctionGetter):
(WebCore::nonCachingStaticGoFunctionGetter):
* bindings/js/JSJavaScriptCallFrameCustom.cpp:
(WebCore::JSJavaScriptCallFrame::scopeType):
* bindings/js/JSLocationCustom.cpp:
(WebCore::nonCachingStaticReplaceFunctionGetter):
(WebCore::nonCachingStaticReloadFunctionGetter):
(WebCore::nonCachingStaticAssignFunctionGetter):
* bindings/js/JSNamedNodeMapCustom.cpp:
(WebCore::JSNamedNodeMap::nameGetter):
* bindings/js/JSNodeListCustom.cpp:
(WebCore::JSNodeList::nameGetter):
* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::pluginElementPropertyGetter):
* bindings/js/JSPluginElementFunctions.h:
* bindings/js/JSRTCStatsResponseCustom.cpp:
(WebCore::JSRTCStatsResponse::nameGetter):
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::nameGetter):
* bindings/js/JSStyleSheetListCustom.cpp:
(WebCore::JSStyleSheetList::nameGetter):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
(GenerateParametersCheck):
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::lengthGetter):
(JSC::RuntimeArray::indexGetter):
* bridge/runtime_array.h:
* bridge/runtime_method.cpp:
(JSC::RuntimeMethod::lengthGetter):
* bridge/runtime_method.h:
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::fallbackObjectGetter):
(JSC::Bindings::RuntimeObject::fieldGetter):
(JSC::Bindings::RuntimeObject::methodGetter):
* bridge/runtime_object.h:

Source/WebKit2:

Update the WK2 JSC usage to the new static getter API

* WebProcess/Plugins/Netscape/JSNPMethod.cpp:
(WebKit::callMethod):
* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::callNPJSObject):
(WebKit::constructWithConstructor):
(WebKit::JSNPObject::propertyGetter):
(WebKit::JSNPObject::methodGetter):
* WebProcess/Plugins/Netscape/JSNPObject.h:
* WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::getOrCreateNPObject):
(WebKit::NPRuntimeObjectMap::finalize):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::frameForContext):
(WebKit::WebFrame::counterValue):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ca4d5712
......@@ -205,13 +205,14 @@ private:
void init(ExecState*);
static JSCallbackObject* asCallbackObject(JSValue);
static JSCallbackObject* asCallbackObject(EncodedJSValue);
static EncodedJSValue JSC_HOST_CALL call(ExecState*);
static EncodedJSValue JSC_HOST_CALL construct(ExecState*);
JSValue getStaticValue(ExecState*, PropertyName);
static JSValue staticFunctionGetter(ExecState*, JSValue, PropertyName);
static JSValue callbackGetter(ExecState*, JSValue, PropertyName);
static EncodedJSValue staticFunctionGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue callbackGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
OwnPtr<JSCallbackObjectData> m_callbackObjectData;
};
......
......@@ -49,6 +49,13 @@ inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(JSVa
return jsCast<JSCallbackObject*>(asObject(value));
}
template <class Parent>
inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(EncodedJSValue value)
{
ASSERT(asObject(JSValue::decode(value))->inherits(info()));
return jsCast<JSCallbackObject*>(asObject(JSValue::decode(value)));
}
template <class Parent>
JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, Structure* structure, JSClassRef jsClass, void* data)
: Parent(exec->vm(), structure)
......@@ -584,14 +591,14 @@ JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, PropertyName p
}
template <class Parent>
JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName)
EncodedJSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, EncodedJSValue slotParent, EncodedJSValue, PropertyName propertyName)
{
JSCallbackObject* thisObj = asCallbackObject(slotParent);
// Check for cached or override property.
PropertySlot slot2(thisObj);
if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2))
return slot2.getValue(exec, propertyName);
return JSValue::encode(slot2.getValue(exec, propertyName));
if (StringImpl* name = propertyName.publicName()) {
for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
......@@ -601,18 +608,18 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue
VM& vm = exec->vm();
JSObject* o = JSCallbackFunction::create(vm, thisObj->globalObject(), callAsFunction, name);
thisObj->putDirect(vm, propertyName, o, entry->attributes);
return o;
return JSValue::encode(o);
}
}
}
}
}
return exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("Static function property defined with NULL callAsFunction callback.")));
return JSValue::encode(exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("Static function property defined with NULL callAsFunction callback."))));
}
template <class Parent>
JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName)
EncodedJSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, EncodedJSValue slotParent, EncodedJSValue, PropertyName propertyName)
{
JSCallbackObject* thisObj = asCallbackObject(slotParent);
......@@ -632,15 +639,15 @@ JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotPa
}
if (exception) {
exec->vm().throwException(exec, toJS(exec, exception));
return jsUndefined();
return JSValue::encode(jsUndefined());
}
if (value)
return toJS(exec, value);
return JSValue::encode(toJS(exec, value));
}
}
}
return exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("hasProperty callback returned true for a property that doesn't exist.")));
return JSValue::encode(exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("hasProperty callback returned true for a property that doesn't exist."))));
}
} // namespace JSC
2013-12-04 Oliver Hunt <oliver@apple.com>
Refactor static getter function prototype to include thisValue in addition to the base object
https://bugs.webkit.org/show_bug.cgi?id=124461
Reviewed by Geoffrey Garen.
Add thisValue parameter to static getter prototype, and switch
from JSValue to EncodedJSValue for parameters and return value.
Currently none of the static getters use the thisValue, but
separating out the refactoring will prevent future changes
from getting lost in the noise of refactoring. This means
that this patch does not result in any change in behaviour.
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::asCallbackObject):
(JSC::::staticFunctionGetter):
(JSC::::callbackGetter):
* jit/JITOperations.cpp:
* runtime/JSActivation.cpp:
(JSC::JSActivation::argumentsGetter):
* runtime/JSActivation.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::argumentsGetter):
(JSC::JSFunction::callerGetter):
(JSC::JSFunction::lengthGetter):
(JSC::JSFunction::nameGetter):
* runtime/JSFunction.h:
* runtime/JSObject.h:
(JSC::PropertySlot::getValue):
* runtime/NumberConstructor.cpp:
(JSC::numberConstructorNaNValue):
(JSC::numberConstructorNegInfinity):
(JSC::numberConstructorPosInfinity):
(JSC::numberConstructorMaxValue):
(JSC::numberConstructorMinValue):
* runtime/PropertySlot.h:
* runtime/RegExpConstructor.cpp:
(JSC::asRegExpConstructor):
(JSC::regExpConstructorDollar1):
(JSC::regExpConstructorDollar2):
(JSC::regExpConstructorDollar3):
(JSC::regExpConstructorDollar4):
(JSC::regExpConstructorDollar5):
(JSC::regExpConstructorDollar6):
(JSC::regExpConstructorDollar7):
(JSC::regExpConstructorDollar8):
(JSC::regExpConstructorDollar9):
(JSC::regExpConstructorInput):
(JSC::regExpConstructorMultiline):
(JSC::regExpConstructorLastMatch):
(JSC::regExpConstructorLastParen):
(JSC::regExpConstructorLeftContext):
(JSC::regExpConstructorRightContext):
* runtime/RegExpObject.cpp:
(JSC::asRegExpObject):
(JSC::regExpObjectGlobal):
(JSC::regExpObjectIgnoreCase):
(JSC::regExpObjectMultiline):
(JSC::regExpObjectSource):
2013-12-04 Filip Pizlo <fpizlo@apple.com>
FTL should use cvttsd2si directly for double-to-int32 conversions
......
......@@ -222,7 +222,7 @@ EncodedJSValue JIT_OPERATION operationCallCustomGetter(ExecState* exec, JSCell*
Identifier ident(vm, uid);
return JSValue::encode(function(exec, asObject(base), ident));
return function(exec, JSValue::encode(base), JSValue::encode(base), ident);
}
EncodedJSValue JIT_OPERATION operationCallGetter(ExecState* exec, JSCell* base, JSCell* getterSetter)
......
......@@ -210,17 +210,17 @@ JSValue JSActivation::toThis(JSCell*, ExecState* exec, ECMAMode ecmaMode)
return exec->globalThisValue();
}
JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, PropertyName)
EncodedJSValue JSActivation::argumentsGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
JSActivation* activation = jsCast<JSActivation*>(slotBase);
JSActivation* activation = jsCast<JSActivation*>(JSValue::decode(slotBase));
CallFrame* callFrame = CallFrame::create(reinterpret_cast<Register*>(activation->m_registers));
ASSERT(!activation->isTornOff() && (callFrame->codeBlock()->usesArguments() || callFrame->codeBlock()->usesEval()));
if (activation->isTornOff() || !(callFrame->codeBlock()->usesArguments() || callFrame->codeBlock()->usesEval()))
return jsUndefined();
return JSValue::encode(jsUndefined());
VirtualRegister argumentsRegister = callFrame->codeBlock()->argumentsRegister();
if (JSValue arguments = callFrame->uncheckedR(argumentsRegister.offset()).jsValue())
return arguments;
return JSValue::encode(arguments);
int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister).offset();
JSValue arguments = JSValue(Arguments::create(callFrame->vm(), callFrame));
......@@ -228,7 +228,7 @@ JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, PropertyName
callFrame->uncheckedR(realArgumentsRegister) = arguments;
ASSERT(callFrame->uncheckedR(realArgumentsRegister).jsValue().inherits(Arguments::info()));
return callFrame->uncheckedR(realArgumentsRegister).jsValue();
return JSValue::encode(callFrame->uncheckedR(realArgumentsRegister).jsValue());
}
} // namespace JSC
......@@ -100,7 +100,7 @@ private:
bool symbolTablePut(ExecState*, PropertyName, JSValue, bool shouldThrow);
bool symbolTablePutWithAttributes(VM&, PropertyName, JSValue, unsigned attributes);
static JSValue argumentsGetter(ExecState*, JSValue, PropertyName);
static EncodedJSValue argumentsGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static size_t allocationSize(SymbolTable*);
static size_t storageOffset();
......
......@@ -212,12 +212,12 @@ static JSValue retrieveArguments(ExecState* exec, JSFunction* functionObj)
return functor.result();
}
JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue JSFunction::argumentsGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
ASSERT(!thisObj->isHostFunction());
return retrieveArguments(exec, thisObj);
return JSValue::encode(retrieveArguments(exec, thisObj));
}
class RetrieveCallerFunctionFunctor {
......@@ -267,33 +267,33 @@ static JSValue retrieveCallerFunction(ExecState* exec, JSFunction* functionObj)
return functor.result();
}
JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue JSFunction::callerGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
ASSERT(!thisObj->isHostFunction());
JSValue caller = retrieveCallerFunction(exec, thisObj);
// See ES5.1 15.3.5.4 - Function.caller may not be used to retrieve a strict caller.
if (!caller.isObject() || !asObject(caller)->inherits(JSFunction::info()))
return caller;
return JSValue::encode(caller);
JSFunction* function = jsCast<JSFunction*>(caller);
if (function->isHostFunction() || !function->jsExecutable()->isStrictMode())
return caller;
return throwTypeError(exec, ASCIILiteral("Function.caller used to retrieve strict caller"));
return JSValue::encode(caller);
return JSValue::encode(throwTypeError(exec, ASCIILiteral("Function.caller used to retrieve strict caller")));
}
JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, PropertyName)
EncodedJSValue JSFunction::lengthGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
ASSERT(!thisObj->isHostFunction());
return jsNumber(thisObj->jsExecutable()->parameterCount());
return JSValue::encode(jsNumber(thisObj->jsExecutable()->parameterCount()));
}
JSValue JSFunction::nameGetter(ExecState*, JSValue slotBase, PropertyName)
EncodedJSValue JSFunction::nameGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
ASSERT(!thisObj->isHostFunction());
return thisObj->jsExecutable()->nameValue();
return JSValue::encode(thisObj->jsExecutable()->nameValue());
}
bool JSFunction::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
......
......@@ -171,10 +171,10 @@ namespace JSC {
JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const;
static JSValue argumentsGetter(ExecState*, JSValue, PropertyName);
static JSValue callerGetter(ExecState*, JSValue, PropertyName);
static JSValue lengthGetter(ExecState*, JSValue, PropertyName);
static JSValue nameGetter(ExecState*, JSValue, PropertyName);
static EncodedJSValue argumentsGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue callerGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue lengthGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue nameGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
WriteBarrier<ExecutableBase> m_executable;
WriteBarrier<JSScope> m_scope;
......
......@@ -1535,10 +1535,10 @@ ALWAYS_INLINE JSValue PropertySlot::getValue(ExecState* exec, PropertyName prope
if (m_propertyType == TypeValue)
return JSValue::decode(m_data.value);
if (m_propertyType == TypeCustomIndex)
return m_data.customIndex.getIndexValue(exec, slotBase(), m_data.customIndex.index);
return JSValue::decode(m_data.customIndex.getIndexValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), m_data.customIndex.index));
if (m_propertyType == TypeGetter)
return functionGetter(exec);
return m_data.custom.getValue(exec, slotBase(), propertyName);
return JSValue::decode(m_data.custom.getValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), propertyName));
}
ALWAYS_INLINE JSValue PropertySlot::getValue(ExecState* exec, unsigned propertyName) const
......@@ -1546,10 +1546,10 @@ ALWAYS_INLINE JSValue PropertySlot::getValue(ExecState* exec, unsigned propertyN
if (m_propertyType == TypeValue)
return JSValue::decode(m_data.value);
if (m_propertyType == TypeCustomIndex)
return m_data.customIndex.getIndexValue(exec, slotBase(), m_data.customIndex.index);
return JSValue::decode(m_data.customIndex.getIndexValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), m_data.customIndex.index));
if (m_propertyType == TypeGetter)
return functionGetter(exec);
return m_data.custom.getValue(exec, slotBase(), Identifier::from(exec, propertyName));
return JSValue::decode(m_data.custom.getValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), Identifier::from(exec, propertyName)));
}
} // namespace JSC
......
......@@ -29,11 +29,11 @@
namespace JSC {
static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName);
static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName);
static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName);
static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName);
static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName);
static EncodedJSValue numberConstructorNaNValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue numberConstructorNegInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue numberConstructorPosInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue numberConstructorMaxValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue numberConstructorMinValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
} // namespace JSC
......@@ -82,29 +82,29 @@ void NumberConstructor::put(JSCell* cell, ExecState* exec, PropertyName property
lookupPut<NumberConstructor, InternalFunction>(exec, propertyName, value, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(cell), slot);
}
static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName)
static EncodedJSValue numberConstructorNaNValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
{
return jsNaN();
return JSValue::encode(jsNaN());
}
static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName)
static EncodedJSValue numberConstructorNegInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
{
return jsNumber(-std::numeric_limits<double>::infinity());
return JSValue::encode(jsNumber(-std::numeric_limits<double>::infinity()));
}
static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName)
static EncodedJSValue numberConstructorPosInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
{
return jsNumber(std::numeric_limits<double>::infinity());
return JSValue::encode(jsNumber(std::numeric_limits<double>::infinity()));
}
static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName)
static EncodedJSValue numberConstructorMaxValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
{
return jsNumber(1.7976931348623157E+308);
return JSValue::encode(jsNumber(1.7976931348623157E+308));
}
static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName)
static EncodedJSValue numberConstructorMinValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
{
return jsNumber(5E-324);
return JSValue::encode(jsNumber(5E-324));
}
// ECMA 15.7.1
......
......@@ -60,8 +60,8 @@ public:
{
}
typedef JSValue (*GetValueFunc)(ExecState*, JSValue slotBase, PropertyName);
typedef JSValue (*GetIndexValueFunc)(ExecState*, JSValue slotBase, unsigned);
typedef EncodedJSValue (*GetValueFunc)(ExecState*, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName);
typedef EncodedJSValue (*GetIndexValueFunc)(ExecState*, EncodedJSValue slotBase, EncodedJSValue thisValue, unsigned);
JSValue getValue(ExecState*, PropertyName) const;
JSValue getValue(ExecState*, unsigned propertyName) const;
......@@ -226,7 +226,7 @@ private:
PropertyType m_propertyType;
PropertyOffset m_offset;
JSValue m_thisValue;
const JSValue m_thisValue;
JSObject* m_slotBase;
};
......
......@@ -29,21 +29,21 @@
namespace JSC {
static JSValue regExpConstructorInput(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorMultiline(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorLastMatch(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorLastParen(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorLeftContext(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorRightContext(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar1(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar2(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar3(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar4(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar5(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar6(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar7(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar8(ExecState*, JSValue, PropertyName);
static JSValue regExpConstructorDollar9(ExecState*, JSValue, PropertyName);
static EncodedJSValue regExpConstructorInput(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorMultiline(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorLastMatch(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorLastParen(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorLeftContext(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorRightContext(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar1(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar2(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar3(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar4(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar5(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar6(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar7(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar8(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpConstructorDollar9(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static void setRegExpConstructorInput(ExecState*, JSObject*, JSValue);
static void setRegExpConstructorMultiline(ExecState*, JSObject*, JSValue);
......@@ -158,79 +158,84 @@ bool RegExpConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, Pr
return getStaticValueSlot<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(object), propertyName, slot);
}
JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, PropertyName)
static inline RegExpConstructor* asRegExpConstructor(EncodedJSValue value)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 1);
return jsCast<RegExpConstructor*>(JSValue::decode(value));
}
EncodedJSValue regExpConstructorDollar1(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 1));
}
JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar2(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 2);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 2));
}
JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar3(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 3);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 3));
}
JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar4(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 4);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 4));
}
JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar5(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 5);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 5));
}
JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar6(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 6);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 6));
}
JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar7(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 7);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 7));
}
JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar8(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 8);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 8));
}
JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorDollar9(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 9);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 9));
}
JSValue regExpConstructorInput(ExecState*, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorInput(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->input();
return JSValue::encode(asRegExpConstructor(slotBase)->input());
}
JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorMultiline(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return jsBoolean(asRegExpConstructor(slotBase)->multiline());
return JSValue::encode(jsBoolean(asRegExpConstructor(slotBase)->multiline()));
}
JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorLastMatch(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 0);
return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 0));
}
JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorLastParen(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getLastParen(exec);
return JSValue::encode(asRegExpConstructor(slotBase)->getLastParen(exec));
}
JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorLeftContext(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getLeftContext(exec);
return JSValue::encode(asRegExpConstructor(slotBase)->getLeftContext(exec));
}
JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, PropertyName)
EncodedJSValue regExpConstructorRightContext(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
return asRegExpConstructor(slotBase)->getRightContext(exec);
return JSValue::encode(asRegExpConstructor(slotBase)->getRightContext(exec));
}
void RegExpConstructor::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
......
......@@ -39,10 +39,10 @@
namespace JSC {
static JSValue regExpObjectGlobal(ExecState*, JSValue, PropertyName);
static JSValue regExpObjectIgnoreCase(ExecState*, JSValue, PropertyName);
static JSValue regExpObjectMultiline(ExecState*, JSValue, PropertyName);
static JSValue regExpObjectSource(ExecState*, JSValue, PropertyName);
static EncodedJSValue regExpObjectGlobal(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpObjectIgnoreCase(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpObjectMultiline(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
static EncodedJSValue regExpObjectSource(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
} // namespace JSC
......@@ -155,19 +155,24 @@ bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, Property
return Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow);