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

Unified Diff: src/runtime/runtime-classes.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-array.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-classes.cc
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index a784d6d773040227a948dee8cda957fa968d52a8..46e2fa4ce24aa8245474368055bb58a5f39380a3 100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -186,11 +186,9 @@ RUNTIME_FUNCTION(Runtime_DefineClass) {
CONVERT_SMI_ARG_CHECKED(start_position, 2);
CONVERT_SMI_ARG_CHECKED(end_position, 3);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, DefineClass(isolate, super_class, constructor,
- start_position, end_position));
- return *result;
+ RETURN_RESULT_OR_FAILURE(
+ isolate, DefineClass(isolate, super_class, constructor, start_position,
+ end_position));
}
@@ -247,10 +245,8 @@ RUNTIME_FUNCTION(Runtime_LoadFromSuper) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, LoadFromSuper(isolate, receiver, home_object, name));
- return *result;
+ RETURN_RESULT_OR_FAILURE(isolate,
+ LoadFromSuper(isolate, receiver, home_object, name));
}
@@ -262,13 +258,10 @@ RUNTIME_FUNCTION(Runtime_LoadKeyedFromSuper) {
CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
uint32_t index = 0;
- Handle<Object> result;
if (key->ToArrayIndex(&index)) {
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- LoadElementFromSuper(isolate, receiver, home_object, index));
- return *result;
+ RETURN_RESULT_OR_FAILURE(
+ isolate, LoadElementFromSuper(isolate, receiver, home_object, index));
}
Handle<Name> name;
@@ -276,14 +269,11 @@ RUNTIME_FUNCTION(Runtime_LoadKeyedFromSuper) {
Object::ToName(isolate, key));
// TODO(verwaest): Unify using LookupIterator.
if (name->AsArrayIndex(&index)) {
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- LoadElementFromSuper(isolate, receiver, home_object, index));
- return *result;
+ RETURN_RESULT_OR_FAILURE(
+ isolate, LoadElementFromSuper(isolate, receiver, home_object, index));
}
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, LoadFromSuper(isolate, receiver, home_object, name));
- return *result;
+ RETURN_RESULT_OR_FAILURE(isolate,
+ LoadFromSuper(isolate, receiver, home_object, name));
}
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698