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

Commit

Permalink
chakrashim: remove supportsOverrideToString
Browse files Browse the repository at this point in the history
"supportsOverrideToString" was originally added to make old
FastBuffer work. Buffer has long changed implementation. This is
no longer used.

Fix #80

Reviewed-by: @kunalspathak
  • Loading branch information
Jianchun Xu committed Sep 12, 2015
1 parent fd5ca24 commit f7494bb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
1 change: 0 additions & 1 deletion deps/chakrashim/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,6 @@ class V8_EXPORT ObjectTemplate : public Template {

Local<Object> NewInstance();
void SetClassName(Handle<String> name);
void SetSupportsOverrideToString();

void SetAccessor(
Handle<String> name,
Expand Down
32 changes: 1 addition & 31 deletions deps/chakrashim/src/v8objecttemplate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ struct ObjectTemplateData : public TemplateData {
IndexedPropertyEnumeratorCallback indexedPropertyEnumerator;
Persistent<Value> indexedPropertyInterceptorData;
int internalFieldCount;
bool supportsOverrideToString;

ObjectTemplateData()
: namedPropertyGetter(nullptr),
Expand All @@ -54,8 +53,7 @@ struct ObjectTemplateData : public TemplateData {
indexedPropertyQuery(nullptr),
indexedPropertyDeleter(nullptr),
indexedPropertyEnumerator(nullptr),
internalFieldCount(0),
supportsOverrideToString(false) {
internalFieldCount(0) {
HandleScope scope(nullptr);
properties = Object::New();
}
Expand Down Expand Up @@ -879,23 +877,6 @@ Local<Object> ObjectTemplate::NewInstance(Handle<Object> prototype) {
if (error != JsNoError) {
return Local<Object>();
}

// this trick is needed in order to support the equals operator correctly:
if (objectTemplateData->supportsOverrideToString) {
JsValueRef proxyRef = newInstanceRef;

error = JsCreateObject(&newInstanceRef);

if (error != JsNoError) {
return Local<Object>();
}

error = JsSetPrototype(newInstanceRef, proxyRef);

if (error != JsNoError) {
return Local<Object>();
}
}
}

// clone the object template into the new instance
Expand Down Expand Up @@ -1061,15 +1042,4 @@ Handle<String> ObjectTemplate::GetClassName() {
return objectTemplateData->className;
}

void ObjectTemplate::SetSupportsOverrideToString() {
void* externalData;
if (JsGetExternalData(this, &externalData) != JsNoError) {
return;
}

ObjectTemplateData *objectTemplateData =
reinterpret_cast<ObjectTemplateData*>(externalData);
objectTemplateData->supportsOverrideToString = true;
}

} // namespace v8

0 comments on commit f7494bb

Please sign in to comment.