Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #424 from obastemur/imp_ot_mem
Browse files Browse the repository at this point in the history
chakrashim: ObjectTemplate, allocate interceptor stuff lazily
  • Loading branch information
obastemur authored Nov 14, 2017
2 parents c6863c0 + 73fb87d commit 8b94e26
Show file tree
Hide file tree
Showing 2 changed files with 308 additions and 237 deletions.
78 changes: 62 additions & 16 deletions deps/chakrashim/src/v8chakra.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,67 @@ class ExternalData {
}
};

struct SetterGetterInterceptor
{
NamedPropertyGetterCallback namedPropertyGetter;
NamedPropertySetterCallback namedPropertySetter;
NamedPropertyQueryCallback namedPropertyQuery;
NamedPropertyDeleterCallback namedPropertyDeleter;
NamedPropertyEnumeratorCallback namedPropertyEnumerator;
NamedPropertyDefinerCallback namedPropertyDefiner;
NamedPropertyDescriptorCallback namedPropertyDescriptor;
Persistent<Value> namedPropertyInterceptorData;
IndexedPropertyGetterCallback indexedPropertyGetter;
IndexedPropertySetterCallback indexedPropertySetter;
IndexedPropertyQueryCallback indexedPropertyQuery;
IndexedPropertyDeleterCallback indexedPropertyDeleter;
IndexedPropertyEnumeratorCallback indexedPropertyEnumerator;
IndexedPropertyDefinerCallback indexedPropertyDefiner;
IndexedPropertyDescriptorCallback indexedPropertyDescriptor;
Persistent<Value> indexedPropertyInterceptorData;

SetterGetterInterceptor(SetterGetterInterceptor * setterGetterInterceptor):
namedPropertyGetter(setterGetterInterceptor->namedPropertyGetter),
namedPropertySetter(setterGetterInterceptor->namedPropertySetter),
namedPropertyQuery(setterGetterInterceptor->namedPropertyQuery),
namedPropertyDeleter(setterGetterInterceptor->namedPropertyDeleter),
namedPropertyEnumerator(setterGetterInterceptor->namedPropertyEnumerator),
namedPropertyDefiner(setterGetterInterceptor->namedPropertyDefiner),
namedPropertyDescriptor(setterGetterInterceptor->namedPropertyDescriptor),
namedPropertyInterceptorData(
nullptr, setterGetterInterceptor->namedPropertyInterceptorData),
indexedPropertyGetter(setterGetterInterceptor->indexedPropertyGetter),
indexedPropertySetter(setterGetterInterceptor->indexedPropertySetter),
indexedPropertyQuery(setterGetterInterceptor->indexedPropertyQuery),
indexedPropertyDeleter(setterGetterInterceptor->indexedPropertyDeleter),
indexedPropertyEnumerator(setterGetterInterceptor->indexedPropertyEnumerator),
indexedPropertyDefiner(setterGetterInterceptor->indexedPropertyDefiner),
indexedPropertyDescriptor(setterGetterInterceptor->indexedPropertyDescriptor),
indexedPropertyInterceptorData(nullptr,
setterGetterInterceptor->indexedPropertyInterceptorData)
{
}

SetterGetterInterceptor():
namedPropertyGetter(nullptr),
namedPropertySetter(nullptr),
namedPropertyQuery(nullptr),
namedPropertyDeleter(nullptr),
namedPropertyEnumerator(nullptr),
namedPropertyDefiner(nullptr),
namedPropertyDescriptor(nullptr),
indexedPropertyGetter(nullptr),
indexedPropertySetter(nullptr),
indexedPropertyQuery(nullptr),
indexedPropertyDeleter(nullptr),
indexedPropertyEnumerator(nullptr),
indexedPropertyDefiner(nullptr),
indexedPropertyDescriptor(nullptr)
{

}
};

class ObjectData: public ExternalData {
public:
static const ExternalDataTypes ExternalDataType =
Expand All @@ -103,22 +164,7 @@ class ObjectData: public ExternalData {

JsValueRef objectInstance;
Persistent<ObjectTemplate> objectTemplate; // Original ObjectTemplate
NamedPropertyGetterCallback namedPropertyGetter;
NamedPropertySetterCallback namedPropertySetter;
NamedPropertyQueryCallback namedPropertyQuery;
NamedPropertyDeleterCallback namedPropertyDeleter;
NamedPropertyEnumeratorCallback namedPropertyEnumerator;
NamedPropertyDefinerCallback namedPropertyDefiner;
NamedPropertyDescriptorCallback namedPropertyDescriptor;
Persistent<Value> namedPropertyInterceptorData;
IndexedPropertyGetterCallback indexedPropertyGetter;
IndexedPropertySetterCallback indexedPropertySetter;
IndexedPropertyQueryCallback indexedPropertyQuery;
IndexedPropertyDeleterCallback indexedPropertyDeleter;
IndexedPropertyEnumeratorCallback indexedPropertyEnumerator;
IndexedPropertyDefinerCallback indexedPropertyDefiner;
IndexedPropertyDescriptorCallback indexedPropertyDescriptor;
Persistent<Value> indexedPropertyInterceptorData;
SetterGetterInterceptor * setterGetterInterceptor;
int internalFieldCount;
FieldValue* internalFields;

Expand Down
Loading

0 comments on commit 8b94e26

Please sign in to comment.