diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/ClassInfo.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/ClassInfo.h | 101 |
1 files changed, 54 insertions, 47 deletions
diff --git a/Source/JavaScriptCore/runtime/ClassInfo.h b/Source/JavaScriptCore/runtime/ClassInfo.h index 8ff75f4eb..480aea220 100644 --- a/Source/JavaScriptCore/runtime/ClassInfo.h +++ b/Source/JavaScriptCore/runtime/ClassInfo.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003-2017 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,17 +20,15 @@ * */ -#ifndef ClassInfo_h -#define ClassInfo_h +#pragma once #include "CallFrame.h" #include "ConstructData.h" -#include "CopyToken.h" #include "JSCell.h" namespace JSC { -class HashEntry; +class HeapSnapshotBuilder; class JSArrayBufferView; struct HashTable; @@ -40,20 +38,17 @@ struct MethodTable { typedef void (*VisitChildrenFunctionPtr)(JSCell*, SlotVisitor&); VisitChildrenFunctionPtr visitChildren; - - typedef void (*CopyBackingStoreFunctionPtr)(JSCell*, CopyVisitor&, CopyToken); - CopyBackingStoreFunctionPtr copyBackingStore; - + typedef CallType (*GetCallDataFunctionPtr)(JSCell*, CallData&); GetCallDataFunctionPtr getCallData; typedef ConstructType (*GetConstructDataFunctionPtr)(JSCell*, ConstructData&); GetConstructDataFunctionPtr getConstructData; - typedef void (*PutFunctionPtr)(JSCell*, ExecState*, PropertyName propertyName, JSValue, PutPropertySlot&); + typedef bool (*PutFunctionPtr)(JSCell*, ExecState*, PropertyName propertyName, JSValue, PutPropertySlot&); PutFunctionPtr put; - typedef void (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); + typedef bool (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); PutByIndexFunctionPtr putByIndex; typedef bool (*DeletePropertyFunctionPtr)(JSCell*, ExecState*, PropertyName); @@ -83,9 +78,18 @@ struct MethodTable { typedef void (*GetPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); GetPropertyNamesFunctionPtr getPropertyNames; + typedef uint32_t (*GetEnumerableLengthFunctionPtr)(ExecState*, JSObject*); + GetEnumerableLengthFunctionPtr getEnumerableLength; + + GetPropertyNamesFunctionPtr getStructurePropertyNames; + GetPropertyNamesFunctionPtr getGenericPropertyNames; + typedef String (*ClassNameFunctionPtr)(const JSObject*); ClassNameFunctionPtr className; + typedef String (*ToStringNameFunctionPtr)(const JSObject*, ExecState*); + ToStringNameFunctionPtr toStringName; + typedef bool (*CustomHasInstanceFunctionPtr)(JSObject*, ExecState*, JSValue); CustomHasInstanceFunctionPtr customHasInstance; @@ -95,8 +99,32 @@ struct MethodTable { typedef ArrayBuffer* (*SlowDownAndWasteMemory)(JSArrayBufferView*); SlowDownAndWasteMemory slowDownAndWasteMemory; - typedef PassRefPtr<ArrayBufferView> (*GetTypedArrayImpl)(JSArrayBufferView*); + typedef RefPtr<ArrayBufferView> (*GetTypedArrayImpl)(JSArrayBufferView*); GetTypedArrayImpl getTypedArrayImpl; + + typedef bool (*PreventExtensionsFunctionPtr)(JSObject*, ExecState*); + PreventExtensionsFunctionPtr preventExtensions; + + typedef bool (*IsExtensibleFunctionPtr)(JSObject*, ExecState*); + IsExtensibleFunctionPtr isExtensible; + + typedef bool (*SetPrototypeFunctionPtr)(JSObject*, ExecState*, JSValue, bool shouldThrowIfCantSet); + SetPrototypeFunctionPtr setPrototype; + + typedef JSValue (*GetPrototypeFunctionPtr)(JSObject*, ExecState*); + GetPrototypeFunctionPtr getPrototype; + + typedef void (*DumpToStreamFunctionPtr)(const JSCell*, PrintStream&); + DumpToStreamFunctionPtr dumpToStream; + + typedef void (*HeapSnapshotFunctionPtr)(JSCell*, HeapSnapshotBuilder&); + HeapSnapshotFunctionPtr heapSnapshot; + + typedef size_t (*EstimatedSizeFunctionPtr)(JSCell*); + EstimatedSizeFunctionPtr estimatedSize; + + typedef void (*VisitOutputConstraintsPtr)(JSCell*, SlotVisitor&); + VisitOutputConstraintsPtr visitOutputConstraints; }; #define CREATE_MEMBER_CHECKER(member) \ @@ -121,7 +149,6 @@ struct MethodTable { #define CREATE_METHOD_TABLE(ClassName) { \ &ClassName::destroy, \ &ClassName::visitChildren, \ - &ClassName::copyBackingStore, \ &ClassName::getCallData, \ &ClassName::getConstructData, \ &ClassName::put, \ @@ -135,11 +162,23 @@ struct MethodTable { &ClassName::getOwnPropertyNames, \ &ClassName::getOwnNonIndexPropertyNames, \ &ClassName::getPropertyNames, \ + &ClassName::getEnumerableLength, \ + &ClassName::getStructurePropertyNames, \ + &ClassName::getGenericPropertyNames, \ &ClassName::className, \ + &ClassName::toStringName, \ &ClassName::customHasInstance, \ &ClassName::defineOwnProperty, \ &ClassName::slowDownAndWasteMemory, \ - &ClassName::getTypedArrayImpl \ + &ClassName::getTypedArrayImpl, \ + &ClassName::preventExtensions, \ + &ClassName::isExtensible, \ + &ClassName::setPrototype, \ + &ClassName::getPrototype, \ + &ClassName::dumpToStream, \ + &ClassName::heapSnapshot, \ + &ClassName::estimatedSize, \ + &ClassName::visitOutputConstraints \ }, \ ClassName::TypedArrayStorageType @@ -151,25 +190,6 @@ struct ClassInfo { // nullptrif there is none. const ClassInfo* parentClass; - // Static hash-table of properties. - // For classes that can be used from multiple threads, it is accessed via a getter function - // that would typically return a pointer to a thread-specific value. - const HashTable* propHashTable(ExecState* exec) const - { - if (classPropHashTableGetterFunction) - return &classPropHashTableGetterFunction(exec->vm()); - - return staticPropHashTable; - } - - const HashTable* propHashTable(VM& vm) const - { - if (classPropHashTableGetterFunction) - return &classPropHashTableGetterFunction(vm); - - return staticPropHashTable; - } - bool isSubClassOf(const ClassInfo* other) const { for (const ClassInfo* ci = this; ci; ci = ci->parentClass) { @@ -179,20 +199,9 @@ struct ClassInfo { return false; } - bool hasStaticProperties() const - { - for (const ClassInfo* ci = this; ci; ci = ci->parentClass) { - if (ci->staticPropHashTable || ci->classPropHashTableGetterFunction) - return true; - } - return false; - } - - bool hasStaticSetterOrReadonlyProperties(VM&) const; + JS_EXPORT_PRIVATE bool hasStaticSetterOrReadonlyProperties() const; const HashTable* staticPropHashTable; - typedef const HashTable& (*ClassPropHashTableGetterFunction)(VM&); - const ClassPropHashTableGetterFunction classPropHashTableGetterFunction; MethodTable methodTable; @@ -200,5 +209,3 @@ struct ClassInfo { }; } // namespace JSC - -#endif // ClassInfo_h |