Chromium Code Reviews| Index: src/stub-cache.cc |
| diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
| index a6a0b9527215ff2368238137555831d3487bb06a..7d7c4e935c873c33344e61d5e7fb3a2180149253 100644 |
| --- a/src/stub-cache.cc |
| +++ b/src/stub-cache.cc |
| @@ -1242,8 +1242,8 @@ static MaybeObject* ThrowReferenceError(Isolate* isolate, Name* name) { |
| } |
| -static MaybeObject* LoadWithInterceptor(Arguments* args, |
| - PropertyAttributes* attrs) { |
| +static Handle<Object> LoadWithInterceptor(Arguments* args, |
| + PropertyAttributes* attrs) { |
| ASSERT(args->length() == StubCache::kInterceptorArgsLength); |
| Handle<Name> name_handle = |
| args->at<Name>(StubCache::kInterceptorArgsNameIndex); |
| @@ -1257,9 +1257,10 @@ static MaybeObject* LoadWithInterceptor(Arguments* args, |
| Isolate* isolate = receiver_handle->GetIsolate(); |
| // TODO(rossberg): Support symbols in the API. |
| - if (name_handle->IsSymbol()) |
| - return holder_handle->GetPropertyPostInterceptor( |
| - *receiver_handle, *name_handle, attrs); |
| + if (name_handle->IsSymbol()) { |
| + return JSObject::GetPropertyPostInterceptor( |
| + holder_handle, receiver_handle, name_handle, attrs); |
| + } |
| Handle<String> name = Handle<String>::cast(name_handle); |
| Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); |
| @@ -1273,23 +1274,20 @@ static MaybeObject* LoadWithInterceptor(Arguments* args, |
| *holder_handle); |
| { |
| // Use the interceptor getter. |
| - HandleScope scope(isolate); |
| v8::Handle<v8::Value> r = |
| callback_args.Call(getter, v8::Utils::ToLocal(name)); |
| - RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| + RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| if (!r.IsEmpty()) { |
| *attrs = NONE; |
| Handle<Object> result = v8::Utils::OpenHandle(*r); |
| result->VerifyApiCallResultType(); |
| - return *result; |
| + // Rebox handle to escape this scope. |
| + return handle(*result, isolate); |
|
Michael Starzinger
2013/10/02 18:56:24
I would keep the surrounding handle scope in line
|
| } |
| } |
| - MaybeObject* result = holder_handle->GetPropertyPostInterceptor( |
| - *receiver_handle, |
| - *name_handle, |
| - attrs); |
| - RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| + Handle<Object> result = JSObject::GetPropertyPostInterceptor( |
| + holder_handle, receiver_handle, name_handle, attrs); |
| return result; |
| } |
| @@ -1300,25 +1298,25 @@ static MaybeObject* LoadWithInterceptor(Arguments* args, |
| */ |
| RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad) { |
| PropertyAttributes attr = NONE; |
| - Object* result; |
| - { MaybeObject* maybe_result = LoadWithInterceptor(&args, &attr); |
| - if (!maybe_result->ToObject(&result)) return maybe_result; |
| - } |
| + HandleScope scope(isolate); |
| + Handle<Object> result = LoadWithInterceptor(&args, &attr); |
| + RETURN_IF_EMPTY_HANDLE(isolate, result); |
| // If the property is present, return it. |
| - if (attr != ABSENT) return result; |
| + if (attr != ABSENT) return *result; |
| return ThrowReferenceError(isolate, Name::cast(args[0])); |
| } |
| RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) { |
| PropertyAttributes attr; |
| - MaybeObject* result = LoadWithInterceptor(&args, &attr); |
| - RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| + HandleScope scope(isolate); |
| + Handle<Object> result = LoadWithInterceptor(&args, &attr); |
| + RETURN_IF_EMPTY_HANDLE(isolate, result); |
| // This is call IC. In this case, we simply return the undefined result which |
| // will lead to an exception when trying to invoke the result as a |
| // function. |
| - return result; |
| + return *result; |
| } |