Chromium Code Reviews| Index: src/handles.cc |
| diff --git a/src/handles.cc b/src/handles.cc |
| index f14002e690c94500f30a41700b425bb05032b618..4c7258e7a7cd63482c4f9a95898bc269ae7973b2 100644 |
| --- a/src/handles.cc |
| +++ b/src/handles.cc |
| @@ -134,8 +134,8 @@ Handle<JSGlobalProxy> ReinitializeJSGlobalProxy( |
| } |
| -Handle<Object> GetProperty(Handle<JSReceiver> obj, |
| - const char* name) { |
| +MaybeHandle<Object> GetProperty(Handle<JSReceiver> obj, |
| + const char* name) { |
| Isolate* isolate = obj->GetIsolate(); |
| Handle<String> str = isolate->factory()->InternalizeUtf8String(name); |
| ASSERT(!str.is_null()); |
| @@ -426,9 +426,8 @@ static bool ContainsOnlyValidKeys(Handle<FixedArray> array) { |
| } |
| -Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, |
| - KeyCollectionType type, |
| - bool* threw) { |
| +MaybeHandle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, |
| + KeyCollectionType type) { |
| USE(ContainsOnlyValidKeys); |
| Isolate* isolate = object->GetIsolate(); |
| Handle<FixedArray> content = isolate->factory()->empty_fixed_array(); |
| @@ -446,15 +445,18 @@ Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, |
| if (p->IsJSProxy()) { |
| Handle<JSProxy> proxy(JSProxy::cast(*p), isolate); |
| Handle<Object> args[] = { proxy }; |
| + bool has_pending_exception; |
| Handle<Object> names = Execution::Call(isolate, |
| isolate->proxy_enumerate(), |
| object, |
| ARRAY_SIZE(args), |
| args, |
| - threw); |
| - if (*threw) return content; |
| - content = FixedArray::AddKeysFromJSArray(content, |
| - Handle<JSArray>::cast(names)); |
| + &has_pending_exception); |
| + if (has_pending_exception) return MaybeHandle<FixedArray>(); |
| + ASSIGN_RETURN_ON_EXCEPTION( |
| + isolate, content, |
| + FixedArray::AddKeysFromJSArray(content, Handle<JSArray>::cast(names)), |
| + FixedArray); |
| break; |
| } |
| @@ -466,10 +468,7 @@ Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, |
| isolate->factory()->undefined_value(), |
| v8::ACCESS_KEYS)) { |
| isolate->ReportFailedAccessCheckWrapper(current, v8::ACCESS_KEYS); |
| - if (isolate->has_scheduled_exception()) { |
| - isolate->PromoteScheduledException(); |
| - *threw = true; |
| - } |
| + RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, FixedArray); |
|
Igor Sheludko
2014/04/09 16:12:09
Looks like we do exactly the same here as in the m
|
| break; |
| } |
| @@ -485,8 +484,11 @@ Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, |
| v8::Handle<v8::Array> result = |
| GetKeysForIndexedInterceptor(object, current); |
| if (!result.IsEmpty()) |
|
Yang
2014/04/10 07:05:22
please add curly braces.
Igor Sheludko
2014/04/10 08:27:54
Done.
|
| - content = FixedArray::AddKeysFromJSArray( |
| - content, v8::Utils::OpenHandle(*result)); |
| + ASSIGN_RETURN_ON_EXCEPTION( |
| + isolate, content, |
| + FixedArray::AddKeysFromJSArray( |
| + content, v8::Utils::OpenHandle(*result)), |
| + FixedArray); |
| ASSERT(ContainsOnlyValidKeys(content)); |
| } |
| @@ -516,8 +518,11 @@ Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, |
| v8::Handle<v8::Array> result = |
| GetKeysForNamedInterceptor(object, current); |
| if (!result.IsEmpty()) |
|
Yang
2014/04/10 07:05:22
add curly braces please.
Igor Sheludko
2014/04/10 08:27:54
Done.
|
| - content = FixedArray::AddKeysFromJSArray( |
| - content, v8::Utils::OpenHandle(*result)); |
| + ASSIGN_RETURN_ON_EXCEPTION( |
| + isolate, content, |
| + FixedArray::AddKeysFromJSArray( |
| + content, v8::Utils::OpenHandle(*result)), |
| + FixedArray); |
| ASSERT(ContainsOnlyValidKeys(content)); |
| } |
| @@ -530,11 +535,14 @@ Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, |
| } |
| -Handle<JSArray> GetKeysFor(Handle<JSReceiver> object, bool* threw) { |
| +MaybeHandle<JSArray> GetKeysFor(Handle<JSReceiver> object) { |
| Isolate* isolate = object->GetIsolate(); |
| isolate->counters()->for_in()->Increment(); |
| - Handle<FixedArray> elements = |
| - GetKeysInFixedArrayFor(object, INCLUDE_PROTOS, threw); |
| + Handle<FixedArray> elements; |
| + ASSIGN_RETURN_ON_EXCEPTION( |
| + isolate, elements, |
| + GetKeysInFixedArrayFor(object, INCLUDE_PROTOS), |
| + JSArray); |
| return isolate->factory()->NewJSArrayWithElements(elements); |
| } |