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

Unified Diff: src/runtime/runtime-function.cc

Issue 2006673002: Reduce boilerplace for common pattern to return MaybeHandle. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and fix Created 4 years, 7 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 | « src/runtime/runtime-forin.cc ('k') | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-function.cc
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc
index 68a44d816df4330e7a75d00a005a2d37d054eb07..6e6aaf086e5468cb87d3ca004acc38c5c3589c52 100644
--- a/src/runtime/runtime-function.cc
+++ b/src/runtime/runtime-function.cc
@@ -21,15 +21,13 @@ RUNTIME_FUNCTION(Runtime_FunctionGetName) {
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
- Handle<Object> result;
if (function->IsJSBoundFunction()) {
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, JSBoundFunction::GetName(
- isolate, Handle<JSBoundFunction>::cast(function)));
+ RETURN_RESULT_OR_FAILURE(
+ isolate, JSBoundFunction::GetName(
+ isolate, Handle<JSBoundFunction>::cast(function)));
} else {
- result = JSFunction::GetName(isolate, Handle<JSFunction>::cast(function));
+ return *JSFunction::GetName(isolate, Handle<JSFunction>::cast(function));
}
- return *result;
}
@@ -276,11 +274,8 @@ RUNTIME_FUNCTION(Runtime_Call) {
for (int i = 0; i < argc; ++i) {
argv[i] = args.at<Object>(2 + i);
}
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- Execution::Call(isolate, target, receiver, argc, argv.start()));
- return *result;
+ RETURN_RESULT_OR_FAILURE(
+ isolate, Execution::Call(isolate, target, receiver, argc, argv.start()));
}
« no previous file with comments | « src/runtime/runtime-forin.cc ('k') | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698