Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 96c2c9a0ec126e9f54ed28f4185a2203289eaa3a..771b3fb89efec39c38adb35b14527e6d5b54bc83 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1808,10 +1808,10 @@ Context* JSObject::GetCreationContext() { |
} |
-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(); |
@@ -1820,10 +1820,9 @@ void JSObject::EnqueueChangeRecord(Handle<JSObject> object, |
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); |
} |
@@ -2930,8 +2929,8 @@ MaybeHandle<Object> Object::WriteToReadOnlyProperty(LookupIterator* it, |
} |
-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()); |
@@ -2957,8 +2956,10 @@ Handle<Object> Object::SetDataProperty(LookupIterator* it, |
// 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; |
@@ -3009,8 +3010,10 @@ MaybeHandle<Object> Object::AddDataProperty(LookupIterator* it, |
// 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; |
@@ -3859,7 +3862,10 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
!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; |
@@ -3878,7 +3884,10 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
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; |
} |
@@ -3891,7 +3900,10 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
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; |
@@ -3915,7 +3927,10 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
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; |
@@ -4888,7 +4903,9 @@ MaybeHandle<Object> JSObject::DeleteElement(Handle<JSObject> object, |
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); |
} |
} |
@@ -4974,7 +4991,9 @@ MaybeHandle<Object> JSObject::DeleteProperty(Handle<JSObject> 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; |
@@ -5191,8 +5210,11 @@ MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) { |
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; |
} |
@@ -6165,7 +6187,8 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> 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(); |
@@ -11234,13 +11257,18 @@ MaybeHandle<Object> JSArray::SetElementsLength( |
// 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); |
@@ -12448,27 +12476,38 @@ MaybeHandle<Object> JSObject::SetElement(Handle<JSObject> object, |
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); |
} |
} |