Commit 7c7e4274 authored by ossy@webkit.org's avatar ossy@webkit.org

Unreviewed, rolling out r128826 and r128813.

Source/JavaScriptCore:

* API/JSCallbackConstructor.cpp:
(JSC):
(JSC::JSCallbackConstructor::JSCallbackConstructor):
* API/JSCallbackConstructor.h:
(JSCallbackConstructor):
* API/JSCallbackObject.cpp:
(JSC):
(JSC::::createStructure):
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::create):
(JSCallbackObject):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectGetPrivate):
(JSObjectSetPrivate):
(JSObjectGetPrivateProperty):
(JSObjectSetPrivateProperty):
(JSObjectDeletePrivateProperty):
* API/JSValueRef.cpp:
(JSValueIsObjectOfClass):
* API/JSWeakObjectMapRefPrivate.cpp:
* GNUmakefile.list.am:
* JSCTypedArrayStubs.h:
(JSC):
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
(JSC::DFG::SpeculativeJIT::emitAllocateJSFinalObject):
* heap/Heap.cpp:
(JSC::Heap::isSafeToSweepStructures):
(JSC):
* heap/Heap.h:
(JSC::Heap::allocatorForObjectWithDestructor):
(Heap):
(JSC::Heap::allocateWithDestructor):
(JSC::Heap::allocateStructure):
(JSC):
* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::IncrementalSweeper):
(JSC::IncrementalSweeper::sweepNextBlock):
(JSC::IncrementalSweeper::startSweeping):
(JSC::IncrementalSweeper::willFinishSweeping):
(JSC::IncrementalSweeper::structuresCanBeSwept):
(JSC):
* heap/IncrementalSweeper.h:
(IncrementalSweeper):
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::tryAllocateHelper):
(JSC::MarkedAllocator::allocateBlock):
* heap/MarkedAllocator.h:
(JSC::MarkedAllocator::cellsNeedDestruction):
(JSC::MarkedAllocator::onlyContainsStructures):
(MarkedAllocator):
(JSC::MarkedAllocator::MarkedAllocator):
(JSC::MarkedAllocator::init):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::create):
(JSC::MarkedBlock::MarkedBlock):
(JSC):
(JSC::MarkedBlock::specializedSweep):
(JSC::MarkedBlock::sweep):
(JSC::MarkedBlock::sweepHelper):
* heap/MarkedBlock.h:
(JSC):
(MarkedBlock):
(JSC::MarkedBlock::cellsNeedDestruction):
(JSC::MarkedBlock::onlyContainsStructures):
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::MarkedSpace):
(JSC::MarkedSpace::resetAllocators):
(JSC::MarkedSpace::canonicalizeCellLivenessData):
(JSC::MarkedSpace::isPagedOut):
(JSC::MarkedSpace::freeBlock):
* heap/MarkedSpace.h:
(MarkedSpace):
(Subspace):
(JSC::MarkedSpace::allocatorFor):
(JSC::MarkedSpace::destructorAllocatorFor):
(JSC::MarkedSpace::allocateWithDestructor):
(JSC::MarkedSpace::allocateStructure):
(JSC::MarkedSpace::forEachBlock):
* heap/SlotVisitor.cpp:
* jit/JIT.h:
* jit/JITInlineMethods.h:
(JSC::JIT::emitAllocateBasicJSObject):
(JSC::JIT::emitAllocateJSFinalObject):
(JSC::JIT::emitAllocateJSArray):
* jsc.cpp:
(GlobalObject::create):
* runtime/Arguments.cpp:
(JSC):
* runtime/Arguments.h:
(Arguments):
(JSC::Arguments::Arguments):
* runtime/ErrorPrototype.cpp:
(JSC):
* runtime/Executable.h:
* runtime/InternalFunction.cpp:
(JSC):
(JSC::InternalFunction::InternalFunction):
* runtime/InternalFunction.h:
(InternalFunction):
* runtime/JSCell.h:
(JSC):
(JSC::allocateCell):
* runtime/JSDestructibleObject.h: Removed.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC):
* runtime/JSGlobalObject.h:
(JSGlobalObject):
(JSC::JSGlobalObject::createRareDataIfNeeded):
(JSC::JSGlobalObject::create):
* runtime/JSGlobalThis.h:
(JSGlobalThis):
(JSC::JSGlobalThis::JSGlobalThis):
* runtime/JSPropertyNameIterator.h:
* runtime/JSScope.cpp:
(JSC):
* runtime/JSString.h:
(JSC):
* runtime/JSWrapperObject.h:
(JSWrapperObject):
(JSC::JSWrapperObject::JSWrapperObject):
* runtime/MathObject.cpp:
(JSC):
* runtime/NameInstance.h:
(NameInstance):
* runtime/RegExp.h:
* runtime/RegExpObject.cpp:
(JSC):
* runtime/SparseArrayValueMap.h:
* runtime/Structure.h:
(JSC::Structure):
(JSC::JSCell::classInfo):
(JSC):
* runtime/StructureChain.h:
* runtime/SymbolTable.h:
* testRegExp.cpp:
(GlobalObject::create):

Source/WebCore:

* ForwardingHeaders/runtime/JSDestructibleObject.h: Removed.
* bindings/js/JSDOMWrapper.h:
(WebCore::JSDOMWrapper::JSDOMWrapper):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
* bridge/objc/objc_runtime.h:
(ObjcFallbackObjectImp):
* bridge/objc/objc_runtime.mm:
(Bindings):
(JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp):
* bridge/runtime_array.cpp:
(JSC):
(JSC::RuntimeArray::destroy):
* bridge/runtime_array.h:
(JSC::RuntimeArray::create):
* bridge/runtime_object.cpp:
(Bindings):
(JSC::Bindings::RuntimeObject::RuntimeObject):
* bridge/runtime_object.h:
(RuntimeObject):

Source/WebKit2:

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit):
(WebKit::JSNPObject::JSNPObject):
* WebProcess/Plugins/Netscape/JSNPObject.h:
(JSNPObject):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4cfbb4db
......@@ -36,10 +36,10 @@
namespace JSC {
const ClassInfo JSCallbackConstructor::s_info = { "CallbackConstructor", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackConstructor) };
const ClassInfo JSCallbackConstructor::s_info = { "CallbackConstructor", &JSNonFinalObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackConstructor) };
JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
: JSDestructibleObject(globalObject->globalData(), structure)
: JSNonFinalObject(globalObject->globalData(), structure)
, m_class(jsClass)
, m_callback(callback)
{
......
......@@ -27,13 +27,13 @@
#define JSCallbackConstructor_h
#include "JSObjectRef.h"
#include "runtime/JSDestructibleObject.h"
#include <runtime/JSObject.h>
namespace JSC {
class JSCallbackConstructor : public JSDestructibleObject {
class JSCallbackConstructor : public JSNonFinalObject {
public:
typedef JSDestructibleObject Base;
typedef JSNonFinalObject Base;
static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback)
{
......
......@@ -32,24 +32,15 @@
namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSDestructibleObject>);
ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSNonFinalObject>);
ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSGlobalObject>);
// Define the two types of JSCallbackObjects we support.
template <> const ClassInfo JSCallbackObject<JSDestructibleObject>::s_info = { "CallbackObject", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackObject) };
template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackObject) };
template<>
JSCallbackObject<JSGlobalObject>* JSCallbackObject<JSGlobalObject>::create(JSGlobalData& globalData, JSClassRef classRef, Structure* structure)
{
JSCallbackObject<JSGlobalObject>* callbackObject = new (NotNull, allocateCell<JSCallbackObject<JSGlobalObject> >(globalData.heap)) JSCallbackObject(globalData, classRef, structure);
callbackObject->finishCreation(globalData);
globalData.heap.addFinalizer(callbackObject, destroy);
return callbackObject;
}
template <> const ClassInfo JSCallbackObject<JSNonFinalObject>::s_info = { "CallbackObject", &JSNonFinalObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackObject) };
template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject", &JSGlobalObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackObject) };
template <>
Structure* JSCallbackObject<JSDestructibleObject>::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto)
Structure* JSCallbackObject<JSNonFinalObject>::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto)
{
return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info);
}
......
......@@ -133,7 +133,13 @@ public:
callbackObject->finishCreation(exec);
return callbackObject;
}
static JSCallbackObject<Parent>* create(JSGlobalData&, JSClassRef, Structure*);
static JSCallbackObject* create(JSGlobalData& globalData, JSClassRef classRef, Structure* structure)
{
JSCallbackObject* callbackObject = new (NotNull, allocateCell<JSCallbackObject>(globalData.heap)) JSCallbackObject(globalData, classRef, structure);
callbackObject->finishCreation(globalData);
return callbackObject;
}
void setPrivate(void* data);
void* getPrivate();
......@@ -211,8 +217,6 @@ private:
OwnPtr<JSCallbackObjectData> m_callbackObjectData;
};
NEEDS_DESTRUCTOR(JSCallbackObject<JSGlobalObject>, false);
} // namespace JSC
// include the actual template class implementation
......
......@@ -199,7 +199,7 @@ JSObject* OpaqueJSClass::prototype(ExecState* exec)
return prototype;
// Recursive, but should be good enough for our purposes
JSObject* prototype = JSCallbackObject<JSDestructibleObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction
JSObject* prototype = JSCallbackObject<JSNonFinalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction
if (parentClass) {
if (JSObject* parentPrototype = parentClass->prototype(exec))
prototype->setPrototype(exec->globalData(), parentPrototype);
......
......@@ -83,7 +83,7 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data)
if (!jsClass)
return toRef(constructEmptyObject(exec));
JSCallbackObject<JSDestructibleObject>* object = JSCallbackObject<JSDestructibleObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
JSCallbackObject<JSNonFinalObject>* object = JSCallbackObject<JSNonFinalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
if (JSObject* prototype = jsClass->prototype(exec))
object->setPrototype(exec->globalData(), prototype);
......@@ -341,8 +341,8 @@ void* JSObjectGetPrivate(JSObjectRef object)
if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
return jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
if (jsObject->inherits(&JSCallbackObject<JSDestructibleObject>::s_info))
return jsCast<JSCallbackObject<JSDestructibleObject>*>(jsObject)->getPrivate();
if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
return jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivate();
return 0;
}
......@@ -355,8 +355,8 @@ bool JSObjectSetPrivate(JSObjectRef object, void* data)
jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivate(data);
return true;
}
if (jsObject->inherits(&JSCallbackObject<JSDestructibleObject>::s_info)) {
jsCast<JSCallbackObject<JSDestructibleObject>*>(jsObject)->setPrivate(data);
if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivate(data);
return true;
}
......@@ -372,8 +372,8 @@ JSValueRef JSObjectGetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSSt
Identifier name(propertyName->identifier(&exec->globalData()));
if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
result = jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
else if (jsObject->inherits(&JSCallbackObject<JSDestructibleObject>::s_info))
result = jsCast<JSCallbackObject<JSDestructibleObject>*>(jsObject)->getPrivateProperty(name);
else if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
result = jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivateProperty(name);
return toRef(exec, result);
}
......@@ -388,8 +388,8 @@ bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRe
jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
return true;
}
if (jsObject->inherits(&JSCallbackObject<JSDestructibleObject>::s_info)) {
jsCast<JSCallbackObject<JSDestructibleObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
return true;
}
return false;
......@@ -405,8 +405,8 @@ bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStrin
jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->deletePrivateProperty(name);
return true;
}
if (jsObject->inherits(&JSCallbackObject<JSDestructibleObject>::s_info)) {
jsCast<JSCallbackObject<JSDestructibleObject>*>(jsObject)->deletePrivateProperty(name);
if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->deletePrivateProperty(name);
return true;
}
return false;
......
......@@ -131,8 +131,8 @@ bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsCla
if (JSObject* o = jsValue.getObject()) {
if (o->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
return jsCast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
if (o->inherits(&JSCallbackObject<JSDestructibleObject>::s_info))
return jsCast<JSCallbackObject<JSDestructibleObject>*>(o)->inherits(jsClass);
if (o->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
return jsCast<JSCallbackObject<JSNonFinalObject>*>(o)->inherits(jsClass);
}
return false;
}
......
......@@ -57,7 +57,7 @@ void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSO
JSObject* obj = toJS(object);
if (!obj)
return;
ASSERT(obj->inherits(&JSCallbackObject<JSGlobalObject>::s_info) || obj->inherits(&JSCallbackObject<JSDestructibleObject>::s_info));
ASSERT(obj->inherits(&JSCallbackObject<JSGlobalObject>::s_info) || obj->inherits(&JSCallbackObject<JSNonFinalObject>::s_info));
map->map().set(exec->globalData(), key, obj);
}
......
2012-09-17 Csaba Osztrogonác <ossy@webkit.org>
Unreviewed, rolling out r128826 and r128813.
* API/JSCallbackConstructor.cpp:
(JSC):
(JSC::JSCallbackConstructor::JSCallbackConstructor):
* API/JSCallbackConstructor.h:
(JSCallbackConstructor):
* API/JSCallbackObject.cpp:
(JSC):
(JSC::::createStructure):
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::create):
(JSCallbackObject):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectGetPrivate):
(JSObjectSetPrivate):
(JSObjectGetPrivateProperty):
(JSObjectSetPrivateProperty):
(JSObjectDeletePrivateProperty):
* API/JSValueRef.cpp:
(JSValueIsObjectOfClass):
* API/JSWeakObjectMapRefPrivate.cpp:
* GNUmakefile.list.am:
* JSCTypedArrayStubs.h:
(JSC):
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
(JSC::DFG::SpeculativeJIT::emitAllocateJSFinalObject):
* heap/Heap.cpp:
(JSC::Heap::isSafeToSweepStructures):
(JSC):
* heap/Heap.h:
(JSC::Heap::allocatorForObjectWithDestructor):
(Heap):
(JSC::Heap::allocateWithDestructor):
(JSC::Heap::allocateStructure):
(JSC):
* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::IncrementalSweeper):
(JSC::IncrementalSweeper::sweepNextBlock):
(JSC::IncrementalSweeper::startSweeping):
(JSC::IncrementalSweeper::willFinishSweeping):
(JSC::IncrementalSweeper::structuresCanBeSwept):
(JSC):
* heap/IncrementalSweeper.h:
(IncrementalSweeper):
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::tryAllocateHelper):
(JSC::MarkedAllocator::allocateBlock):
* heap/MarkedAllocator.h:
(JSC::MarkedAllocator::cellsNeedDestruction):
(JSC::MarkedAllocator::onlyContainsStructures):
(MarkedAllocator):
(JSC::MarkedAllocator::MarkedAllocator):
(JSC::MarkedAllocator::init):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::create):
(JSC::MarkedBlock::MarkedBlock):
(JSC):
(JSC::MarkedBlock::specializedSweep):
(JSC::MarkedBlock::sweep):
(JSC::MarkedBlock::sweepHelper):
* heap/MarkedBlock.h:
(JSC):
(MarkedBlock):
(JSC::MarkedBlock::cellsNeedDestruction):
(JSC::MarkedBlock::onlyContainsStructures):
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::MarkedSpace):
(JSC::MarkedSpace::resetAllocators):
(JSC::MarkedSpace::canonicalizeCellLivenessData):
(JSC::MarkedSpace::isPagedOut):
(JSC::MarkedSpace::freeBlock):
* heap/MarkedSpace.h:
(MarkedSpace):
(Subspace):
(JSC::MarkedSpace::allocatorFor):
(JSC::MarkedSpace::destructorAllocatorFor):
(JSC::MarkedSpace::allocateWithDestructor):
(JSC::MarkedSpace::allocateStructure):
(JSC::MarkedSpace::forEachBlock):
* heap/SlotVisitor.cpp:
* jit/JIT.h:
* jit/JITInlineMethods.h:
(JSC::JIT::emitAllocateBasicJSObject):
(JSC::JIT::emitAllocateJSFinalObject):
(JSC::JIT::emitAllocateJSArray):
* jsc.cpp:
(GlobalObject::create):
* runtime/Arguments.cpp:
(JSC):
* runtime/Arguments.h:
(Arguments):
(JSC::Arguments::Arguments):
* runtime/ErrorPrototype.cpp:
(JSC):
* runtime/Executable.h:
* runtime/InternalFunction.cpp:
(JSC):
(JSC::InternalFunction::InternalFunction):
* runtime/InternalFunction.h:
(InternalFunction):
* runtime/JSCell.h:
(JSC):
(JSC::allocateCell):
* runtime/JSDestructibleObject.h: Removed.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC):
* runtime/JSGlobalObject.h:
(JSGlobalObject):
(JSC::JSGlobalObject::createRareDataIfNeeded):
(JSC::JSGlobalObject::create):
* runtime/JSGlobalThis.h:
(JSGlobalThis):
(JSC::JSGlobalThis::JSGlobalThis):
* runtime/JSPropertyNameIterator.h:
* runtime/JSScope.cpp:
(JSC):
* runtime/JSString.h:
(JSC):
* runtime/JSWrapperObject.h:
(JSWrapperObject):
(JSC::JSWrapperObject::JSWrapperObject):
* runtime/MathObject.cpp:
(JSC):
* runtime/NameInstance.h:
(NameInstance):
* runtime/RegExp.h:
* runtime/RegExpObject.cpp:
(JSC):
* runtime/SparseArrayValueMap.h:
* runtime/Structure.h:
(JSC::Structure):
(JSC::JSCell::classInfo):
(JSC):
* runtime/StructureChain.h:
* runtime/SymbolTable.h:
* testRegExp.cpp:
(GlobalObject::create):
2012-09-17 Geoffrey Garen <ggaren@apple.com>
Refactored the arguments object so it doesn't dictate closure layout
......
......@@ -533,7 +533,6 @@ javascriptcore_sources += \
Source/JavaScriptCore/runtime/JSCell.h \
Source/JavaScriptCore/runtime/JSDateMath.cpp \
Source/JavaScriptCore/runtime/JSDateMath.h \
Source/JavaScriptCore/runtime/JSDestructibleObject.h \
Source/JavaScriptCore/runtime/JSFunction.cpp \
Source/JavaScriptCore/runtime/JSFunction.h \
Source/JavaScriptCore/runtime/JSBoundFunction.cpp \
......
......@@ -26,7 +26,7 @@
#ifndef JSCTypedArrayStubs_h
#define JSCTypedArrayStubs_h
#include "JSDestructibleObject.h"
#include "JSObject.h"
#include "ObjectPrototype.h"
#include <wtf/Float32Array.h>
#include <wtf/Float64Array.h>
......@@ -42,9 +42,9 @@
namespace JSC {
#define TYPED_ARRAY(name, type) \
class JS##name##Array : public JSDestructibleObject { \
class JS##name##Array : public JSNonFinalObject { \
public: \
typedef JSDestructibleObject Base; \
typedef JSNonFinalObject Base; \
static JS##name##Array* create(JSC::Structure* structure, JSGlobalObject* globalObject, PassRefPtr<name##Array> impl) \
{ \
JS##name##Array* ptr = new (NotNull, JSC::allocateCell<JS##name##Array>(globalObject->globalData().heap)) JS##name##Array(structure, globalObject, impl); \
......
......@@ -841,10 +841,6 @@
RelativePath="..\..\runtime\JSDateMath.h"
>
</File>
<File
RelativePath="..\..\runtime\JSDestructibleObject.h"
>
</File>
<File
RelativePath="..\..\runtime\JSFunction.cpp"
>
......
......@@ -708,7 +708,6 @@
C225494315F7DBAA0065E898 /* SlotVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C225494215F7DBAA0065E898 /* SlotVisitor.cpp */; };
C22B31B9140577D700DB475A /* SamplingCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F77008E1402FDD60078EB39 /* SamplingCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
C240305514B404E60079EB64 /* CopiedSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C240305314B404C90079EB64 /* CopiedSpace.cpp */; };
C25177F81607D0A6000A233C /* JSDestructibleObject.h in Headers */ = {isa = PBXBuildFile; fileRef = C25177F71607D0A6000A233C /* JSDestructibleObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
C25F8BCD157544A900245B71 /* IncrementalSweeper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C25F8BCB157544A900245B71 /* IncrementalSweeper.cpp */; };
C25F8BCE157544A900245B71 /* IncrementalSweeper.h in Headers */ = {isa = PBXBuildFile; fileRef = C25F8BCC157544A900245B71 /* IncrementalSweeper.h */; settings = {ATTRIBUTES = (Private, ); }; };
C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -1482,7 +1481,6 @@
C21122E015DD9AB300790E3A /* MarkStackInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkStackInlineMethods.h; sourceTree = "<group>"; };
C225494215F7DBAA0065E898 /* SlotVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlotVisitor.cpp; sourceTree = "<group>"; };
C240305314B404C90079EB64 /* CopiedSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CopiedSpace.cpp; sourceTree = "<group>"; };
C25177F71607D0A6000A233C /* JSDestructibleObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDestructibleObject.h; sourceTree = "<group>"; };
C25F8BCB157544A900245B71 /* IncrementalSweeper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IncrementalSweeper.cpp; sourceTree = "<group>"; };
C25F8BCC157544A900245B71 /* IncrementalSweeper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IncrementalSweeper.h; sourceTree = "<group>"; };
C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedAllocator.h; sourceTree = "<group>"; };
......@@ -2045,7 +2043,6 @@
7EF6E0BB0EB7A1EC0079AFAF /* runtime */ = {
isa = PBXGroup;
children = (
C25177F71607D0A6000A233C /* JSDestructibleObject.h */,
0F0CD4C315F6B6B50032F1C0 /* SparseArrayValueMap.cpp */,
0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */,
0FB7F38915ED8E3800F167B2 /* ArrayConventions.h */,
......@@ -2566,7 +2563,6 @@
86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */,
C2EAD2FC14F0249800A4B159 /* CopiedAllocator.h in Headers */,
C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */,
C25177F81607D0A6000A233C /* JSDestructibleObject.h in Headers */,
FE20CE9E15F04A9500DF3430 /* LLIntCLoop.h in Headers */,
C21122E215DD9AB300790E3A /* GCThreadSharedData.h in Headers */,
C2160FE715F7E95E00942DFC /* SlotVisitorInlineMethods.h in Headers */,
......
......@@ -2189,14 +2189,12 @@ public:
// It is NOT okay for the structure and the scratch register to be the same thing because if they are then the Structure will
// get clobbered.
template <typename ClassType, MarkedBlock::DestructorType destructorType, typename StructureType>
template <typename ClassType, bool destructor, typename StructureType>
void emitAllocateBasicJSObject(StructureType structure, GPRReg resultGPR, GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
{
MarkedAllocator* allocator = 0;
if (destructorType == MarkedBlock::Normal)
allocator = &m_jit.globalData()->heap.allocatorForObjectWithNormalDestructor(sizeof(ClassType));
else if (destructorType == MarkedBlock::ImmortalStructure)
allocator = &m_jit.globalData()->heap.allocatorForObjectWithImmortalStructureDestructor(sizeof(ClassType));
if (destructor)
allocator = &m_jit.globalData()->heap.allocatorForObjectWithDestructor(sizeof(ClassType));
else
allocator = &m_jit.globalData()->heap.allocatorForObjectWithoutDestructor(sizeof(ClassType));
......@@ -2218,7 +2216,7 @@ public:
template<typename T>
void emitAllocateJSFinalObject(T structure, GPRReg resultGPR, GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
{
return emitAllocateBasicJSObject<JSFinalObject, MarkedBlock::None>(structure, resultGPR, scratchGPR, slowPath);
return emitAllocateBasicJSObject<JSFinalObject, false>(structure, resultGPR, scratchGPR, slowPath);
}
#if USE(JSVALUE64)
......
......@@ -830,6 +830,11 @@ void Heap::addCompiledCode(ExecutableBase* executable)
m_compiledCode.append(executable);
}
bool Heap::isSafeToSweepStructures()
{
return !m_sweeper || m_sweeper->structuresCanBeSwept();
}
void Heap::didStartVMShutdown()
{
m_activityCallback->didStartVMShutdown();
......
......@@ -112,8 +112,7 @@ namespace JSC {
MarkedAllocator& firstAllocatorWithoutDestructors() { return m_objectSpace.firstAllocator(); }
MarkedAllocator& allocatorForObjectWithoutDestructor(size_t bytes) { return m_objectSpace.allocatorFor(bytes); }
MarkedAllocator& allocatorForObjectWithNormalDestructor(size_t bytes) { return m_objectSpace.normalDestructorAllocatorFor(bytes); }
MarkedAllocator& allocatorForObjectWithImmortalStructureDestructor(size_t bytes) { return m_objectSpace.immortalStructureDestructorAllocatorFor(bytes); }
MarkedAllocator& allocatorForObjectWithDestructor(size_t bytes) { return m_objectSpace.destructorAllocatorFor(bytes); }
CopiedAllocator& storageAllocator() { return m_storageSpace.allocator(); }
CheckedBoolean tryAllocateStorage(size_t, void**);
CheckedBoolean tryReallocateStorage(void**, size_t, size_t);
......@@ -169,6 +168,7 @@ namespace JSC {
void didAbandon(size_t);
bool isPagedOut(double deadline);
bool isSafeToSweepStructures();
void didStartVMShutdown();
private:
......@@ -184,9 +184,9 @@ namespace JSC {
template<typename T> friend void* allocateCell(Heap&);
template<typename T> friend void* allocateCell(Heap&, size_t);
void* allocateWithImmortalStructureDestructor(size_t); // For use with special objects whose Structures never die.
void* allocateWithNormalDestructor(size_t); // For use with objects that inherit directly or indirectly from JSDestructibleObject.
void* allocateWithoutDestructor(size_t); // For use with objects without destructors.
void* allocateWithDestructor(size_t);
void* allocateWithoutDestructor(size_t);
void* allocateStructure(size_t);
static const size_t minExtraCost = 256;
static const size_t maxExtraCost = 1024 * 1024;
......@@ -361,16 +361,10 @@ namespace JSC {
return forEachProtectedCell(functor);
}
inline void* Heap::allocateWithNormalDestructor(size_t bytes)
inline void* Heap::allocateWithDestructor(size_t bytes)
{
ASSERT(isValidAllocation(bytes));
return m_objectSpace.allocateWithNormalDestructor(bytes);
}
inline void* Heap::allocateWithImmortalStructureDestructor(size_t bytes)
{
ASSERT(isValidAllocation(bytes));
return m_objectSpace.allocateWithImmortalStructureDestructor(bytes);
return m_objectSpace.allocateWithDestructor(bytes);
}
inline void* Heap::allocateWithoutDestructor(size_t bytes)
......@@ -379,6 +373,11 @@ namespace JSC {
return m_objectSpace.allocateWithoutDestructor(bytes);
}
inline void* Heap::allocateStructure(size_t bytes)
{
return m_objectSpace.allocateStructure(bytes);
}
inline CheckedBoolean Heap::tryAllocateStorage(size_t bytes, void** outPtr)
{
return m_storageSpace.tryAllocate(bytes, outPtr);
......
......@@ -48,6 +48,7 @@ static const double sweepTimeMultiplier = 1.0 / sweepTimeTotal;
IncrementalSweeper::IncrementalSweeper(Heap* heap, CFRunLoopRef runLoop)
: HeapTimer(heap->globalData(), runLoop)
, m_currentBlockToSweepIndex(0)
, m_structuresCanBeSwept(false)
{
}
......@@ -71,6 +72,7 @@ void IncrementalSweeper::cancelTimer()
IncrementalSweeper::IncrementalSweeper(Heap* heap)
: HeapTimer(heap->globalData())
, m_currentBlockToSweepIndex(0)
, m_structuresCanBeSwept(false)
{
}
......@@ -117,6 +119,10 @@ void IncrementalSweeper::sweepNextBlock()
{
while (m_currentBlockToSweepIndex < m_blocksToSweep.size()) {
MarkedBlock* block = m_blocksToSweep[m_currentBlockToSweepIndex++];
if (block->onlyContainsStructures())
m_structuresCanBeSwept = true;
else
ASSERT(!m_structuresCanBeSwept);
if (!block->needsSweeping())
continue;
......@@ -133,12 +139,14 @@ void IncrementalSweeper::startSweeping(const HashSet<MarkedBlock*>& blockSnapsho
CopyFunctor functor(m_blocksToSweep);
m_globalData->heap.objectSpace().forEachBlock(functor);
m_currentBlockToSweepIndex = 0;
m_structuresCanBeSwept = false;
scheduleTimer();
}
void IncrementalSweeper::willFinishSweeping()
{
m_currentBlockToSweepIndex = 0;
m_structuresCanBeSwept = true;
m_blocksToSweep.clear();
if (m_globalData)
cancelTimer();
......@@ -148,6 +156,7 @@ void IncrementalSweeper::willFinishSweeping()
IncrementalSweeper::IncrementalSweeper(JSGlobalData* globalData)
: HeapTimer(globalData)
, m_structuresCanBeSwept(false)
{
}
......@@ -162,10 +171,12 @@ IncrementalSweeper* IncrementalSweeper::create(Heap* heap)
void IncrementalSweeper::startSweeping(const HashSet<MarkedBlock*>&)
{
m_structuresCanBeSwept = false;
}
void IncrementalSweeper::willFinishSweeping()
{
m_structuresCanBeSwept = true;
}
void IncrementalSweeper::sweepNextBlock()
......@@ -174,4 +185,9 @@ void IncrementalSweeper::sweepNextBlock()
#endif
bool IncrementalSweeper::structuresCanBeSwept()
{
return m_structuresCanBeSwept;
}
} // namespace JSC
......@@ -56,6 +56,7 @@ public:
void startSweeping(const HashSet<MarkedBlock*>& blockSnapshot);
virtual void doWork();
void sweepNextBlock();
bool structuresCanBeSwept();
void willFinishSweeping();
private:
......@@ -77,6 +78,7 @@ private:
IncrementalSweeper(JSGlobalData*);
#endif
bool m_structuresCanBeSwept;
};
} // namespace JSC
......
......@@ -30,6 +30,17 @@ bool MarkedAllocator::isPagedOut(double deadline)
inline void* MarkedAllocator::tryAllocateHelper(size_t bytes)
{
if (!m_freeList.head) {
if (m_onlyContainsStructures && !m_heap->isSafeToSweepStructures()) {
if (m_currentBlock) {
m_currentBlock->didConsumeFreeList();
m_currentBlock = 0;
}
// We sweep another random block here so that we can make progress
// toward being able to sweep Structures.
m_heap->sweeper()->sweepNextBlock();
return 0;
}
for (MarkedBlock*& block = m_blocksToSweep; block; block = block->next()) {
MarkedBlock::FreeList freeList = block->sweep(MarkedBlock::SweepToFreeList);
if (!freeList.head) {
......@@ -113,13 +124,13 @@ MarkedBlock* MarkedAllocator::allocateBlock(size_t bytes)
if (blockSize == MarkedBlock::blockSize) {
PageAllocationAligned allocation = m_heap->blockAllocator().allocate();
return MarkedBlock::create(allocation, this, cellSize, m_destructorType);
return MarkedBlock::create(allocation, m_heap, cellSize, m_cellsNeedDestruction, m_onlyContainsStructures);
}
PageAllocationAligned allocation = PageAllocationAligned::allocate(blockSize, MarkedBlock::blockSize, OSAllocator::JSGCHeapPages);
if (!static_cast<bool>(allocation))
CRASH();
return MarkedBlock::create(allocation, this, cellSize, m_destructorType);
return MarkedBlock::create(allocation, m_heap, cellSize, m_cellsNeedDestruction, m_onlyContainsStructures);
}
void MarkedAllocator::addBlock(MarkedBlock* block)
......
......@@ -23,7 +23,8 @@ public:
void reset();