Remove PropertyAttributes from SetProperty
BUG= R=ishell@chromium.org Review URL: https://codereview.chromium.org/390833003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22383 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
e3a269b77f
commit
6466ff39fb
@ -2096,9 +2096,7 @@ enum AccessControl {
|
||||
*/
|
||||
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);
|
||||
|
||||
|
21
src/api.cc
21
src/api.cc
@ -3023,11 +3023,7 @@ uint32_t Value::Uint32Value() const {
|
||||
}
|
||||
|
||||
|
||||
// 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);
|
||||
@ -3036,9 +3032,9 @@ bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
|
||||
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;
|
||||
}
|
||||
@ -6173,8 +6169,7 @@ Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) {
|
||||
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));
|
||||
}
|
||||
@ -6194,8 +6189,7 @@ Local<Symbol> v8::Symbol::ForApi(Isolate* isolate, Local<String> name) {
|
||||
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));
|
||||
}
|
||||
@ -6227,8 +6221,7 @@ Local<Private> v8::Private::ForApi(Isolate* isolate, Local<String> name) {
|
||||
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));
|
||||
|
@ -826,9 +826,7 @@ bool Debug::Load() {
|
||||
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 =
|
||||
@ -2454,12 +2452,10 @@ void Debug::ClearMirrorCache() {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -2098,11 +2098,9 @@ Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee,
|
||||
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;
|
||||
}
|
||||
|
40
src/i18n.cc
40
src/i18n.cc
@ -137,7 +137,6 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
|
||||
pattern.length())).ToHandleChecked(),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
|
||||
// Set time zone and calendar.
|
||||
@ -147,7 +146,6 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("calendar"),
|
||||
factory->NewStringFromAsciiChecked(calendar_name),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
|
||||
const icu::TimeZone& tz = calendar->getTimeZone();
|
||||
@ -162,7 +160,6 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("timeZone"),
|
||||
factory->NewStringFromStaticAscii("UTC"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
} else {
|
||||
JSObject::SetProperty(
|
||||
@ -173,7 +170,6 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
reinterpret_cast<const uint16_t*>(
|
||||
canonical_time_zone.getBuffer()),
|
||||
canonical_time_zone.length())).ToHandleChecked(),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
}
|
||||
@ -190,14 +186,12 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
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;
|
||||
@ -212,7 +206,6 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromAsciiChecked(result),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
@ -220,7 +213,6 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromStaticAscii("und"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
}
|
||||
@ -364,7 +356,6 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
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.
|
||||
@ -377,7 +368,6 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(currency.getBuffer()),
|
||||
currency.length())).ToHandleChecked(),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
|
||||
@ -393,14 +383,12 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
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;
|
||||
@ -409,28 +397,24 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
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 =
|
||||
@ -440,7 +424,6 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("minimumSignificantDigits"),
|
||||
factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
|
||||
@ -450,7 +433,6 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("maximumSignificantDigits"),
|
||||
factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
|
||||
@ -464,7 +446,6 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromAsciiChecked(result),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
@ -472,7 +453,6 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromStaticAscii("und"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
}
|
||||
@ -554,7 +534,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
factory->NewStringFromStaticAscii("numeric"),
|
||||
factory->ToBoolean(
|
||||
collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
|
||||
switch (collator->getAttribute(UCOL_CASE_FIRST, status)) {
|
||||
@ -563,7 +542,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("caseFirst"),
|
||||
factory->NewStringFromStaticAscii("lower"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
break;
|
||||
case UCOL_UPPER_FIRST:
|
||||
@ -571,7 +549,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("caseFirst"),
|
||||
factory->NewStringFromStaticAscii("upper"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
break;
|
||||
default:
|
||||
@ -579,7 +556,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("caseFirst"),
|
||||
factory->NewStringFromStaticAscii("false"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
|
||||
@ -589,7 +565,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("strength"),
|
||||
factory->NewStringFromStaticAscii("primary"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
|
||||
// case level: true + s1 -> case, s1 -> base.
|
||||
@ -598,14 +573,12 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("sensitivity"),
|
||||
factory->NewStringFromStaticAscii("case"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
} else {
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("sensitivity"),
|
||||
factory->NewStringFromStaticAscii("base"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
break;
|
||||
@ -615,13 +588,11 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
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:
|
||||
@ -629,13 +600,11 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
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:
|
||||
@ -645,13 +614,11 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("strength"),
|
||||
factory->NewStringFromStaticAscii("quaternary"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("sensitivity"),
|
||||
factory->NewStringFromStaticAscii("variant"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
break;
|
||||
default:
|
||||
@ -659,13 +626,11 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("strength"),
|
||||
factory->NewStringFromStaticAscii("identical"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("sensitivity"),
|
||||
factory->NewStringFromStaticAscii("variant"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
|
||||
@ -674,7 +639,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
factory->NewStringFromStaticAscii("ignorePunctuation"),
|
||||
factory->ToBoolean(collator->getAttribute(
|
||||
UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
|
||||
// Set the locale
|
||||
@ -687,7 +651,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromAsciiChecked(result),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
@ -695,7 +658,6 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromStaticAscii("und"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
}
|
||||
@ -751,7 +713,6 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromAsciiChecked(result),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
@ -759,7 +720,6 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate,
|
||||
resolved,
|
||||
factory->NewStringFromStaticAscii("locale"),
|
||||
factory->NewStringFromStaticAscii("und"),
|
||||
NONE,
|
||||
SLOPPY).Assert();
|
||||
}
|
||||
}
|
||||
|
18
src/ic.cc
18
src/ic.cc
@ -1287,10 +1287,8 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1328,10 +1326,8 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object,
|
||||
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;
|
||||
}
|
||||
@ -1362,10 +1358,8 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object,
|
||||
// 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;
|
||||
}
|
||||
|
@ -424,8 +424,7 @@ void Isolate::CaptureAndSetDetailedStackTrace(Handle<JSObject> error_object) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +434,7 @@ void Isolate::CaptureAndSetSimpleStackTrace(Handle<JSObject> error_object,
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
@ -2207,7 +2206,7 @@ Handle<JSObject> Isolate::GetSymbolRegistry() {
|
||||
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());
|
||||
|
@ -885,12 +885,12 @@ MaybeHandle<JSArray> LiveEdit::GatherCompileInfo(Handle<Script> script,
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1161,8 +1161,7 @@ MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1973,7 +1973,6 @@ MaybeHandle<Object> JSObject::SetPropertyPostInterceptor(
|
||||
Handle<JSObject> object,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode) {
|
||||
// Check own property, ignore interceptor.
|
||||
Isolate* isolate = object->GetIsolate();
|
||||
@ -1982,8 +1981,8 @@ MaybeHandle<Object> JSObject::SetPropertyPostInterceptor(
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -2977,7 +2976,6 @@ MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(
|
||||
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;
|
||||
@ -2999,15 +2997,13 @@ MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(
|
||||
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());
|
||||
@ -3015,8 +3011,7 @@ MaybeHandle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -3033,7 +3028,7 @@ MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
|
||||
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));
|
||||
@ -3061,7 +3056,6 @@ MaybeHandle<Object> JSObject::SetPropertyViaPrototypes(
|
||||
Handle<JSObject> object,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode,
|
||||
bool* done) {
|
||||
Isolate* isolate = object->GetIsolate();
|
||||
@ -3098,7 +3092,7 @@ MaybeHandle<Object> JSObject::SetPropertyViaPrototypes(
|
||||
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();
|
||||
@ -3530,15 +3524,15 @@ MaybeHandle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3569,7 +3563,6 @@ MaybeHandle<Object> JSProxy::SetPropertyWithHandler(
|
||||
Handle<JSReceiver> receiver,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode) {
|
||||
Isolate* isolate = proxy->GetIsolate();
|
||||
|
||||
@ -3595,7 +3588,6 @@ MaybeHandle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
|
||||
Handle<JSReceiver> receiver,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode,
|
||||
bool* done) {
|
||||
Isolate* isolate = proxy->GetIsolate();
|
||||
@ -4059,7 +4051,6 @@ MaybeHandle<Object> JSObject::SetPropertyForResult(
|
||||
LookupResult* lookup,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode,
|
||||
StoreFromKeyed store_mode) {
|
||||
Isolate* isolate = object->GetIsolate();
|
||||
@ -4088,8 +4079,8 @@ MaybeHandle<Object> JSObject::SetPropertyForResult(
|
||||
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 ||
|
||||
@ -4100,16 +4091,15 @@ MaybeHandle<Object> JSObject::SetPropertyForResult(
|
||||
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()) {
|
||||
@ -4135,7 +4125,7 @@ MaybeHandle<Object> JSObject::SetPropertyForResult(
|
||||
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:
|
||||
@ -4156,8 +4146,8 @@ MaybeHandle<Object> JSObject::SetPropertyForResult(
|
||||
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:
|
||||
@ -4208,12 +4198,8 @@ void JSObject::AddProperty(
|
||||
}
|
||||
|
||||
|
||||
// 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,
|
||||
@ -5954,8 +5940,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11807,7 +11792,7 @@ MaybeHandle<Object> JSArray::SetElementsLength(
|
||||
|
||||
SetProperty(deleted, isolate->factory()->length_string(),
|
||||
isolate->factory()->NewNumberFromUint(delete_count),
|
||||
NONE, SLOPPY).Assert();
|
||||
STRICT).Assert();
|
||||
}
|
||||
|
||||
EnqueueSpliceRecord(array, index, deleted, add_count);
|
||||
|
@ -1934,7 +1934,6 @@ class JSReceiver: public HeapObject {
|
||||
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(
|
||||
@ -2020,7 +2019,6 @@ class JSReceiver: public HeapObject {
|
||||
LookupResult* result,
|
||||
Handle<Name> key,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode,
|
||||
StoreFromKeyed store_from_keyed);
|
||||
|
||||
@ -2139,7 +2137,6 @@ class JSObject: public JSReceiver {
|
||||
Handle<JSObject> object,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode);
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult(
|
||||
@ -2147,7 +2144,6 @@ class JSObject: public JSReceiver {
|
||||
LookupResult* result,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode,
|
||||
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
|
||||
|
||||
@ -2744,14 +2740,12 @@ class JSObject: public JSReceiver {
|
||||
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,
|
||||
@ -9959,7 +9953,6 @@ class JSProxy: public JSReceiver {
|
||||
Handle<JSReceiver> receiver,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
StrictMode strict_mode,
|
||||
bool* done);
|
||||
|
||||
@ -10015,7 +10008,6 @@ class JSProxy: public JSReceiver {
|
||||
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,
|
||||
|
@ -641,7 +641,7 @@ RUNTIME_FUNCTION(Runtime_CreateGlobalPrivateSymbol) {
|
||||
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;
|
||||
@ -2228,7 +2228,7 @@ RUNTIME_FUNCTION(Runtime_InitializeVarGlobal) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2550,7 +2550,7 @@ static void InstallBuiltin(Isolate* isolate,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -4945,9 +4945,7 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) {
|
||||
// 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
|
||||
@ -5001,8 +4999,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
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 =
|
||||
@ -5021,7 +5018,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
}
|
||||
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.
|
||||
@ -5053,7 +5050,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -5068,12 +5065,11 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5084,10 +5080,10 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8961,7 +8957,8 @@ RUNTIME_FUNCTION(Runtime_DeclareModules) {
|
||||
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:
|
||||
@ -9255,7 +9252,7 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot) {
|
||||
}
|
||||
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, JSReceiver::SetProperty(object, name, value, NONE, strict_mode));
|
||||
isolate, JSReceiver::SetProperty(object, name, value, strict_mode));
|
||||
|
||||
return *value;
|
||||
}
|
||||
|
@ -802,15 +802,9 @@ class Runtime : public AllStatic {
|
||||
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,
|
||||
|
@ -579,12 +579,10 @@ RUNTIME_FUNCTION(StoreInterceptorProperty) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -4373,7 +4373,7 @@ THREADED_TEST(PropertyAttributes) {
|
||||
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");
|
||||
@ -4382,14 +4382,14 @@ THREADED_TEST(PropertyAttributes) {
|
||||
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");
|
||||
@ -15147,8 +15147,10 @@ TEST(ReadOnlyPropertyInGlobalProto) {
|
||||
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()");
|
||||
@ -15206,7 +15208,7 @@ TEST(ForceSet) {
|
||||
// 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));
|
||||
@ -15294,7 +15296,7 @@ THREADED_TEST(ForceDelete) {
|
||||
// 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));
|
||||
@ -15331,7 +15333,8 @@ THREADED_TEST(ForceDeleteWithInterceptor) {
|
||||
|
||||
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.
|
||||
@ -19584,7 +19587,7 @@ TEST(DontDeleteCellLoadICAPI) {
|
||||
// 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");
|
||||
@ -20181,15 +20184,15 @@ THREADED_TEST(ReadOnlyIndexedProperties) {
|
||||
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")));
|
||||
}
|
||||
|
@ -262,13 +262,11 @@ TEST(GarbageCollection) {
|
||||
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());
|
||||
@ -290,9 +288,8 @@ TEST(GarbageCollection) {
|
||||
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.
|
||||
@ -627,12 +624,11 @@ TEST(FunctionAllocation) {
|
||||
|
||||
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());
|
||||
}
|
||||
@ -659,7 +655,7 @@ TEST(ObjectProperties) {
|
||||
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
|
||||
@ -667,8 +663,8 @@ TEST(ObjectProperties) {
|
||||
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));
|
||||
|
||||
@ -680,8 +676,8 @@ TEST(ObjectProperties) {
|
||||
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));
|
||||
|
||||
@ -695,14 +691,14 @@ TEST(ObjectProperties) {
|
||||
// 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));
|
||||
}
|
||||
@ -723,7 +719,7 @@ TEST(JSObjectMaps) {
|
||||
|
||||
// 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());
|
||||
|
||||
@ -801,8 +797,8 @@ TEST(JSObjectCopy) {
|
||||
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();
|
||||
@ -827,8 +823,8 @@ TEST(JSObjectCopy) {
|
||||
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();
|
||||
@ -2764,8 +2760,7 @@ static void AddPropertyTo(
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,7 +158,7 @@ TEST(MarkCompactCollector) {
|
||||
// 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);
|
||||
}
|
||||
@ -175,10 +175,10 @@ TEST(MarkCompactCollector) {
|
||||
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");
|
||||
|
@ -275,8 +275,8 @@ TEST(APITestBasicMutation) {
|
||||
// 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));
|
||||
|
Loading…
Reference in New Issue
Block a user