Fix bug 344: always keep attributes of existing properties.

Review URL: http://codereview.chromium.org/113197

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1931 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
whesse@chromium.org 2009-05-13 10:46:28 +00:00
parent 60c42717f3
commit 1ae8a7da3d
2 changed files with 6 additions and 2 deletions

View File

@ -1736,8 +1736,10 @@ Object* JSObject::SetProperty(LookupResult* result,
}
return ConvertDescriptorToField(name, value, attributes);
case CONSTANT_FUNCTION:
if (value == result->GetConstantFunction()) return value;
// Only replace the function if necessary.
if (value == result->GetConstantFunction()) return value;
// Preserve the attributes of this existing property.
attributes = result->GetAttributes();
return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
case CALLBACKS:
return SetPropertyWithCallback(result->GetCallbackObject(),
@ -1817,8 +1819,10 @@ Object* JSObject::IgnoreAttributesAndSetLocalProperty(
}
return ConvertDescriptorToField(name, value, attributes);
case CONSTANT_FUNCTION:
if (value == result->GetConstantFunction()) return value;
// Only replace the function if necessary.
if (value == result->GetConstantFunction()) return value;
// Preserve the attributes of this existing property.
attributes = result->GetAttributes();
return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
case CALLBACKS:
case INTERCEPTOR: