Make FromPropertyDescriptor not trigger inherited setters.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9010 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2011-08-25 09:07:43 +00:00
parent d9eccf2beb
commit 0946ce67d3

View File

@ -354,33 +354,50 @@ function IsInconsistentDescriptor(desc) {
// ES5 8.10.4 // ES5 8.10.4
function FromPropertyDescriptor(desc) { function FromPropertyDescriptor(desc) {
if (IS_UNDEFINED(desc)) return desc; if (IS_UNDEFINED(desc)) return desc;
var obj = new $Object();
if (IsDataDescriptor(desc)) { if (IsDataDescriptor(desc)) {
obj.value = desc.getValue(); return { value: desc.getValue(),
obj.writable = desc.isWritable(); writable: desc.isWritable(),
enumerable: desc.isEnumerable(),
configurable: desc.isConfigurable() };
} }
if (IsAccessorDescriptor(desc)) { // Must be an AccessorDescriptor then. We never return a generic descriptor.
obj.get = desc.getGet(); return { get: desc.getGet(),
obj.set = desc.getSet(); set: desc.getSet(),
} enumerable: desc.isEnumerable(),
obj.enumerable = desc.isEnumerable(); configurable: desc.isConfigurable() };
obj.configurable = desc.isConfigurable();
return obj;
} }
// Harmony Proxies // Harmony Proxies
function FromGenericPropertyDescriptor(desc) { function FromGenericPropertyDescriptor(desc) {
if (IS_UNDEFINED(desc)) return desc; if (IS_UNDEFINED(desc)) return desc;
var obj = new $Object(); var obj = new $Object();
if (desc.hasValue()) obj.value = desc.getValue();
if (desc.hasWritable()) obj.writable = desc.isWritable(); if (desc.hasValue()) {
if (desc.hasGetter()) obj.get = desc.getGet(); %IgnoreAttributesAndSetProperty(obj, "value", desc.getValue(), NONE);
if (desc.hasSetter()) obj.set = desc.getSet(); }
if (desc.hasEnumerable()) obj.enumerable = desc.isEnumerable(); if (desc.hasWritable()) {
if (desc.hasConfigurable()) obj.configurable = desc.isConfigurable(); %IgnoreAttributesAndSetProperty(obj, "writable", desc.isWritable(), NONE);
}
if (desc.hasGetter()) {
%IgnoreAttributesAndSetProperty(obj, "get", desc.getGet(), NONE);
}
if (desc.hasSetter()) {
%IgnoreAttributesAndSetProperty(obj, "set", desc.getSet(), NONE);
}
if (desc.hasEnumerable()) {
%IgnoreAttributesAndSetProperty(obj, "enumerable",
desc.isEnumerable(), NONE);
}
if (desc.hasConfigurable()) {
%IgnoreAttributesAndSetProperty(obj, "configurable",
desc.isConfigurable(), NONE);
}
return obj; return obj;
} }
// ES5 8.10.5. // ES5 8.10.5.
function ToPropertyDescriptor(obj) { function ToPropertyDescriptor(obj) {
if (!IS_SPEC_OBJECT(obj)) { if (!IS_SPEC_OBJECT(obj)) {