info->set_property_attributes(attributes);
info->set_all_can_read(false);
info->set_all_can_write(false);
+ info->set_is_special_data_property(true);
info->set_name(*name);
Handle<Object> get = v8::FromCData(isolate, getter);
Handle<Object> set = v8::FromCData(isolate, setter);
}
-bool SetPropertyOnInstanceIfInherited(
- Isolate* isolate, const v8::PropertyCallbackInfo<void>& info,
- v8::Local<v8::Name> name, Handle<Object> value) {
- Handle<Object> holder = Utils::OpenHandle(*info.Holder());
- Handle<Object> receiver = Utils::OpenHandle(*info.This());
- if (*holder == *receiver) return false;
- if (receiver->IsJSObject()) {
- Handle<JSObject> object = Handle<JSObject>::cast(receiver);
- // This behaves sloppy since we lost the actual strict-mode.
- // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data
- // properties.
- if (object->IsJSGlobalProxy()) {
- PrototypeIterator iter(isolate, object);
- if (iter.IsAtEnd()) return true;
- DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
- object = Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter));
- }
- if (!object->map()->is_extensible()) return true;
- JSObject::SetOwnPropertyIgnoreAttributes(object, Utils::OpenHandle(*name),
- value, NONE).Check();
- }
- return true;
-}
-
-
//
// Accessors::ArgumentsIterator
//
Handle<JSObject> object = Utils::OpenHandle(*info.This());
Handle<Object> value = Utils::OpenHandle(*val);
- if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) return;
-
LookupIterator it(object, Utils::OpenHandle(*name));
CHECK_EQ(LookupIterator::ACCESSOR, it.state());
DCHECK(it.HolderIsReceiverOrHiddenPrototype());
HandleScope scope(isolate);
Handle<JSObject> object = Utils::OpenHandle(*info.This());
Handle<Object> value = Utils::OpenHandle(*val);
- if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) {
- return;
- }
value = FlattenNumber(isolate, value);
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
HandleScope scope(isolate);
Handle<Object> value = Utils::OpenHandle(*val);
- if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) {
- return;
- }
Handle<JSFunction> object =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
if (SetFunctionPrototype(isolate, object, value).is_null()) {
HandleScope scope(isolate);
Handle<Object> value = Utils::OpenHandle(*val);
- if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) return;
-
Handle<JSFunction> object =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
if (SetFunctionLength(isolate, object, value).is_null()) {
HandleScope scope(isolate);
Handle<Object> value = Utils::OpenHandle(*val);
- if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) return;
-
Handle<JSFunction> object =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
if (SetFunctionName(isolate, object, value).is_null()) {
}
break;
- case LookupIterator::ACCESSOR:
+ case LookupIterator::ACCESSOR: {
if (it->property_details().IsReadOnly()) {
return WriteToReadOnlyProperty(it, value, language_mode);
}
+ Handle<Object> accessors = it->GetAccessors();
+ if (accessors->IsAccessorInfo() &&
+ !it->HolderIsReceiverOrHiddenPrototype() &&
+ AccessorInfo::cast(*accessors)->is_special_data_property()) {
+ done = true;
+ break;
+ }
return SetPropertyWithAccessor(it->GetReceiver(), it->name(), value,
- it->GetHolder<JSObject>(),
- it->GetAccessors(), language_mode);
-
+ it->GetHolder<JSObject>(), accessors,
+ language_mode);
+ }
case LookupIterator::INTEGER_INDEXED_EXOTIC:
done = true;
break;
inline bool all_can_write();
inline void set_all_can_write(bool value);
+ inline bool is_special_data_property();
+ inline void set_is_special_data_property(bool value);
+
inline PropertyAttributes property_attributes();
inline void set_property_attributes(PropertyAttributes attributes);
// Bit positions in flag.
static const int kAllCanReadBit = 0;
static const int kAllCanWriteBit = 1;
- class AttributesField: public BitField<PropertyAttributes, 2, 3> {};
+ static const int kSpecialDataProperty = 2;
+ class AttributesField : public BitField<PropertyAttributes, 3, 3> {};
DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo);
};
assertSame([][Symbol.iterator], o[Symbol.iterator]);
assertFalse(o.hasOwnProperty(Symbol.iterator));
assertSame([][Symbol.iterator], o[Symbol.iterator]);
- // This should throw, but currently it doesn't, because
- // ExecutableAccessorInfo callbacks don't see the current strict mode.
- // See note in accessors.cc:SetPropertyOnInstanceIfInherited.
- o[Symbol.iterator] = 10;
+ assertThrows(function () { o[Symbol.iterator] = 10 });
assertFalse(o.hasOwnProperty(Symbol.iterator));
assertEquals([][Symbol.iterator], o[Symbol.iterator]);
assertSame([][Symbol.iterator], arguments[Symbol.iterator]);