*/
class V8_EXPORT Object : public Value {
public:
- bool Set(Handle<Value> key,
- Handle<Value> value,
- PropertyAttribute attribs = None);
+ bool Set(Handle<Value> key, Handle<Value> value);
bool Set(uint32_t index, Handle<Value> value);
}
-// TODO(verwaest): Remove the attribs argument, since it doesn't make sense for
-// existing properties. Use ForceSet instead to define or redefine properties
-// with specific attributes.
-bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
- v8::PropertyAttribute attribs) {
+bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Set()", return false);
ENTER_V8(isolate);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
EXCEPTION_PREAMBLE(isolate);
- has_pending_exception = i::Runtime::SetObjectProperty(
- isolate, self, key_obj, value_obj, i::SLOPPY,
- static_cast<PropertyAttributes>(attribs)).is_null();
+ has_pending_exception =
+ i::Runtime::SetObjectProperty(isolate, self, key_obj, value_obj,
+ i::SLOPPY).is_null();
EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
ASSERT(symbol->IsUndefined());
symbol = i_isolate->factory()->NewSymbol();
i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
- i::JSObject::SetProperty(
- symbols, i_name, symbol, NONE, i::STRICT).Assert();
+ i::JSObject::SetProperty(symbols, i_name, symbol, i::STRICT).Assert();
}
return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
}
ASSERT(symbol->IsUndefined());
symbol = i_isolate->factory()->NewSymbol();
i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
- i::JSObject::SetProperty(
- symbols, i_name, symbol, NONE, i::STRICT).Assert();
+ i::JSObject::SetProperty(symbols, i_name, symbol, i::STRICT).Assert();
}
return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
}
ASSERT(symbol->IsUndefined());
symbol = i_isolate->factory()->NewPrivateSymbol();
i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
- i::JSObject::SetProperty(
- privates, i_name, symbol, NONE, i::STRICT).Assert();
+ i::JSObject::SetProperty(privates, i_name, symbol, i::STRICT).Assert();
}
Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
Handle<JSBuiltinsObject> builtin =
Handle<JSBuiltinsObject>(global->builtins(), isolate_);
RETURN_ON_EXCEPTION_VALUE(
- isolate_,
- JSReceiver::SetProperty(global, key, builtin, NONE, SLOPPY),
- false);
+ isolate_, JSReceiver::SetProperty(global, key, builtin, SLOPPY), false);
// Compile the JavaScript for the debugger in the debugger context.
bool caught_exception =
JSObject::SetProperty(global,
factory->NewStringFromAsciiChecked("next_handle_"),
handle(Smi::FromInt(0), isolate_),
- NONE,
SLOPPY).Check();
JSObject::SetProperty(global,
factory->NewStringFromAsciiChecked("mirror_cache_"),
factory->NewJSArray(0, FAST_ELEMENTS),
- NONE,
SLOPPY).Check();
}
ASSERT(!isolate()->has_pending_exception());
Handle<JSObject> result = NewJSObjectFromMap(map);
Handle<Smi> value(Smi::FromInt(length), isolate());
- JSReceiver::SetProperty(result, length_string(), value, NONE, STRICT)
- .Assert();
+ JSReceiver::SetProperty(result, length_string(), value, STRICT).Assert();
if (!strict_mode_callee) {
- JSReceiver::SetProperty(result, callee_string(), callee, NONE, STRICT)
- .Assert();
+ JSReceiver::SetProperty(result, callee_string(), callee, STRICT).Assert();
}
return result;
}
Vector<const uint16_t>(
reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
pattern.length())).ToHandleChecked(),
- NONE,
SLOPPY).Assert();
// Set time zone and calendar.
resolved,
factory->NewStringFromStaticAscii("calendar"),
factory->NewStringFromAsciiChecked(calendar_name),
- NONE,
SLOPPY).Assert();
const icu::TimeZone& tz = calendar->getTimeZone();
resolved,
factory->NewStringFromStaticAscii("timeZone"),
factory->NewStringFromStaticAscii("UTC"),
- NONE,
SLOPPY).Assert();
} else {
JSObject::SetProperty(
reinterpret_cast<const uint16_t*>(
canonical_time_zone.getBuffer()),
canonical_time_zone.length())).ToHandleChecked(),
- NONE,
SLOPPY).Assert();
}
}
resolved,
factory->NewStringFromStaticAscii("numberingSystem"),
factory->NewStringFromAsciiChecked(ns),
- NONE,
SLOPPY).Assert();
} else {
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("numberingSystem"),
factory->undefined_value(),
- NONE,
SLOPPY).Assert();
}
delete numbering_system;
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromAsciiChecked(result),
- NONE,
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromStaticAscii("und"),
- NONE,
SLOPPY).Assert();
}
}
Vector<const uint16_t>(
reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
pattern.length())).ToHandleChecked(),
- NONE,
SLOPPY).Assert();
// Set resolved currency code in options.currency if not empty.
Vector<const uint16_t>(
reinterpret_cast<const uint16_t*>(currency.getBuffer()),
currency.length())).ToHandleChecked(),
- NONE,
SLOPPY).Assert();
}
resolved,
factory->NewStringFromStaticAscii("numberingSystem"),
factory->NewStringFromAsciiChecked(ns),
- NONE,
SLOPPY).Assert();
} else {
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("numberingSystem"),
factory->undefined_value(),
- NONE,
SLOPPY).Assert();
}
delete numbering_system;
resolved,
factory->NewStringFromStaticAscii("useGrouping"),
factory->ToBoolean(number_format->isGroupingUsed()),
- NONE,
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("minimumIntegerDigits"),
factory->NewNumberFromInt(number_format->getMinimumIntegerDigits()),
- NONE,
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("minimumFractionDigits"),
factory->NewNumberFromInt(number_format->getMinimumFractionDigits()),
- NONE,
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("maximumFractionDigits"),
factory->NewNumberFromInt(number_format->getMaximumFractionDigits()),
- NONE,
SLOPPY).Assert();
Handle<String> key =
resolved,
factory->NewStringFromStaticAscii("minimumSignificantDigits"),
factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()),
- NONE,
SLOPPY).Assert();
}
resolved,
factory->NewStringFromStaticAscii("maximumSignificantDigits"),
factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()),
- NONE,
SLOPPY).Assert();
}
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromAsciiChecked(result),
- NONE,
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromStaticAscii("und"),
- NONE,
SLOPPY).Assert();
}
}
factory->NewStringFromStaticAscii("numeric"),
factory->ToBoolean(
collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON),
- NONE,
SLOPPY).Assert();
switch (collator->getAttribute(UCOL_CASE_FIRST, status)) {
resolved,
factory->NewStringFromStaticAscii("caseFirst"),
factory->NewStringFromStaticAscii("lower"),
- NONE,
SLOPPY).Assert();
break;
case UCOL_UPPER_FIRST:
resolved,
factory->NewStringFromStaticAscii("caseFirst"),
factory->NewStringFromStaticAscii("upper"),
- NONE,
SLOPPY).Assert();
break;
default:
resolved,
factory->NewStringFromStaticAscii("caseFirst"),
factory->NewStringFromStaticAscii("false"),
- NONE,
SLOPPY).Assert();
}
resolved,
factory->NewStringFromStaticAscii("strength"),
factory->NewStringFromStaticAscii("primary"),
- NONE,
SLOPPY).Assert();
// case level: true + s1 -> case, s1 -> base.
resolved,
factory->NewStringFromStaticAscii("sensitivity"),
factory->NewStringFromStaticAscii("case"),
- NONE,
SLOPPY).Assert();
} else {
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("sensitivity"),
factory->NewStringFromStaticAscii("base"),
- NONE,
SLOPPY).Assert();
}
break;
resolved,
factory->NewStringFromStaticAscii("strength"),
factory->NewStringFromStaticAscii("secondary"),
- NONE,
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("sensitivity"),
factory->NewStringFromStaticAscii("accent"),
- NONE,
SLOPPY).Assert();
break;
case UCOL_TERTIARY:
resolved,
factory->NewStringFromStaticAscii("strength"),
factory->NewStringFromStaticAscii("tertiary"),
- NONE,
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("sensitivity"),
factory->NewStringFromStaticAscii("variant"),
- NONE,
SLOPPY).Assert();
break;
case UCOL_QUATERNARY:
resolved,
factory->NewStringFromStaticAscii("strength"),
factory->NewStringFromStaticAscii("quaternary"),
- NONE,
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("sensitivity"),
factory->NewStringFromStaticAscii("variant"),
- NONE,
SLOPPY).Assert();
break;
default:
resolved,
factory->NewStringFromStaticAscii("strength"),
factory->NewStringFromStaticAscii("identical"),
- NONE,
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
factory->NewStringFromStaticAscii("sensitivity"),
factory->NewStringFromStaticAscii("variant"),
- NONE,
SLOPPY).Assert();
}
factory->NewStringFromStaticAscii("ignorePunctuation"),
factory->ToBoolean(collator->getAttribute(
UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED),
- NONE,
SLOPPY).Assert();
// Set the locale
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromAsciiChecked(result),
- NONE,
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromStaticAscii("und"),
- NONE,
SLOPPY).Assert();
}
}
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromAsciiChecked(result),
- NONE,
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
resolved,
factory->NewStringFromStaticAscii("locale"),
factory->NewStringFromStaticAscii("und"),
- NONE,
SLOPPY).Assert();
}
}
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
- isolate(),
- result,
- JSReceiver::SetProperty(receiver, name, value, NONE, strict_mode()),
- Object);
+ isolate(), result,
+ JSReceiver::SetProperty(receiver, name, value, strict_mode()), Object);
return result;
}
if (receiver->map()->is_observed()) {
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
- isolate(),
- result,
- JSReceiver::SetProperty(
- receiver, name, value, NONE, strict_mode(), store_mode),
+ isolate(), result, JSReceiver::SetProperty(receiver, name, value,
+ strict_mode(), store_mode),
Object);
return result;
}
// Set the property.
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
- isolate(),
- result,
- JSReceiver::SetProperty(
- receiver, name, value, NONE, strict_mode(), store_mode),
+ isolate(), result,
+ JSReceiver::SetProperty(receiver, name, value, strict_mode(), store_mode),
Object);
return result;
}
Handle<JSArray> stack_trace = CaptureCurrentStackTrace(
stack_trace_for_uncaught_exceptions_frame_limit_,
stack_trace_for_uncaught_exceptions_options_);
- JSObject::SetProperty(
- error_object, key, stack_trace, NONE, STRICT).Assert();
+ JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert();
}
}
// Capture stack trace for simple stack trace string formatting.
Handle<Name> key = factory()->stack_trace_symbol();
Handle<Object> stack_trace = CaptureSimpleStackTrace(error_object, caller);
- JSObject::SetProperty(error_object, key, stack_trace, NONE, STRICT).Assert();
+ JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert();
}
Handle<String> name = factory()->InternalizeUtf8String(nested[i]);
Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8);
- JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert();
+ JSObject::SetProperty(registry, name, obj, STRICT).Assert();
}
}
return Handle<JSObject>::cast(factory()->symbol_registry());
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()), isolate);
Handle<JSObject> script_obj =
Script::GetWrapper(message_location.script());
- JSReceiver::SetProperty(
- rethrow_exception, start_pos_key, start_pos, NONE, SLOPPY).Assert();
- JSReceiver::SetProperty(
- rethrow_exception, end_pos_key, end_pos, NONE, SLOPPY).Assert();
- JSReceiver::SetProperty(
- rethrow_exception, script_obj_key, script_obj, NONE, SLOPPY).Assert();
+ JSReceiver::SetProperty(rethrow_exception, start_pos_key, start_pos,
+ SLOPPY).Assert();
+ JSReceiver::SetProperty(rethrow_exception, end_pos_key, end_pos, SLOPPY)
+ .Assert();
+ JSReceiver::SetProperty(rethrow_exception, script_obj_key, script_obj,
+ SLOPPY).Assert();
}
}
StrictMode strict_mode) {
Isolate* isolate = proxy->GetIsolate();
Handle<String> name = isolate->factory()->Uint32ToString(index);
- return SetPropertyWithHandler(
- proxy, receiver, name, value, NONE, strict_mode);
+ return SetPropertyWithHandler(proxy, receiver, name, value, strict_mode);
}
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode) {
// Check own property, ignore interceptor.
Isolate* isolate = object->GetIsolate();
if (!result.IsFound()) {
object->map()->LookupTransition(*object, *name, &result);
}
- return SetPropertyForResult(object, &result, name, value, attributes,
- strict_mode, MAY_BE_STORE_FROM_KEYED);
+ return SetPropertyForResult(object, &result, name, value, strict_mode,
+ MAY_BE_STORE_FROM_KEYED);
}
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode) {
// TODO(rossberg): Support symbols in the API.
if (name->IsSymbol()) return value;
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (!result.IsEmpty()) return value;
}
- return SetPropertyPostInterceptor(
- object, name, value, attributes, strict_mode);
+ return SetPropertyPostInterceptor(object, name, value, strict_mode);
}
MaybeHandle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
LookupResult result(object->GetIsolate());
if (!result.IsFound()) {
object->map()->LookupTransition(JSObject::cast(*object), *name, &result);
}
- return SetProperty(object, &result, name, value, attributes, strict_mode,
- store_mode);
+ return SetProperty(object, &result, name, value, strict_mode, store_mode);
}
return JSProxy::SetPropertyViaPrototypesWithHandler(
Handle<JSProxy>::cast(PrototypeIterator::GetCurrent(iter)), object,
isolate->factory()->Uint32ToString(index), // name
- value, NONE, strict_mode, found);
+ value, strict_mode, found);
}
Handle<JSObject> js_proto =
Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter));
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
bool* done) {
Isolate* isolate = object->GetIsolate();
case HANDLER: {
Handle<JSProxy> proxy(result.proxy());
return JSProxy::SetPropertyViaPrototypesWithHandler(
- proxy, object, name, value, attributes, strict_mode, done);
+ proxy, object, name, value, strict_mode, done);
}
case NONEXISTENT:
UNREACHABLE();
LookupResult* result,
Handle<Name> key,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
if (result->IsHandler()) {
- return JSProxy::SetPropertyWithHandler(handle(result->proxy()),
- object, key, value, attributes, strict_mode);
+ return JSProxy::SetPropertyWithHandler(handle(result->proxy()), object, key,
+ value, strict_mode);
} else {
return JSObject::SetPropertyForResult(Handle<JSObject>::cast(object),
- result, key, value, attributes, strict_mode, store_mode);
+ result, key, value, strict_mode,
+ store_mode);
}
}
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode) {
Isolate* isolate = proxy->GetIsolate();
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
bool* done) {
Isolate* isolate = proxy->GetIsolate();
LookupResult* lookup,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
Isolate* isolate = object->GetIsolate();
Handle<Object> proto(object->GetPrototype(), isolate);
if (proto->IsNull()) return value;
ASSERT(proto->IsJSGlobalObject());
- return SetPropertyForResult(Handle<JSObject>::cast(proto),
- lookup, name, value, attributes, strict_mode, store_mode);
+ return SetPropertyForResult(Handle<JSObject>::cast(proto), lookup, name,
+ value, strict_mode, store_mode);
}
ASSERT(!lookup->IsFound() || lookup->holder() == *object ||
Handle<Object> result_object;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result_object,
- SetPropertyViaPrototypes(
- object, name, value, attributes, strict_mode, &done),
+ SetPropertyViaPrototypes(object, name, value, strict_mode, &done),
Object);
if (done) return result_object;
}
if (!lookup->IsFound()) {
// Neither properties nor transitions found.
- return AddPropertyInternal(
- object, name, value, attributes, strict_mode, store_mode);
+ return AddPropertyInternal(object, name, value, NONE, strict_mode,
+ store_mode);
}
if (lookup->IsProperty() && lookup->IsReadOnly()) {
MaybeHandle<Object> maybe_result = value;
if (lookup->IsTransition()) {
maybe_result = SetPropertyUsingTransition(handle(lookup->holder()), lookup,
- name, value, attributes);
+ name, value, NONE);
} else {
switch (lookup->type()) {
case NORMAL:
callback_object, strict_mode);
}
case INTERCEPTOR:
- maybe_result = SetPropertyWithInterceptor(
- handle(lookup->holder()), name, value, attributes, strict_mode);
+ maybe_result = SetPropertyWithInterceptor(handle(lookup->holder()),
+ name, value, strict_mode);
break;
case HANDLER:
case NONEXISTENT:
}
-// Set a real own property, even if it is READ_ONLY. If the property is not
-// present, add it with attributes NONE. This code is an exact clone of
-// SetProperty, with the check for IsReadOnly and the check for a
-// callback setter removed. The two lines looking up the LookupResult
-// result are also added. If one of the functions is changed, the other
-// should be.
+// Reconfigures a property to a data property with attributes, even if it is not
+// reconfigurable.
MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
Handle<JSObject> object,
Handle<Name> name,
JSObject);
if (copying) {
// Creating object copy for literals. No strict mode needed.
- JSObject::SetProperty(
- copy, key_string, result, NONE, SLOPPY).Assert();
+ JSObject::SetProperty(copy, key_string, result, SLOPPY).Assert();
}
}
}
SetProperty(deleted, isolate->factory()->length_string(),
isolate->factory()->NewNumberFromUint(delete_count),
- NONE, SLOPPY).Assert();
+ STRICT).Assert();
}
EnqueueSpliceRecord(array, index, deleted, add_count);
Handle<JSReceiver> object,
Handle<Name> key,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
MUST_USE_RESULT static MaybeHandle<Object> SetElement(
LookupResult* result,
Handle<Name> key,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_from_keyed);
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode);
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult(
LookupResult* result,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
bool* done);
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyPostInterceptor(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode);
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition(
Handle<JSObject> object,
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode,
bool* done);
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
- PropertyAttributes attributes,
StrictMode strict_mode);
MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler(
Handle<JSProxy> proxy,
ASSERT(symbol->IsUndefined());
symbol = isolate->factory()->NewPrivateSymbol();
Handle<Symbol>::cast(symbol)->set_name(*name);
- JSObject::SetProperty(Handle<JSObject>::cast(privates), name, symbol, NONE,
+ JSObject::SetProperty(Handle<JSObject>::cast(privates), name, symbol,
STRICT).Assert();
}
return *symbol;
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
- JSReceiver::SetProperty(global, name, value, NONE, strict_mode));
+ JSReceiver::SetProperty(global, name, value, strict_mode));
return *result;
}
Handle<JSFunction> optimized =
isolate->factory()->NewFunctionWithoutPrototype(key, code);
optimized->shared()->DontAdaptArguments();
- JSReceiver::SetProperty(holder, key, optimized, NONE, STRICT).Assert();
+ JSObject::AddProperty(holder, key, optimized, NONE);
}
// Take special care when attributes are different and there is already
// a property. For simplicity we normalize the property which enables us
// to not worry about changing the instance_descriptor and creating a new
- // map. The current version of SetObjectProperty does not handle attributes
- // correctly in the case where a property is a field and is reset with
- // new attributes.
+ // map.
if (lookup.IsFound() &&
(attr != lookup.GetAttributes() || lookup.IsPropertyCallbacks())) {
// New attributes - normalize to avoid writing to instance descriptor
Handle<Object> object,
Handle<Object> key,
Handle<Object> value,
- StrictMode strict_mode,
- PropertyAttributes attrs) {
+ StrictMode strict_mode) {
if (object->IsUndefined() || object->IsNull()) {
Handle<Object> args[2] = { key, object };
Handle<Object> error =
}
Handle<Name> name = Handle<Name>::cast(name_object);
return JSReceiver::SetProperty(Handle<JSProxy>::cast(object), name, value,
- attrs, strict_mode);
+ strict_mode);
}
// If the object isn't a JavaScript object, we ignore the store.
}
MaybeHandle<Object> result = JSObject::SetElement(
- js_object, index, value, attrs, strict_mode, true, SET_PROPERTY);
+ js_object, index, value, NONE, strict_mode, true, SET_PROPERTY);
JSObject::ValidateElements(js_object);
return result.is_null() ? result : value;
isolate, value, Execution::ToNumber(isolate, value), Object);
}
}
- return JSObject::SetElement(js_object, index, value, attrs,
- strict_mode, true, SET_PROPERTY);
+ return JSObject::SetElement(js_object, index, value, NONE, strict_mode,
+ true, SET_PROPERTY);
} else {
if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
- return JSReceiver::SetProperty(
- js_object, name, value, attrs, strict_mode);
+ return JSReceiver::SetProperty(js_object, name, value, strict_mode);
}
}
Handle<String> name = Handle<String>::cast(converted);
if (name->AsArrayIndex(&index)) {
- return JSObject::SetElement(js_object, index, value, attrs,
- strict_mode, true, SET_PROPERTY);
+ return JSObject::SetElement(js_object, index, value, NONE, strict_mode,
+ true, SET_PROPERTY);
} else {
- return JSReceiver::SetProperty(js_object, name, value, attrs, strict_mode);
+ return JSReceiver::SetProperty(js_object, name, value, strict_mode);
}
}
case MODULE: {
Object* referenced_context = Context::cast(host_context)->get(index);
Handle<JSModule> value(Context::cast(referenced_context)->module());
- JSReceiver::SetProperty(module, name, value, FROZEN, STRICT).Assert();
+ JSObject::SetOwnPropertyIgnoreAttributes(module, name, value, FROZEN)
+ .Assert();
break;
}
case INTERNAL:
}
RETURN_FAILURE_ON_EXCEPTION(
- isolate, JSReceiver::SetProperty(object, name, value, NONE, strict_mode));
+ isolate, JSReceiver::SetProperty(object, name, value, strict_mode));
return *value;
}
Handle<Object> object,
uint32_t index);
- // Do not use SetObjectProperty to configure a property with specific
- // attributes. The argument will be removed once the API is adapted.
MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty(
- Isolate* isolate,
- Handle<Object> object,
- Handle<Object> key,
- Handle<Object> value,
- StrictMode strict_mode,
- PropertyAttributes attributes = NONE);
+ Isolate* isolate, Handle<Object> object, Handle<Object> key,
+ Handle<Object> value, StrictMode strict_mode);
MUST_USE_RESULT static MaybeHandle<Object> DefineObjectProperty(
Handle<JSObject> object,
Handle<Name> name = args.at<Name>(1);
Handle<Object> value = args.at<Object>(2);
ASSERT(receiver->HasNamedInterceptor());
- PropertyAttributes attr = NONE;
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- JSObject::SetPropertyWithInterceptor(
- receiver, name, value, attr, ic.strict_mode()));
+ isolate, result, JSObject::SetPropertyWithInterceptor(
+ receiver, name, value, ic.strict_mode()));
return *result;
}
CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(prop));
// read-only
prop = v8_str("read_only");
- context->Global()->Set(prop, v8_num(7), v8::ReadOnly);
+ context->Global()->ForceSet(prop, v8_num(7), v8::ReadOnly);
CHECK_EQ(7, context->Global()->Get(prop)->Int32Value());
CHECK_EQ(v8::ReadOnly, context->Global()->GetPropertyAttributes(prop));
CompileRun("read_only = 9");
CHECK_EQ(7, context->Global()->Get(prop)->Int32Value());
// dont-delete
prop = v8_str("dont_delete");
- context->Global()->Set(prop, v8_num(13), v8::DontDelete);
+ context->Global()->ForceSet(prop, v8_num(13), v8::DontDelete);
CHECK_EQ(13, context->Global()->Get(prop)->Int32Value());
CompileRun("delete dont_delete");
CHECK_EQ(13, context->Global()->Get(prop)->Int32Value());
CHECK_EQ(v8::DontDelete, context->Global()->GetPropertyAttributes(prop));
// dont-enum
prop = v8_str("dont_enum");
- context->Global()->Set(prop, v8_num(28), v8::DontEnum);
+ context->Global()->ForceSet(prop, v8_num(28), v8::DontEnum);
CHECK_EQ(v8::DontEnum, context->Global()->GetPropertyAttributes(prop));
// absent
prop = v8_str("absent");
v8::Handle<v8::Object> global = context->Global();
v8::Handle<v8::Object> global_proto =
v8::Handle<v8::Object>::Cast(global->Get(v8_str("__proto__")));
- global_proto->Set(v8_str("x"), v8::Integer::New(isolate, 0), v8::ReadOnly);
- global_proto->Set(v8_str("y"), v8::Integer::New(isolate, 0), v8::ReadOnly);
+ global_proto->ForceSet(v8_str("x"), v8::Integer::New(isolate, 0),
+ v8::ReadOnly);
+ global_proto->ForceSet(v8_str("y"), v8::Integer::New(isolate, 0),
+ v8::ReadOnly);
// Check without 'eval' or 'with'.
v8::Handle<v8::Value> res =
CompileRun("function f() { x = 42; return x; }; f()");
// Ordinary properties
v8::Handle<v8::String> simple_property =
v8::String::NewFromUtf8(isolate, "p");
- global->Set(simple_property, v8::Int32::New(isolate, 4), v8::ReadOnly);
+ global->ForceSet(simple_property, v8::Int32::New(isolate, 4), v8::ReadOnly);
CHECK_EQ(4, global->Get(simple_property)->Int32Value());
// This should fail because the property is read-only
global->Set(simple_property, v8::Int32::New(isolate, 5));
// Ordinary properties
v8::Handle<v8::String> simple_property =
v8::String::NewFromUtf8(isolate, "p");
- global->Set(simple_property, v8::Int32::New(isolate, 4), v8::DontDelete);
+ global->ForceSet(simple_property, v8::Int32::New(isolate, 4), v8::DontDelete);
CHECK_EQ(4, global->Get(simple_property)->Int32Value());
// This should fail because the property is dont-delete.
CHECK(!global->Delete(simple_property));
v8::Handle<v8::String> some_property =
v8::String::NewFromUtf8(isolate, "a");
- global->Set(some_property, v8::Integer::New(isolate, 42), v8::DontDelete);
+ global->ForceSet(some_property, v8::Integer::New(isolate, 42),
+ v8::DontDelete);
// Deleting a property should get intercepted and nothing should
// happen.
// cell created using the API.
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- context->Global()->Set(v8_str("cell"), v8_str("value"), v8::DontDelete);
+ context->Global()->ForceSet(v8_str("cell"), v8_str("value"), v8::DontDelete);
ExpectBoolean("delete cell", false);
CompileRun(function_code);
ExpectString("readCell()", "value");
LocalContext context;
Local<v8::Object> obj = templ->NewInstance();
context->Global()->Set(v8_str("obj"), obj);
- obj->Set(v8_str("1"), v8_str("DONT_CHANGE"), v8::ReadOnly);
+ obj->ForceSet(v8_str("1"), v8_str("DONT_CHANGE"), v8::ReadOnly);
obj->Set(v8_str("1"), v8_str("foobar"));
CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("1")));
- obj->Set(v8_num(2), v8_str("DONT_CHANGE"), v8::ReadOnly);
+ obj->ForceSet(v8_num(2), v8_str("DONT_CHANGE"), v8::ReadOnly);
obj->Set(v8_num(2), v8_str("foobar"));
CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_num(2)));
// Test non-smi case.
- obj->Set(v8_str("2000000000"), v8_str("DONT_CHANGE"), v8::ReadOnly);
+ obj->ForceSet(v8_str("2000000000"), v8_str("DONT_CHANGE"), v8::ReadOnly);
obj->Set(v8_str("2000000000"), v8_str("foobar"));
CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("2000000000")));
}
HandleScope inner_scope(isolate);
// Allocate a function and keep it in global object's property.
Handle<JSFunction> function = factory->NewFunction(name);
- JSReceiver::SetProperty(global, name, function, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(global, name, function, SLOPPY).Check();
// Allocate an object. Unrooted after leaving the scope.
Handle<JSObject> obj = factory->NewJSObject(function);
- JSReceiver::SetProperty(
- obj, prop_name, twenty_three, NONE, SLOPPY).Check();
- JSReceiver::SetProperty(
- obj, prop_namex, twenty_four, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, prop_namex, twenty_four, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(obj, prop_name).ToHandleChecked());
HandleScope inner_scope(isolate);
// Allocate another object, make it reachable from global.
Handle<JSObject> obj = factory->NewJSObject(function);
- JSReceiver::SetProperty(global, obj_name, obj, NONE, SLOPPY).Check();
- JSReceiver::SetProperty(
- obj, prop_name, twenty_three, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(global, obj_name, obj, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check();
}
// After gc, it should survive.
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<JSObject> obj = factory->NewJSObject(function);
- JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(obj, prop_name).ToHandleChecked());
// Check that we can add properties to function objects.
- JSReceiver::SetProperty(
- function, prop_name, twenty_four, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(function, prop_name, twenty_four, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(24),
*Object::GetProperty(function, prop_name).ToHandleChecked());
}
CHECK(!JSReceiver::HasOwnProperty(obj, first));
// add first
- JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, first, one, SLOPPY).Check();
CHECK(JSReceiver::HasOwnProperty(obj, first));
// delete first
CHECK(!JSReceiver::HasOwnProperty(obj, first));
// add first and then second
- JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
- JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, first, one, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, second, two, SLOPPY).Check();
CHECK(JSReceiver::HasOwnProperty(obj, first));
CHECK(JSReceiver::HasOwnProperty(obj, second));
CHECK(!JSReceiver::HasOwnProperty(obj, second));
// add first and then second
- JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
- JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, first, one, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, second, two, SLOPPY).Check();
CHECK(JSReceiver::HasOwnProperty(obj, first));
CHECK(JSReceiver::HasOwnProperty(obj, second));
// check string and internalized string match
const char* string1 = "fisk";
Handle<String> s1 = factory->NewStringFromAsciiChecked(string1);
- JSReceiver::SetProperty(obj, s1, one, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, s1, one, SLOPPY).Check();
Handle<String> s1_string = factory->InternalizeUtf8String(string1);
CHECK(JSReceiver::HasOwnProperty(obj, s1_string));
// check internalized string and string match
const char* string2 = "fugl";
Handle<String> s2_string = factory->InternalizeUtf8String(string2);
- JSReceiver::SetProperty(obj, s2_string, one, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, s2_string, one, SLOPPY).Check();
Handle<String> s2 = factory->NewStringFromAsciiChecked(string2);
CHECK(JSReceiver::HasOwnProperty(obj, s2));
}
// Set a propery
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
- JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(obj, prop_name).ToHandleChecked());
Handle<Smi> one(Smi::FromInt(1), isolate);
Handle<Smi> two(Smi::FromInt(2), isolate);
- JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
- JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, first, one, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, second, two, SLOPPY).Check();
JSReceiver::SetElement(obj, 0, first, NONE, SLOPPY).Check();
JSReceiver::SetElement(obj, 1, second, NONE, SLOPPY).Check();
CHECK_EQ(*value1, *value2);
// Flip the values.
- JSReceiver::SetProperty(clone, first, two, NONE, SLOPPY).Check();
- JSReceiver::SetProperty(clone, second, one, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(clone, first, two, SLOPPY).Check();
+ JSReceiver::SetProperty(clone, second, one, SLOPPY).Check();
JSReceiver::SetElement(clone, 0, second, NONE, SLOPPY).Check();
JSReceiver::SetElement(clone, 1, first, NONE, SLOPPY).Check();
i::FLAG_gc_interval = gc_count;
i::FLAG_gc_global = true;
CcTest::heap()->set_allocation_timeout(gc_count);
- JSReceiver::SetProperty(
- object, prop_name, twenty_three, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(object, prop_name, twenty_three, SLOPPY).Check();
}
// allocate a garbage
Handle<String> func_name = factory->InternalizeUtf8String("theFunction");
Handle<JSFunction> function = factory->NewFunction(func_name);
- JSReceiver::SetProperty(global, func_name, function, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(global, func_name, function, SLOPPY).Check();
factory->NewJSObject(function);
}
Handle<JSObject> obj = factory->NewJSObject(function);
Handle<String> obj_name = factory->InternalizeUtf8String("theObject");
- JSReceiver::SetProperty(global, obj_name, obj, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(global, obj_name, obj, SLOPPY).Check();
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
- JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
+ JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check();
}
heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5");
// Setting an indexed element via the property setting method
obj->Set(Number::New(v8_isolate, 1), Number::New(v8_isolate, 5));
// Setting with a non-String, non-uint32 key
- obj->Set(Number::New(v8_isolate, 1.1),
- Number::New(v8_isolate, 6), DontDelete);
+ obj->ForceSet(Number::New(v8_isolate, 1.1), Number::New(v8_isolate, 6),
+ DontDelete);
obj->Delete(String::NewFromUtf8(v8_isolate, "foo"));
obj->Delete(1);
obj->ForceDelete(Number::New(v8_isolate, 1.1));