Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: src/objects.cc

Issue 651323003: Handle exceptions thrown by Array.observe machinery (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-417709b.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 4f23ea58b9f1e0ef70d7f6b38fcb5ba2e6be085a..2ab215c635a8f3aa2867c95f929792e27fb62b36 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11147,10 +11147,9 @@ static bool GetOldValue(Isolate* isolate,
return true;
}
-static void EnqueueSpliceRecord(Handle<JSArray> object,
- uint32_t index,
- Handle<JSArray> deleted,
- uint32_t add_count) {
+MUST_USE_RESULT static MaybeHandle<Object> EnqueueSpliceRecord(
+ Handle<JSArray> object, uint32_t index, Handle<JSArray> deleted,
+ uint32_t add_count) {
Isolate* isolate = object->GetIsolate();
HandleScope scope(isolate);
Handle<Object> index_object = isolate->factory()->NewNumberFromUint(index);
@@ -11160,37 +11159,33 @@ static void EnqueueSpliceRecord(Handle<JSArray> object,
Handle<Object> args[] =
{ object, index_object, deleted, add_count_object };
- Execution::Call(isolate,
- Handle<JSFunction>(isolate->observers_enqueue_splice()),
- isolate->factory()->undefined_value(),
- arraysize(args),
- args).Assert();
+ return Execution::Call(
+ isolate, Handle<JSFunction>(isolate->observers_enqueue_splice()),
+ isolate->factory()->undefined_value(), arraysize(args), args);
}
-static void BeginPerformSplice(Handle<JSArray> object) {
+MUST_USE_RESULT static MaybeHandle<Object> BeginPerformSplice(
+ Handle<JSArray> object) {
Isolate* isolate = object->GetIsolate();
HandleScope scope(isolate);
Handle<Object> args[] = { object };
- Execution::Call(isolate,
- Handle<JSFunction>(isolate->observers_begin_perform_splice()),
- isolate->factory()->undefined_value(),
- arraysize(args),
- args).Assert();
+ return Execution::Call(
+ isolate, Handle<JSFunction>(isolate->observers_begin_perform_splice()),
+ isolate->factory()->undefined_value(), arraysize(args), args);
}
-static void EndPerformSplice(Handle<JSArray> object) {
+MUST_USE_RESULT static MaybeHandle<Object> EndPerformSplice(
+ Handle<JSArray> object) {
Isolate* isolate = object->GetIsolate();
HandleScope scope(isolate);
Handle<Object> args[] = { object };
- Execution::Call(isolate,
- Handle<JSFunction>(isolate->observers_end_perform_splice()),
- isolate->factory()->undefined_value(),
- arraysize(args),
- args).Assert();
+ return Execution::Call(
+ isolate, Handle<JSFunction>(isolate->observers_end_perform_splice()),
+ isolate->factory()->undefined_value(), arraysize(args), args);
}
@@ -11254,7 +11249,7 @@ MaybeHandle<Object> JSArray::SetElementsLength(
CHECK(array->length()->ToArrayIndex(&new_length));
if (old_length == new_length) return hresult;
- BeginPerformSplice(array);
+ RETURN_ON_EXCEPTION(isolate, BeginPerformSplice(array), Object);
for (int i = 0; i < indices.length(); ++i) {
// For deletions where the property was an accessor, old_values[i]
@@ -11273,7 +11268,7 @@ MaybeHandle<Object> JSArray::SetElementsLength(
old_length_handle),
Object);
- EndPerformSplice(array);
+ RETURN_ON_EXCEPTION(isolate, EndPerformSplice(array), Object);
uint32_t index = Min(old_length, new_length);
uint32_t add_count = new_length > old_length ? new_length - old_length : 0;
@@ -11293,7 +11288,8 @@ MaybeHandle<Object> JSArray::SetElementsLength(
STRICT).Assert();
}
- EnqueueSpliceRecord(array, index, deleted, add_count);
+ RETURN_ON_EXCEPTION(
+ isolate, EnqueueSpliceRecord(array, index, deleted, add_count), Object);
return hresult;
}
@@ -12478,7 +12474,8 @@ MaybeHandle<Object> JSObject::SetElement(Handle<JSObject> object,
CHECK(old_length_handle->ToArrayIndex(&old_length));
CHECK(new_length_handle->ToArrayIndex(&new_length));
- BeginPerformSplice(Handle<JSArray>::cast(object));
+ RETURN_ON_EXCEPTION(
+ isolate, BeginPerformSplice(Handle<JSArray>::cast(object)), Object);
RETURN_ON_EXCEPTION(
isolate, EnqueueChangeRecord(object, "add", name, old_value), Object);
RETURN_ON_EXCEPTION(
@@ -12486,10 +12483,14 @@ MaybeHandle<Object> JSObject::SetElement(Handle<JSObject> object,
isolate->factory()->length_string(),
old_length_handle),
Object);
- EndPerformSplice(Handle<JSArray>::cast(object));
+ RETURN_ON_EXCEPTION(
+ isolate, EndPerformSplice(Handle<JSArray>::cast(object)), Object);
Handle<JSArray> deleted = isolate->factory()->NewJSArray(0);
- EnqueueSpliceRecord(Handle<JSArray>::cast(object), old_length, deleted,
- new_length - old_length);
+ RETURN_ON_EXCEPTION(
+ isolate,
+ EnqueueSpliceRecord(Handle<JSArray>::cast(object), old_length,
+ deleted, new_length - old_length),
+ Object);
} else {
RETURN_ON_EXCEPTION(
isolate, EnqueueChangeRecord(object, "add", name, old_value), Object);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-417709b.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698