LookupIterator it(object, Utils::OpenHandle(*name));
CHECK_EQ(LookupIterator::ACCESSOR, it.state());
DCHECK(it.HolderIsReceiverOrHiddenPrototype());
- Object::SetDataProperty(&it, value);
+
+ if (Object::SetDataProperty(&it, value).is_null()) {
+ isolate->OptionalRescheduleException(false);
+ }
}
if (uint32_v->Number() == number_v->Number()) {
maybe = JSArray::SetElementsLength(array_handle, uint32_v);
- maybe.Check();
+ if (maybe.is_null()) isolate->OptionalRescheduleException(false);
return;
}
}
-static Handle<Object> SetFunctionPrototype(Isolate* isolate,
- Handle<JSFunction> function,
- Handle<Object> value) {
+MUST_USE_RESULT static MaybeHandle<Object> SetFunctionPrototype(
+ Isolate* isolate, Handle<JSFunction> function, Handle<Object> value) {
Handle<Object> old_value;
bool is_observed = function->map()->is_observed();
if (is_observed) {
DCHECK(function->prototype() == *value);
if (is_observed && !old_value->SameValue(*value)) {
- JSObject::EnqueueChangeRecord(
+ MaybeHandle<Object> result = JSObject::EnqueueChangeRecord(
function, "update", isolate->factory()->prototype_string(), old_value);
+ if (result.is_null()) return MaybeHandle<Object>();
}
return function;
}
-Handle<Object> Accessors::FunctionSetPrototype(Handle<JSFunction> function,
- Handle<Object> prototype) {
+MaybeHandle<Object> Accessors::FunctionSetPrototype(Handle<JSFunction> function,
+ Handle<Object> prototype) {
DCHECK(function->should_have_prototype());
Isolate* isolate = function->GetIsolate();
return SetFunctionPrototype(isolate, function, prototype);
}
Handle<JSFunction> object =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
- SetFunctionPrototype(isolate, object, value);
+ if (SetFunctionPrototype(isolate, object, value).is_null()) {
+ isolate->OptionalRescheduleException(false);
+ }
}
}
-void JSObject::EnqueueChangeRecord(Handle<JSObject> object,
- const char* type_str,
- Handle<Name> name,
- Handle<Object> old_value) {
+MaybeHandle<Object> JSObject::EnqueueChangeRecord(Handle<JSObject> object,
+ const char* type_str,
+ Handle<Name> name,
+ Handle<Object> old_value) {
DCHECK(!object->IsJSGlobalProxy());
DCHECK(!object->IsJSGlobalObject());
Isolate* isolate = object->GetIsolate();
Handle<Object> args[] = { type, object, name, old_value };
int argc = name.is_null() ? 2 : old_value->IsTheHole() ? 3 : 4;
- Execution::Call(isolate,
- Handle<JSFunction>(isolate->observers_notify_change()),
- isolate->factory()->undefined_value(),
- argc, args).Assert();
+ return Execution::Call(isolate,
+ Handle<JSFunction>(isolate->observers_notify_change()),
+ isolate->factory()->undefined_value(), argc, args);
}
}
-Handle<Object> Object::SetDataProperty(LookupIterator* it,
- Handle<Object> value) {
+MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it,
+ Handle<Object> value) {
// Proxies are handled on the WithHandler path. Other non-JSObjects cannot
// have own properties.
Handle<JSObject> receiver = Handle<JSObject>::cast(it->GetReceiver());
// Send the change record if there are observers.
if (is_observed && !value->SameValue(*maybe_old.ToHandleChecked())) {
- JSObject::EnqueueChangeRecord(receiver, "update", it->name(),
- maybe_old.ToHandleChecked());
+ RETURN_ON_EXCEPTION(it->isolate(), JSObject::EnqueueChangeRecord(
+ receiver, "update", it->name(),
+ maybe_old.ToHandleChecked()),
+ Object);
}
return value;
// Send the change record if there are observers.
if (receiver->map()->is_observed() &&
!it->name().is_identical_to(it->factory()->hidden_string())) {
- JSObject::EnqueueChangeRecord(receiver, "add", it->name(),
- it->factory()->the_hole_value());
+ RETURN_ON_EXCEPTION(it->isolate(), JSObject::EnqueueChangeRecord(
+ receiver, "add", it->name(),
+ it->factory()->the_hole_value()),
+ Object);
}
return value;
!Name::Equals(it.isolate()->factory()->prototype_string(),
name) ||
!Handle<JSFunction>::cast(object)->should_have_prototype()) {
- EnqueueChangeRecord(object, "update", name, old_value);
+ RETURN_ON_EXCEPTION(
+ it.isolate(),
+ EnqueueChangeRecord(object, "update", name, old_value),
+ Object);
}
}
return value;
if (old_value->SameValue(*value)) {
old_value = it.isolate()->factory()->the_hole_value();
}
- EnqueueChangeRecord(object, "reconfigure", name, old_value);
+ RETURN_ON_EXCEPTION(
+ it.isolate(),
+ EnqueueChangeRecord(object, "reconfigure", name, old_value),
+ Object);
}
return value;
}
if (old_value->SameValue(*value)) {
old_value = it.isolate()->factory()->the_hole_value();
}
- EnqueueChangeRecord(object, "reconfigure", name, old_value);
+ RETURN_ON_EXCEPTION(
+ it.isolate(),
+ EnqueueChangeRecord(object, "reconfigure", name, old_value),
+ Object);
}
return value;
if (old_value->SameValue(*value)) {
old_value = it.isolate()->factory()->the_hole_value();
}
- EnqueueChangeRecord(object, "reconfigure", name, old_value);
+ RETURN_ON_EXCEPTION(
+ it.isolate(),
+ EnqueueChangeRecord(object, "reconfigure", name, old_value),
+ Object);
}
return value;
if (!maybe.has_value) return MaybeHandle<Object>();
if (!maybe.value) {
Handle<String> name = factory->Uint32ToString(index);
- EnqueueChangeRecord(object, "delete", name, old_value);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, "delete", name, old_value),
+ Object);
}
}
ReoptimizeIfPrototype(holder);
if (is_observed) {
- EnqueueChangeRecord(object, "delete", name, old_value);
+ RETURN_ON_EXCEPTION(
+ it.isolate(),
+ EnqueueChangeRecord(object, "delete", name, old_value), Object);
}
return result;
DCHECK(!object->map()->is_extensible());
if (object->map()->is_observed()) {
- EnqueueChangeRecord(object, "preventExtensions", Handle<Name>(),
- isolate->factory()->the_hole_value());
+ RETURN_ON_EXCEPTION(
+ isolate,
+ EnqueueChangeRecord(object, "preventExtensions", Handle<Name>(),
+ isolate->factory()->the_hole_value()),
+ Object);
}
return object;
}
if (is_observed) {
const char* type = preexists ? "reconfigure" : "add";
- EnqueueChangeRecord(object, type, name, old_value);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, type, name, old_value), Object);
}
return isolate->factory()->undefined_value();
// For deletions where the property was an accessor, old_values[i]
// will be the hole, which instructs EnqueueChangeRecord to elide
// the "oldValue" property.
- JSObject::EnqueueChangeRecord(
- array, "delete", isolate->factory()->Uint32ToString(indices[i]),
- old_values[i]);
+ RETURN_ON_EXCEPTION(
+ isolate,
+ JSObject::EnqueueChangeRecord(
+ array, "delete", isolate->factory()->Uint32ToString(indices[i]),
+ old_values[i]),
+ Object);
}
- JSObject::EnqueueChangeRecord(
- array, "update", isolate->factory()->length_string(),
- old_length_handle);
+ RETURN_ON_EXCEPTION(isolate,
+ JSObject::EnqueueChangeRecord(
+ array, "update", isolate->factory()->length_string(),
+ old_length_handle),
+ Object);
EndPerformSplice(array);
CHECK(new_length_handle->ToArrayIndex(&new_length));
BeginPerformSplice(Handle<JSArray>::cast(object));
- EnqueueChangeRecord(object, "add", name, old_value);
- EnqueueChangeRecord(object, "update", isolate->factory()->length_string(),
- old_length_handle);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, "add", name, old_value), Object);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, "update",
+ isolate->factory()->length_string(),
+ old_length_handle),
+ Object);
EndPerformSplice(Handle<JSArray>::cast(object));
Handle<JSArray> deleted = isolate->factory()->NewJSArray(0);
EnqueueSpliceRecord(Handle<JSArray>::cast(object), old_length, deleted,
new_length - old_length);
} else {
- EnqueueChangeRecord(object, "add", name, old_value);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, "add", name, old_value), Object);
}
} else if (old_value->IsTheHole()) {
- EnqueueChangeRecord(object, "reconfigure", name, old_value);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, "reconfigure", name, old_value),
+ Object);
} else {
Handle<Object> new_value =
Object::GetElement(isolate, object, index).ToHandleChecked();
bool value_changed = !old_value->SameValue(*new_value);
if (old_attributes != new_attributes) {
if (!value_changed) old_value = isolate->factory()->the_hole_value();
- EnqueueChangeRecord(object, "reconfigure", name, old_value);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, "reconfigure", name, old_value),
+ Object);
} else if (value_changed) {
- EnqueueChangeRecord(object, "update", name, old_value);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueChangeRecord(object, "update", name, old_value),
+ Object);
}
}