Diff
Modified: trunk/Source/_javascript_Core/API/APICast.h (233764 => 233765)
--- trunk/Source/_javascript_Core/API/APICast.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/API/APICast.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -113,7 +113,7 @@
{
JSC::JSObject* object = uncheckedToJS(o);
if (object)
- RELEASE_ASSERT(object->methodTable());
+ RELEASE_ASSERT(object->methodTable(*object->vm()));
return object;
}
Modified: trunk/Source/_javascript_Core/API/JSCallbackObject.h (233764 => 233765)
--- trunk/Source/_javascript_Core/API/JSCallbackObject.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/API/JSCallbackObject.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -194,7 +194,7 @@
using Parent::methodTable;
private:
- static String className(const JSObject*);
+ static String className(const JSObject*, VM&);
static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
Modified: trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h (233764 => 233765)
--- trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -130,7 +130,7 @@
}
template <class Parent>
-String JSCallbackObject<Parent>::className(const JSObject* object)
+String JSCallbackObject<Parent>::className(const JSObject* object, VM& vm)
{
const JSCallbackObject* thisObject = jsCast<const JSCallbackObject*>(object);
String thisClassName = thisObject->classRef()->className();
@@ -137,7 +137,7 @@
if (!thisClassName.isEmpty())
return thisClassName;
- return Parent::className(object);
+ return Parent::className(object, vm);
}
template <class Parent>
Modified: trunk/Source/_javascript_Core/ChangeLog (233764 => 233765)
--- trunk/Source/_javascript_Core/ChangeLog 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-07-12 08:43:38 UTC (rev 233765)
@@ -1,3 +1,77 @@
+2018-07-12 Yusuke Suzuki <[email protected]>
+
+ [JSC] Thread VM& to JSCell::methodTable(VM&)
+ https://bugs.webkit.org/show_bug.cgi?id=187548
+
+ Reviewed by Saam Barati.
+
+ This patch threads VM& to methodTable(VM&) and remove methodTable().
+ We add VM& parameter to estimatedSize() to thread VM& in estimatedSize implementations.
+
+ * API/APICast.h:
+ (toJS):
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject<Parent>::className):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::estimatedSize):
+ * bytecode/CodeBlock.h:
+ * bytecode/UnlinkedCodeBlock.cpp:
+ (JSC::UnlinkedCodeBlock::estimatedSize):
+ * bytecode/UnlinkedCodeBlock.h:
+ * debugger/DebuggerScope.cpp:
+ (JSC::DebuggerScope::className):
+ * debugger/DebuggerScope.h:
+ * heap/Heap.cpp:
+ (JSC::GatherHeapSnapshotData::GatherHeapSnapshotData):
+ (JSC::GatherHeapSnapshotData::operator() const):
+ (JSC::Heap::gatherExtraHeapSnapshotData):
+ * heap/HeapSnapshotBuilder.cpp:
+ (JSC::HeapSnapshotBuilder::json):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ * runtime/ClassInfo.h:
+ * runtime/DirectArguments.cpp:
+ (JSC::DirectArguments::estimatedSize):
+ * runtime/DirectArguments.h:
+ * runtime/HashMapImpl.cpp:
+ (JSC::HashMapImpl<HashMapBucket>::estimatedSize):
+ * runtime/HashMapImpl.h:
+ * runtime/JSArrayBuffer.cpp:
+ (JSC::JSArrayBuffer::estimatedSize):
+ * runtime/JSArrayBuffer.h:
+ * runtime/JSBigInt.cpp:
+ (JSC::JSBigInt::estimatedSize):
+ * runtime/JSBigInt.h:
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::dump const):
+ (JSC::JSCell::estimatedSizeInBytes const):
+ (JSC::JSCell::estimatedSize):
+ (JSC::JSCell::className):
+ * runtime/JSCell.h:
+ * runtime/JSCellInlines.h:
+ * runtime/JSGenericTypedArrayView.h:
+ * runtime/JSGenericTypedArrayViewInlines.h:
+ (JSC::JSGenericTypedArrayView<Adaptor>::estimatedSize):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::estimatedSize):
+ (JSC::JSObject::className):
+ (JSC::JSObject::toStringName):
+ (JSC::JSObject::calculatedClassName):
+ * runtime/JSObject.h:
+ * runtime/JSProxy.cpp:
+ (JSC::JSProxy::className):
+ * runtime/JSProxy.h:
+ * runtime/JSString.cpp:
+ (JSC::JSString::estimatedSize):
+ * runtime/JSString.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::estimatedSize):
+ * runtime/RegExp.h:
+ * runtime/WeakMapImpl.cpp:
+ (JSC::WeakMapImpl<WeakMapBucket>::estimatedSize):
+ * runtime/WeakMapImpl.h:
+
2018-07-11 Commit Queue <[email protected]>
Unreviewed, rolling out r233714.
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -999,13 +999,13 @@
#endif // ENABLE(FTL_JIT)
}
-size_t CodeBlock::estimatedSize(JSCell* cell)
+size_t CodeBlock::estimatedSize(JSCell* cell, VM& vm)
{
CodeBlock* thisObject = jsCast<CodeBlock*>(cell);
size_t extraMemoryAllocated = thisObject->m_instructions.size() * sizeof(Instruction);
if (thisObject->m_jitCode)
extraMemoryAllocated += thisObject->m_jitCode->size();
- return Base::estimatedSize(cell) + extraMemoryAllocated;
+ return Base::estimatedSize(cell, vm) + extraMemoryAllocated;
}
void CodeBlock::visitChildren(JSCell* cell, SlotVisitor& visitor)
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (233764 => 233765)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -188,7 +188,7 @@
// https://bugs.webkit.org/show_bug.cgi?id=123677
CodeBlock* baselineVersion();
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
static void visitChildren(JSCell*, SlotVisitor&);
void visitChildren(SlotVisitor&);
void finalizeUnconditionally(VM&);
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -94,11 +94,11 @@
visitor.reportExtraMemoryVisited(thisObject->m_unlinkedInstructions->sizeInBytes());
}
-size_t UnlinkedCodeBlock::estimatedSize(JSCell* cell)
+size_t UnlinkedCodeBlock::estimatedSize(JSCell* cell, VM& vm)
{
UnlinkedCodeBlock* thisObject = jsCast<UnlinkedCodeBlock*>(cell);
size_t extraSize = thisObject->m_unlinkedInstructions ? thisObject->m_unlinkedInstructions->sizeInBytes() : 0;
- return Base::estimatedSize(cell) + extraSize;
+ return Base::estimatedSize(cell, vm) + extraSize;
}
int UnlinkedCodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset)
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h (233764 => 233765)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -509,7 +509,7 @@
protected:
static void visitChildren(JSCell*, SlotVisitor&);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
public:
DECLARE_INFO;
Modified: trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -66,7 +66,7 @@
visitor.append(thisObject->m_next);
}
-String DebuggerScope::className(const JSObject* object)
+String DebuggerScope::className(const JSObject* object, VM& vm)
{
const DebuggerScope* scope = jsCast<const DebuggerScope*>(object);
// We cannot assert that scope->isValid() because the TypeProfiler may encounter an invalidated
@@ -74,7 +74,7 @@
if (!scope->isValid())
return String();
JSObject* thisObject = JSScope::objectAtScope(scope->jsScope());
- return thisObject->methodTable()->className(thisObject);
+ return thisObject->methodTable(vm)->className(thisObject, vm);
}
bool DebuggerScope::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
Modified: trunk/Source/_javascript_Core/debugger/DebuggerScope.h (233764 => 233765)
--- trunk/Source/_javascript_Core/debugger/DebuggerScope.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/debugger/DebuggerScope.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -41,7 +41,7 @@
JS_EXPORT_PRIVATE static DebuggerScope* create(VM& vm, JSScope* scope);
static void visitChildren(JSCell*, SlotVisitor&);
- static String className(const JSObject*);
+ static String className(const JSObject*, VM&);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static bool deleteProperty(JSCell*, ExecState*, PropertyName);
Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/heap/Heap.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -713,8 +713,9 @@
}
struct GatherHeapSnapshotData : MarkedBlock::CountFunctor {
- GatherHeapSnapshotData(HeapSnapshotBuilder& builder)
- : m_builder(builder)
+ GatherHeapSnapshotData(VM& vm, HeapSnapshotBuilder& builder)
+ : m_vm(vm)
+ , m_builder(builder)
{
}
@@ -722,11 +723,12 @@
{
if (isJSCellKind(kind)) {
JSCell* cell = static_cast<JSCell*>(heapCell);
- cell->methodTable()->heapSnapshot(cell, m_builder);
+ cell->methodTable(m_vm)->heapSnapshot(cell, m_builder);
}
return IterationStatus::Continue;
}
+ VM& m_vm;
HeapSnapshotBuilder& m_builder;
};
@@ -734,7 +736,7 @@
{
if (HeapSnapshotBuilder* builder = heapProfiler.activeSnapshotBuilder()) {
HeapIterationScope heapIterationScope(*this);
- GatherHeapSnapshotData functor(*builder);
+ GatherHeapSnapshotData functor(*m_vm, *builder);
m_objectSpace.forEachLiveCell(heapIterationScope, functor);
}
}
Modified: trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -240,7 +240,7 @@
json.append(',');
json.appendNumber(node.identifier);
json.append(',');
- json.appendNumber(node.cell->estimatedSizeInBytes());
+ json.appendNumber(node.cell->estimatedSizeInBytes(vm));
json.append(',');
json.appendNumber(classNameIndex);
json.append(',');
Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -548,7 +548,7 @@
if (UNLIKELY(customJoinCase)) {
scope.release();
- return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisObject->methodTable(vm)->className(thisObject), "]"));
+ return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisObject->methodTable(vm)->className(thisObject, vm), "]"));
}
// 4. Return the result of calling the [[Call]] internal method of func providing array as the this value and an empty arguments list.
Modified: trunk/Source/_javascript_Core/runtime/ClassInfo.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/ClassInfo.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/ClassInfo.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -89,7 +89,7 @@
GetPropertyNamesFunctionPtr WTF_METHOD_TABLE_ENTRY(getStructurePropertyNames);
GetPropertyNamesFunctionPtr WTF_METHOD_TABLE_ENTRY(getGenericPropertyNames);
- using ClassNameFunctionPtr = String (*)(const JSObject*);
+ using ClassNameFunctionPtr = String (*)(const JSObject*, VM&);
ClassNameFunctionPtr WTF_METHOD_TABLE_ENTRY(className);
using ToStringNameFunctionPtr = String (*)(const JSObject*, ExecState*);
@@ -119,7 +119,7 @@
using HeapSnapshotFunctionPtr = void (*)(JSCell*, HeapSnapshotBuilder&);
HeapSnapshotFunctionPtr WTF_METHOD_TABLE_ENTRY(heapSnapshot);
- using EstimatedSizeFunctionPtr = size_t (*)(JSCell*);
+ using EstimatedSizeFunctionPtr = size_t (*)(JSCell*, VM&);
EstimatedSizeFunctionPtr WTF_METHOD_TABLE_ENTRY(estimatedSize);
using VisitOutputConstraintsPtr = void (*)(JSCell*, SlotVisitor&);
Modified: trunk/Source/_javascript_Core/runtime/DirectArguments.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/DirectArguments.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/DirectArguments.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -83,12 +83,12 @@
return result;
}
-size_t DirectArguments::estimatedSize(JSCell* cell)
+size_t DirectArguments::estimatedSize(JSCell* cell, VM& vm)
{
DirectArguments* thisObject = jsCast<DirectArguments*>(cell);
size_t mappedArgumentsSize = thisObject->m_mappedArguments ? thisObject->mappedArgumentsSize() * sizeof(bool) : 0;
size_t modifiedArgumentsSize = thisObject->m_modifiedArgumentsDescriptor ? thisObject->m_length * sizeof(bool) : 0;
- return Base::estimatedSize(cell) + mappedArgumentsSize + modifiedArgumentsSize;
+ return Base::estimatedSize(cell, vm) + mappedArgumentsSize + modifiedArgumentsSize;
}
void DirectArguments::visitChildren(JSCell* thisCell, SlotVisitor& visitor)
Modified: trunk/Source/_javascript_Core/runtime/DirectArguments.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/DirectArguments.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/DirectArguments.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -64,7 +64,7 @@
// Creates an arguments object by copying the argumnets from the stack.
static DirectArguments* createByCopying(ExecState*);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
static void visitChildren(JSCell*, SlotVisitor&);
uint32_t internalLength() const
Modified: trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -67,9 +67,9 @@
}
template <typename HashMapBucket>
-size_t HashMapImpl<HashMapBucket>::estimatedSize(JSCell* cell)
+size_t HashMapImpl<HashMapBucket>::estimatedSize(JSCell* cell, VM& vm)
{
- return Base::estimatedSize(cell) + static_cast<HashMapImpl<HashMapBucket>*>(cell)->approximateSize();
+ return Base::estimatedSize(cell, vm) + static_cast<HashMapImpl<HashMapBucket>*>(cell)->approximateSize();
}
const ClassInfo* getHashMapBucketKeyClassInfo()
Modified: trunk/Source/_javascript_Core/runtime/HashMapImpl.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/HashMapImpl.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -346,7 +346,7 @@
static void visitChildren(JSCell*, SlotVisitor&);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
HashMapImpl(VM& vm, Structure* structure)
: Base(vm, structure)
Modified: trunk/Source/_javascript_Core/runtime/JSArrayBuffer.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSArrayBuffer.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBuffer.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -78,11 +78,11 @@
return impl()->sharingMode();
}
-size_t JSArrayBuffer::estimatedSize(JSCell* cell)
+size_t JSArrayBuffer::estimatedSize(JSCell* cell, VM& vm)
{
JSArrayBuffer* thisObject = jsCast<JSArrayBuffer*>(cell);
size_t bufferEstimatedSize = thisObject->impl()->gcSizeEstimateInBytes();
- return Base::estimatedSize(cell) + bufferEstimatedSize;
+ return Base::estimatedSize(cell, vm) + bufferEstimatedSize;
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/JSArrayBuffer.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSArrayBuffer.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBuffer.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -58,7 +58,7 @@
static ArrayBuffer* toWrapped(VM&, JSValue);
protected:
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
private:
Poisoned<JSArrayBufferPoison, ArrayBuffer*> m_impl;
Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -1183,9 +1183,9 @@
return nullptr;
}
-size_t JSBigInt::estimatedSize(JSCell* cell)
+size_t JSBigInt::estimatedSize(JSCell* cell, VM& vm)
{
- return Base::estimatedSize(cell) + jsCast<JSBigInt*>(cell)->m_length * sizeof(Digit);
+ return Base::estimatedSize(cell, vm) + jsCast<JSBigInt*>(cell)->m_length * sizeof(Digit);
}
double JSBigInt::toNumber(ExecState* exec) const
Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSBigInt.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -46,7 +46,7 @@
enum class InitializationType { None, WithZero };
void initialize(InitializationType);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype);
static JSBigInt* createZero(VM&);
Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSCell.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -46,7 +46,7 @@
void JSCell::dump(PrintStream& out) const
{
- methodTable()->dumpToStream(this, out);
+ methodTable(*vm())->dumpToStream(this, out);
}
void JSCell::dumpToStream(const JSCell* cell, PrintStream& out)
@@ -54,12 +54,12 @@
out.printf("<%p, %s>", cell, cell->className(*cell->vm()));
}
-size_t JSCell::estimatedSizeInBytes() const
+size_t JSCell::estimatedSizeInBytes(VM& vm) const
{
- return methodTable()->estimatedSize(const_cast<JSCell*>(this));
+ return methodTable(vm)->estimatedSize(const_cast<JSCell*>(this), vm);
}
-size_t JSCell::estimatedSize(JSCell* cell)
+size_t JSCell::estimatedSize(JSCell* cell, VM&)
{
return cell->cellSize();
}
@@ -222,7 +222,7 @@
RELEASE_ASSERT_NOT_REACHED();
}
-String JSCell::className(const JSObject*)
+String JSCell::className(const JSObject*, VM&)
{
RELEASE_ASSERT_NOT_REACHED();
return String();
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -170,8 +170,8 @@
void dump(PrintStream&) const;
JS_EXPORT_PRIVATE static void dumpToStream(const JSCell*, PrintStream&);
- size_t estimatedSizeInBytes() const;
- JS_EXPORT_PRIVATE static size_t estimatedSize(JSCell*);
+ size_t estimatedSizeInBytes(VM&) const;
+ JS_EXPORT_PRIVATE static size_t estimatedSize(JSCell*, VM&);
static void visitChildren(JSCell*, SlotVisitor&);
static void visitOutputConstraints(JSCell*, SlotVisitor&);
@@ -180,7 +180,6 @@
// Object operations, with the toObject operation included.
const ClassInfo* classInfo(VM&) const;
- const MethodTable* methodTable() const;
const MethodTable* methodTable(VM&) const;
static bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static bool putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
@@ -259,7 +258,7 @@
static NO_RETURN_DUE_TO_CRASH bool setPrototype(JSObject*, ExecState*, JSValue, bool);
static NO_RETURN_DUE_TO_CRASH JSValue getPrototype(JSObject*, ExecState*);
- static String className(const JSObject*);
+ static String className(const JSObject*, VM&);
static String toStringName(const JSObject*, ExecState*);
JS_EXPORT_PRIVATE static bool customHasInstance(JSObject*, ExecState*, JSValue);
static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -287,11 +287,6 @@
vm.heap.writeBarrier(this, structure);
}
-inline const MethodTable* JSCell::methodTable() const
-{
- return methodTable(*vm());
-}
-
inline const MethodTable* JSCell::methodTable(VM& vm) const
{
Structure* structure = this->structure(vm);
Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -285,7 +285,7 @@
static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
static void visitChildren(JSCell*, SlotVisitor&);
private:
Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -500,16 +500,16 @@
}
template<typename Adaptor>
-size_t JSGenericTypedArrayView<Adaptor>::estimatedSize(JSCell* cell)
+size_t JSGenericTypedArrayView<Adaptor>::estimatedSize(JSCell* cell, VM& vm)
{
JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);
if (thisObject->m_mode == OversizeTypedArray)
- return Base::estimatedSize(thisObject) + thisObject->byteSize();
+ return Base::estimatedSize(thisObject, vm) + thisObject->byteSize();
if (thisObject->m_mode == FastTypedArray && thisObject->m_vector)
- return Base::estimatedSize(thisObject) + thisObject->byteSize();
+ return Base::estimatedSize(thisObject, vm) + thisObject->byteSize();
- return Base::estimatedSize(thisObject);
+ return Base::estimatedSize(thisObject, vm);
}
template<typename Adaptor>
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -423,11 +423,11 @@
return structure;
}
-size_t JSObject::estimatedSize(JSCell* cell)
+size_t JSObject::estimatedSize(JSCell* cell, VM& vm)
{
JSObject* thisObject = jsCast<JSObject*>(cell);
- size_t butterflyOutOfLineSize = thisObject->m_butterfly ? thisObject->structure()->outOfLineSize() : 0;
- return Base::estimatedSize(cell) + butterflyOutOfLineSize;
+ size_t butterflyOutOfLineSize = thisObject->m_butterfly ? thisObject->structure(vm)->outOfLineSize() : 0;
+ return Base::estimatedSize(cell, vm) + butterflyOutOfLineSize;
}
void JSObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
@@ -507,18 +507,19 @@
#endif
}
-String JSObject::className(const JSObject* object)
+String JSObject::className(const JSObject* object, VM& vm)
{
- const ClassInfo* info = object->classInfo(*object->vm());
+ const ClassInfo* info = object->classInfo(vm);
ASSERT(info);
return info->className;
}
-String JSObject::toStringName(const JSObject* object, ExecState*)
+String JSObject::toStringName(const JSObject* object, ExecState* exec)
{
- const ClassInfo* info = object->classInfo(*object->vm());
+ VM& vm = exec->vm();
+ const ClassInfo* info = object->classInfo(vm);
ASSERT(info);
- return info->methodTable.className(object);
+ return info->methodTable.className(object, vm);
}
String JSObject::calculatedClassName(JSObject* object)
@@ -552,7 +553,7 @@
scope.clearException();
if (prototypeFunctionName.isNull() || prototypeFunctionName == "Object") {
- String tableClassName = object->methodTable(vm)->className(object);
+ String tableClassName = object->methodTable(vm)->className(object, vm);
if (!tableClassName.isNull() && tableClassName != "Object")
return tableClassName;
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -114,11 +114,11 @@
// JSFinalObject or a JSArray. This is the method that will do that.
static JSObject* createRawObject(ExecState* exec, Structure* structure, Butterfly* = nullptr);
- JS_EXPORT_PRIVATE static size_t estimatedSize(JSCell*);
+ JS_EXPORT_PRIVATE static size_t estimatedSize(JSCell*, VM&);
JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
JS_EXPORT_PRIVATE static void heapSnapshot(JSCell*, HeapSnapshotBuilder&);
- JS_EXPORT_PRIVATE static String className(const JSObject*);
+ JS_EXPORT_PRIVATE static String className(const JSObject*, VM&);
JS_EXPORT_PRIVATE static String calculatedClassName(JSObject*);
// This function is what Object.prototype.toString() will use to get the name of
@@ -760,7 +760,7 @@
// You should only call isStructureExtensible() when:
// - Performing this check in a way that isn't described in the specification
// as calling the virtual [[IsExtensible]] trap.
- // - When you're guaranteed that object->methodTable()->isExtensible isn't
+ // - When you're guaranteed that object->methodTable(vm)->isExtensible isn't
// overridden.
ALWAYS_INLINE bool isStructureExtensible(VM& vm) { return structure(vm)->isStructureExtensible(); }
// You should call this when performing [[IsExtensible]] trap in a place
Modified: trunk/Source/_javascript_Core/runtime/JSProxy.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSProxy.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSProxy.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -49,10 +49,10 @@
setPrototypeDirect(vm, globalObject->getPrototypeDirect(vm));
}
-String JSProxy::className(const JSObject* object)
+String JSProxy::className(const JSObject* object, VM& vm)
{
const JSProxy* thisObject = jsCast<const JSProxy*>(object);
- return thisObject->target()->methodTable()->className(thisObject->target());
+ return thisObject->target()->methodTable(vm)->className(thisObject->target(), vm);
}
String JSProxy::toStringName(const JSObject* object, ExecState* exec)
Modified: trunk/Source/_javascript_Core/runtime/JSProxy.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSProxy.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSProxy.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -80,7 +80,7 @@
JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
- JS_EXPORT_PRIVATE static String className(const JSObject*);
+ JS_EXPORT_PRIVATE static String className(const JSObject*, VM&);
JS_EXPORT_PRIVATE static String toStringName(const JSObject*, ExecState*);
JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned, PropertySlot&);
Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSString.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -83,12 +83,12 @@
return WTF::equal(*str1.impl(), *str2.impl());
}
-size_t JSString::estimatedSize(JSCell* cell)
+size_t JSString::estimatedSize(JSCell* cell, VM& vm)
{
JSString* thisObject = asString(cell);
if (thisObject->isRope())
- return Base::estimatedSize(cell);
- return Base::estimatedSize(cell) + thisObject->m_value.impl()->costDuringGC();
+ return Base::estimatedSize(cell, vm);
+ return Base::estimatedSize(cell, vm) + thisObject->m_value.impl()->costDuringGC();
}
void JSString::visitChildren(JSCell* cell, SlotVisitor& visitor)
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -185,7 +185,7 @@
DECLARE_EXPORT_INFO;
static void dumpToStream(const JSCell*, PrintStream&);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
static void visitChildren(JSCell*, SlotVisitor&);
enum {
Modified: trunk/Source/_javascript_Core/runtime/RegExp.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/RegExp.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/RegExp.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -238,7 +238,7 @@
thisObject->RegExp::~RegExp();
}
-size_t RegExp::estimatedSize(JSCell* cell)
+size_t RegExp::estimatedSize(JSCell* cell, VM& vm)
{
RegExp* thisObject = static_cast<RegExp*>(cell);
size_t regexDataSize = thisObject->m_regExpBytecode ? thisObject->m_regExpBytecode->estimatedSizeInBytes() : 0;
@@ -245,7 +245,7 @@
#if ENABLE(YARR_JIT)
regexDataSize += thisObject->m_regExpJITCode.size();
#endif
- return Base::estimatedSize(cell) + regexDataSize;
+ return Base::estimatedSize(cell, vm) + regexDataSize;
}
RegExp* RegExp::createWithoutCaching(VM& vm, const String& patternString, RegExpFlags flags)
Modified: trunk/Source/_javascript_Core/runtime/RegExp.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/RegExp.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/RegExp.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -48,7 +48,7 @@
JS_EXPORT_PRIVATE static RegExp* create(VM&, const String& pattern, RegExpFlags);
static const bool needsDestruction = true;
static void destroy(JSCell*);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
JS_EXPORT_PRIVATE static void dumpToStream(const JSCell*, PrintStream&);
bool global() const { return m_flags & FlagGlobal; }
Modified: trunk/Source/_javascript_Core/runtime/WeakMapImpl.cpp (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/WeakMapImpl.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/WeakMapImpl.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -49,10 +49,10 @@
}
template <typename WeakMapBucket>
-size_t WeakMapImpl<WeakMapBucket>::estimatedSize(JSCell* cell)
+size_t WeakMapImpl<WeakMapBucket>::estimatedSize(JSCell* cell, VM& vm)
{
auto* thisObject = static_cast<WeakMapImpl*>(cell);
- return Base::estimatedSize(thisObject) + (sizeof(WeakMapImpl) - sizeof(Base)) + thisObject->m_capacity * sizeof(WeakMapBucket);
+ return Base::estimatedSize(thisObject, vm) + (sizeof(WeakMapImpl) - sizeof(Base)) + thisObject->m_capacity * sizeof(WeakMapBucket);
}
template <>
Modified: trunk/Source/_javascript_Core/runtime/WeakMapImpl.h (233764 => 233765)
--- trunk/Source/_javascript_Core/runtime/WeakMapImpl.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/_javascript_Core/runtime/WeakMapImpl.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -203,7 +203,7 @@
static void visitChildren(JSCell*, SlotVisitor&);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, VM&);
WeakMapImpl(VM& vm, Structure* structure)
: Base(vm, structure)
Modified: trunk/Source/WebCore/ChangeLog (233764 => 233765)
--- trunk/Source/WebCore/ChangeLog 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/WebCore/ChangeLog 2018-07-12 08:43:38 UTC (rev 233765)
@@ -1,3 +1,21 @@
+2018-07-12 Yusuke Suzuki <[email protected]>
+
+ [JSC] Thread VM& to JSCell::methodTable(VM&)
+ https://bugs.webkit.org/show_bug.cgi?id=187548
+
+ Reviewed by Saam Barati.
+
+ * bindings/js/JSDOMConstructorBase.h:
+ (WebCore::JSDOMConstructorBase::className):
+ * bindings/js/JSPluginElementFunctions.cpp:
+ (WebCore::pluginElementCustomGetCallData):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateHeader):
+ (GenerateImplementation):
+ * bindings/scripts/test/JS/JSInterfaceName.cpp:
+ (WebCore::JSInterfaceName::estimatedSize):
+ * bindings/scripts/test/JS/JSInterfaceName.h:
+
2018-07-11 Youenn Fablet <[email protected]>
MediaDevices should derive from EventTarget in its IDL
Modified: trunk/Source/WebCore/bindings/js/JSDOMConstructorBase.h (233764 => 233765)
--- trunk/Source/WebCore/bindings/js/JSDOMConstructorBase.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/WebCore/bindings/js/JSDOMConstructorBase.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -37,7 +37,7 @@
{
}
- static String className(const JSObject*);
+ static String className(const JSObject*, JSC::VM&);
static JSC::CallType getCallData(JSCell*, JSC::CallData&);
};
@@ -46,7 +46,7 @@
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
-inline String JSDOMConstructorBase::className(const JSObject*)
+inline String JSDOMConstructorBase::className(const JSObject*, JSC::VM&)
{
return "Function"_s;
}
Modified: trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp (233764 => 233765)
--- trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -168,7 +168,8 @@
if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(element)) {
CallData scriptObjectCallData;
- if (scriptObject->methodTable()->getCallData(scriptObject, scriptObjectCallData) == CallType::None)
+ VM& vm = *scriptObject->vm();
+ if (scriptObject->methodTable(vm)->getCallData(scriptObject, scriptObjectCallData) == CallType::None)
return CallType::None;
callData.native.function = callPlugin;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (233764 => 233765)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-07-12 08:43:38 UTC (rev 233765)
@@ -2650,7 +2650,7 @@
}
if (InstanceNeedsEstimatedSize($interface)) {
- push(@headerContent, " static size_t estimatedSize(JSCell*);\n");
+ push(@headerContent, " static size_t estimatedSize(JSCell*, JSC::VM&);\n");
}
if (!$hasParent) {
@@ -4505,10 +4505,10 @@
}
if (InstanceNeedsEstimatedSize($interface)) {
- push(@implContent, "size_t ${className}::estimatedSize(JSCell* cell)\n");
+ push(@implContent, "size_t ${className}::estimatedSize(JSCell* cell, VM& vm)\n");
push(@implContent, "{\n");
push(@implContent, " auto* thisObject = jsCast<${className}*>(cell);\n");
- push(@implContent, " return Base::estimatedSize(thisObject) + thisObject->wrapped().memoryCost();\n");
+ push(@implContent, " return Base::estimatedSize(thisObject, vm) + thisObject->wrapped().memoryCost();\n");
push(@implContent, "}\n\n");
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.cpp (233764 => 233765)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.cpp 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.cpp 2018-07-12 08:43:38 UTC (rev 233765)
@@ -162,10 +162,10 @@
visitor.reportExtraMemoryVisited(thisObject->wrapped().memoryCost());
}
-size_t JSInterfaceName::estimatedSize(JSCell* cell)
+size_t JSInterfaceName::estimatedSize(JSCell* cell, VM& vm)
{
auto* thisObject = jsCast<JSInterfaceName*>(cell);
- return Base::estimatedSize(thisObject) + thisObject->wrapped().memoryCost();
+ return Base::estimatedSize(thisObject, vm) + thisObject->wrapped().memoryCost();
}
bool JSInterfaceNameOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h (233764 => 233765)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h 2018-07-12 08:40:18 UTC (rev 233764)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h 2018-07-12 08:43:38 UTC (rev 233765)
@@ -39,7 +39,7 @@
static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
static InterfaceName* toWrapped(JSC::VM&, JSC::JSValue);
- static size_t estimatedSize(JSCell*);
+ static size_t estimatedSize(JSCell*, JSC::VM&);
static void destroy(JSC::JSCell*);
DECLARE_INFO;