summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
commit03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch)
tree52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/JavaScriptCore/runtime
parentcd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff)
downloadqtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r--Source/JavaScriptCore/runtime/ClassInfo.h8
-rw-r--r--Source/JavaScriptCore/runtime/Executable.cpp4
-rw-r--r--Source/JavaScriptCore/runtime/JSBoundFunction.cpp5
-rw-r--r--Source/JavaScriptCore/runtime/JSCell.cpp10
-rw-r--r--Source/JavaScriptCore/runtime/JSCell.h2
-rw-r--r--Source/JavaScriptCore/runtime/JSFunction.cpp11
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObject.cpp15
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObject.h1
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.cpp100
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.h8
-rw-r--r--Source/JavaScriptCore/runtime/JSType.h5
-rw-r--r--Source/JavaScriptCore/runtime/JSValue.cpp2
-rw-r--r--Source/JavaScriptCore/runtime/JSValue.h2
-rw-r--r--Source/JavaScriptCore/runtime/ObjectPrototype.cpp36
-rw-r--r--Source/JavaScriptCore/runtime/WriteBarrier.h4
15 files changed, 53 insertions, 160 deletions
diff --git a/Source/JavaScriptCore/runtime/ClassInfo.h b/Source/JavaScriptCore/runtime/ClassInfo.h
index 3d556d88c..9ebb33a74 100644
--- a/Source/JavaScriptCore/runtime/ClassInfo.h
+++ b/Source/JavaScriptCore/runtime/ClassInfo.h
@@ -66,12 +66,6 @@ namespace JSC {
typedef JSObject* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*);
ToThisObjectFunctionPtr toThisObject;
- typedef void (*DefineGetterFunctionPtr)(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned);
- DefineGetterFunctionPtr defineGetter;
-
- typedef void (*DefineSetterFunctionPtr)(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned);
- DefineSetterFunctionPtr defineSetter;
-
typedef JSValue (*DefaultValueFunctionPtr)(const JSObject*, ExecState*, PreferredPrimitiveType);
DefaultValueFunctionPtr defaultValue;
@@ -128,8 +122,6 @@ struct MemberCheck##member { \
&ClassName::getOwnPropertySlot, \
&ClassName::getOwnPropertySlotByIndex, \
&ClassName::toThisObject, \
- &ClassName::defineGetter, \
- &ClassName::defineSetter, \
&ClassName::defaultValue, \
&ClassName::getOwnPropertyNames, \
&ClassName::getPropertyNames, \
diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp
index c67c54cd2..bf49767ab 100644
--- a/Source/JavaScriptCore/runtime/Executable.cpp
+++ b/Source/JavaScriptCore/runtime/Executable.cpp
@@ -137,7 +137,7 @@ FunctionExecutable::FunctionExecutable(JSGlobalData& globalData, const Identifie
, m_forceUsesArguments(forceUsesArguments)
, m_parameters(parameters)
, m_name(name)
- , m_inferredName(inferredName)
+ , m_inferredName(inferredName.isNull() ? globalData.propertyNames->emptyIdentifier : inferredName)
, m_symbolTable(0)
{
}
@@ -148,7 +148,7 @@ FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name,
, m_forceUsesArguments(forceUsesArguments)
, m_parameters(parameters)
, m_name(name)
- , m_inferredName(inferredName)
+ , m_inferredName(inferredName.isNull() ? exec->globalData().propertyNames->emptyIdentifier : inferredName)
, m_symbolTable(0)
{
}
diff --git a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
index 88260ea27..8ebf8c638 100644
--- a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
+++ b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "JSBoundFunction.h"
+#include "GetterSetter.h"
#include "JSGlobalObject.h"
namespace JSC {
@@ -111,8 +112,8 @@ void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executab
Base::finishCreation(exec, executable, length, name);
ASSERT(inherits(&s_info));
- initializeGetterSetterProperty(exec, exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
- initializeGetterSetterProperty(exec, exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
+ putDirectAccessor(exec->globalData(), exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
+ putDirectAccessor(exec->globalData(), exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
}
void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
diff --git a/Source/JavaScriptCore/runtime/JSCell.cpp b/Source/JavaScriptCore/runtime/JSCell.cpp
index 9dcd6364b..4703b681b 100644
--- a/Source/JavaScriptCore/runtime/JSCell.cpp
+++ b/Source/JavaScriptCore/runtime/JSCell.cpp
@@ -158,16 +158,6 @@ void slowValidateCell(JSCell* cell)
ASSERT_GC_OBJECT_LOOKS_VALID(cell);
}
-void JSCell::defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned)
-{
- ASSERT_NOT_REACHED();
-}
-
-void JSCell::defineSetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned)
-{
- ASSERT_NOT_REACHED();
-}
-
JSValue JSCell::defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType)
{
ASSERT_NOT_REACHED();
diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h
index a36bb7d58..74833d12f 100644
--- a/Source/JavaScriptCore/runtime/JSCell.h
+++ b/Source/JavaScriptCore/runtime/JSCell.h
@@ -152,8 +152,6 @@ namespace JSC {
static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&);
// Dummy implementations of override-able static functions for classes to put in their MethodTable
- static NO_RETURN_DUE_TO_ASSERT void defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned);
- static NO_RETURN_DUE_TO_ASSERT void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0);
static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
static NO_RETURN_DUE_TO_ASSERT void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
static NO_RETURN_DUE_TO_ASSERT void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp
index 15718a176..72e1ce14f 100644
--- a/Source/JavaScriptCore/runtime/JSFunction.cpp
+++ b/Source/JavaScriptCore/runtime/JSFunction.cpp
@@ -30,6 +30,7 @@
#include "CallFrame.h"
#include "ExceptionHelpers.h"
#include "FunctionPrototype.h"
+#include "GetterSetter.h"
#include "JSArray.h"
#include "JSGlobalObject.h"
#include "JSNotAnObject.h"
@@ -219,7 +220,7 @@ bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identif
if (thisObject->jsExecutable()->isStrictMode()) {
bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
if (!result) {
- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
ASSERT(result);
}
@@ -238,7 +239,7 @@ bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identif
if (thisObject->jsExecutable()->isStrictMode()) {
bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
if (!result) {
- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
ASSERT(result);
}
@@ -267,7 +268,7 @@ bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, con
if (thisObject->jsExecutable()->isStrictMode()) {
bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
if (!result) {
- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
ASSERT(result);
}
@@ -286,7 +287,7 @@ bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, con
if (thisObject->jsExecutable()->isStrictMode()) {
bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
if (!result) {
- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
ASSERT(result);
}
@@ -369,7 +370,7 @@ UString getCalculatedDisplayName(CallFrame* callFrame, JSObject* object)
return function->calculatedDisplayName(callFrame);
if (InternalFunction* function = jsDynamicCast<InternalFunction*>(object))
return function->calculatedDisplayName(callFrame);
- return UString();
+ return callFrame->globalData().propertyNames->emptyIdentifier.ustring();
}
} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
index f28139d27..e648fbe21 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -171,21 +171,16 @@ void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, const I
}
}
-void JSGlobalObject::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes)
+bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow)
{
JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object);
PropertySlot slot;
- if (!thisObject->symbolTableGet(propertyName, slot))
- JSVariableObject::defineGetter(thisObject, exec, propertyName, getterFunc, attributes);
+ // silently ignore attempts to add accessors aliasing vars.
+ if (descriptor.isAccessorDescriptor() && thisObject->symbolTableGet(propertyName, slot))
+ return false;
+ return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
}
-void JSGlobalObject::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes)
-{
- JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object);
- PropertySlot slot;
- if (!thisObject->symbolTableGet(propertyName, slot))
- JSVariableObject::defineSetter(thisObject, exec, propertyName, setterFunc, attributes);
-}
static inline JSObject* lastInPrototypeChain(JSObject* object)
{
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h
index 70368307d..b67ccb764 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalObject.h
+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h
@@ -206,6 +206,7 @@ namespace JSC {
JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes);
JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes);
+ JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow);
// We use this in the code generator as we perform symbol table
// lookups prior to initializing the properties
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp
index a443fda86..ba2d2a52a 100644
--- a/Source/JavaScriptCore/runtime/JSObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSObject.cpp
@@ -361,106 +361,6 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi
return 0;
}
-void JSObject::defineGetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
-{
- if (propertyName == exec->propertyNames().underscoreProto) {
- // Defining a getter for __proto__ is silently ignored.
- return;
- }
-
- JSValue object = thisObject->getDirect(exec->globalData(), propertyName);
- if (object && object.isGetterSetter()) {
- ASSERT(thisObject->structure()->hasGetterSetterProperties());
- asGetterSetter(object)->setGetter(exec->globalData(), getterFunction);
- return;
- }
-
- JSGlobalData& globalData = exec->globalData();
- PutPropertySlot slot;
- GetterSetter* getterSetter = GetterSetter::create(exec);
- thisObject->putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, getterSetter, attributes | Accessor, slot, 0);
-
- // putDirect will change our Structure if we add a new property. For
- // getters and setters, though, we also need to change our Structure
- // if we override an existing non-getter or non-setter.
- if (slot.type() != PutPropertySlot::NewProperty)
- thisObject->setStructure(exec->globalData(), Structure::attributeChangeTransition(globalData, thisObject->structure(), propertyName, attributes | Accessor));
-
- thisObject->structure()->setHasGetterSetterProperties(true);
- getterSetter->setGetter(globalData, getterFunction);
-}
-
-void JSObject::initializeGetterSetterProperty(ExecState* exec, const Identifier& propertyName, GetterSetter* getterSetter, unsigned attributes)
-{
- // Set an inital property on an object; the property must not already exist & the attribute flags must be set correctly.
- ASSERT(structure()->get(exec->globalData(), propertyName) == WTF::notFound);
- ASSERT(static_cast<bool>(attributes & Accessor));
-
- JSGlobalData& globalData = exec->globalData();
- PutPropertySlot slot;
- putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, getterSetter, attributes, slot, 0);
-
- // putDirect will change our Structure if we add a new property. For
- // getters and setters, though, we also need to change our Structure
- // if we override an existing non-getter or non-setter.
- if (slot.type() != PutPropertySlot::NewProperty)
- setStructure(exec->globalData(), Structure::attributeChangeTransition(globalData, structure(), propertyName, attributes));
-
- structure()->setHasGetterSetterProperties(true);
-}
-
-void JSObject::defineSetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
-{
- if (propertyName == exec->propertyNames().underscoreProto) {
- // Defining a setter for __proto__ is silently ignored.
- return;
- }
-
- JSValue object = thisObject->getDirect(exec->globalData(), propertyName);
- if (object && object.isGetterSetter()) {
- ASSERT(thisObject->structure()->hasGetterSetterProperties());
- asGetterSetter(object)->setSetter(exec->globalData(), setterFunction);
- return;
- }
-
- PutPropertySlot slot;
- GetterSetter* getterSetter = GetterSetter::create(exec);
- thisObject->putDirectInternal<PutModeDefineOwnProperty>(exec->globalData(), propertyName, getterSetter, attributes | Accessor, slot, 0);
-
- // putDirect will change our Structure if we add a new property. For
- // getters and setters, though, we also need to change our Structure
- // if we override an existing non-getter or non-setter.
- if (slot.type() != PutPropertySlot::NewProperty)
- thisObject->setStructure(exec->globalData(), Structure::attributeChangeTransition(exec->globalData(), thisObject->structure(), propertyName, attributes | Accessor));
-
- thisObject->structure()->setHasGetterSetterProperties(true);
- getterSetter->setSetter(exec->globalData(), setterFunction);
-}
-
-JSValue JSObject::lookupGetter(ExecState* exec, const Identifier& propertyName)
-{
- PropertyDescriptor descriptor;
- if (!getPropertyDescriptor(exec, propertyName, descriptor))
- return jsUndefined();
-
- if (!descriptor.getterPresent())
- return jsUndefined();
-
- return descriptor.getter();
-}
-
-JSValue JSObject::lookupSetter(ExecState* exec, const Identifier& propertyName)
-{
- PropertyDescriptor descriptor;
- if (!getPropertyDescriptor(exec, propertyName, descriptor))
- return jsUndefined();
-
- if (!descriptor.setterPresent())
- return jsUndefined();
-
- return descriptor.setter();
-}
-
bool JSObject::hasInstance(JSObject*, ExecState* exec, JSValue value, JSValue proto)
{
if (!value.isObject())
diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h
index 433249c20..e9194fa01 100644
--- a/Source/JavaScriptCore/runtime/JSObject.h
+++ b/Source/JavaScriptCore/runtime/JSObject.h
@@ -192,13 +192,6 @@ namespace JSC {
void putDirectOffset(JSGlobalData& globalData, size_t offset, JSValue value) { propertyStorage()[offset].set(globalData, this, value); }
void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); }
- JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location);
- void initializeGetterSetterProperty(ExecState*, const Identifier&, GetterSetter*, unsigned attributes);
-
- JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0);
- JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0);
- JS_EXPORT_PRIVATE JSValue lookupGetter(ExecState*, const Identifier& propertyName);
- JS_EXPORT_PRIVATE JSValue lookupSetter(ExecState*, const Identifier& propertyName);
JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow);
bool isGlobalObject() const;
@@ -296,6 +289,7 @@ namespace JSC {
bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*);
bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location);
const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const;
Structure* createInheritorID(JSGlobalData&);
diff --git a/Source/JavaScriptCore/runtime/JSType.h b/Source/JavaScriptCore/runtime/JSType.h
index 84a27a7ea..880240e60 100644
--- a/Source/JavaScriptCore/runtime/JSType.h
+++ b/Source/JavaScriptCore/runtime/JSType.h
@@ -49,11 +49,12 @@ enum JSType {
ErrorInstanceType,
GlobalThisType,
- // VariableObjectType must come before all of the types of its subclasses and only its subclasses.
+ StaticScopeObjectType,
+ // VariableObjectType must be less than MOST of the types of its subclasses and only its subclasses.
+ // We use >=VariableObjectType checks to test for Global & Activation objects, but exclude StaticScopes.
VariableObjectType,
GlobalObjectType,
ActivationObjectType,
- StaticScopeObjectType,
};
} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSValue.cpp b/Source/JavaScriptCore/runtime/JSValue.cpp
index 6b803c316..72cf5a8d5 100644
--- a/Source/JavaScriptCore/runtime/JSValue.cpp
+++ b/Source/JavaScriptCore/runtime/JSValue.cpp
@@ -116,7 +116,6 @@ JSObject* JSValue::synthesizePrototype(ExecState* exec) const
return JSNotAnObject::create(exec);
}
-#ifndef NDEBUG
char* JSValue::description()
{
static const size_t size = 64;
@@ -152,7 +151,6 @@ char* JSValue::description()
return description;
}
-#endif
// This in the ToInt32 operation is defined in section 9.5 of the ECMA-262 spec.
// Note that this operation is identical to ToUInt32 other than to interpretation
diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h
index 79e50fba0..b18c181f5 100644
--- a/Source/JavaScriptCore/runtime/JSValue.h
+++ b/Source/JavaScriptCore/runtime/JSValue.h
@@ -232,9 +232,7 @@ namespace JSC {
JSCell* asCell() const;
JS_EXPORT_PRIVATE bool isValidCallee();
-#ifndef NDEBUG
char* description();
-#endif
private:
template <class T> JSValue(WriteBarrierBase<T>);
diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
index 7ca7dae61..674bd7b7d 100644
--- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -146,10 +146,17 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec)
if (exec->hadException())
return JSValue::encode(jsUndefined());
+ JSValue get = exec->argument(1);
CallData callData;
- if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ if (getCallData(get, callData) == CallTypeNone)
return throwVMError(exec, createSyntaxError(exec, "invalid getter usage"));
- thisObject->methodTable()->defineGetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0);
+
+ PropertyDescriptor descriptor;
+ descriptor.setGetter(get);
+ descriptor.setEnumerable(true);
+ descriptor.setConfigurable(true);
+ thisObject->methodTable()->defineOwnProperty(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor, false);
+
return JSValue::encode(jsUndefined());
}
@@ -159,10 +166,17 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec)
if (exec->hadException())
return JSValue::encode(jsUndefined());
+ JSValue set = exec->argument(1);
CallData callData;
- if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ if (getCallData(set, callData) == CallTypeNone)
return throwVMError(exec, createSyntaxError(exec, "invalid setter usage"));
- thisObject->methodTable()->defineSetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0);
+
+ PropertyDescriptor descriptor;
+ descriptor.setSetter(set);
+ descriptor.setEnumerable(true);
+ descriptor.setConfigurable(true);
+ thisObject->methodTable()->defineOwnProperty(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor, false);
+
return JSValue::encode(jsUndefined());
}
@@ -172,7 +186,12 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec)
if (exec->hadException())
return JSValue::encode(jsUndefined());
- return JSValue::encode(thisObject->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec))));
+ PropertyDescriptor descriptor;
+ if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor)
+ && descriptor.getterPresent())
+ return JSValue::encode(descriptor.getter());
+
+ return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
@@ -181,7 +200,12 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
if (exec->hadException())
return JSValue::encode(jsUndefined());
- return JSValue::encode(thisObject->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec))));
+ PropertyDescriptor descriptor;
+ if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor)
+ && descriptor.setterPresent())
+ return JSValue::encode(descriptor.setter());
+
+ return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
diff --git a/Source/JavaScriptCore/runtime/WriteBarrier.h b/Source/JavaScriptCore/runtime/WriteBarrier.h
index a7bd7a100..6ac52b7c7 100644
--- a/Source/JavaScriptCore/runtime/WriteBarrier.h
+++ b/Source/JavaScriptCore/runtime/WriteBarrier.h
@@ -93,7 +93,7 @@ public:
{
if (m_cell)
validateCell(m_cell);
- return reinterpret_cast<T*>(m_cell);
+ return reinterpret_cast<T*>(static_cast<void*>(m_cell));
}
T* operator*() const
@@ -128,7 +128,7 @@ public:
}
#if ENABLE(GC_VALIDATION)
- T* unvalidatedGet() const { return reinterpret_cast<T*>(m_cell); }
+ T* unvalidatedGet() const { return reinterpret_cast<T*>(static_cast<void*>(m_cell)); }
#endif
private: