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

Unified Diff: src/runtime/runtime-literals.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-json.cc ('k') | src/runtime/runtime-liveedit.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-literals.cc
diff --git a/src/runtime/runtime-literals.cc b/src/runtime/runtime-literals.cc
index 34feeba2b40082addc7f96cd217f341c23fa924e..5cb97c6ce673009b02e1763a1f422a3775dbacc8 100644
--- a/src/runtime/runtime-literals.cc
+++ b/src/runtime/runtime-literals.cc
@@ -263,9 +263,7 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
MaybeHandle<Object> maybe_copy =
JSObject::DeepCopy(boilerplate, &usage_context);
usage_context.ExitScope(site, boilerplate);
- Handle<Object> copy;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy);
- return *copy;
+ RETURN_RESULT_OR_FAILURE(isolate, maybe_copy);
}
MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite(
@@ -333,12 +331,10 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) {
CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
CONVERT_SMI_ARG_CHECKED(flags, 3);
- Handle<JSObject> result;
Handle<LiteralsArray> literals(closure->literals(), isolate);
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, CreateArrayLiteralImpl(isolate, literals, literals_index,
- elements, flags));
- return *result;
+ RETURN_RESULT_OR_FAILURE(
+ isolate, CreateArrayLiteralImpl(isolate, literals, literals_index,
+ elements, flags));
}
@@ -349,13 +345,11 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteralStubBailout) {
CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
- Handle<JSObject> result;
Handle<LiteralsArray> literals(closure->literals(), isolate);
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
+ RETURN_RESULT_OR_FAILURE(
+ isolate,
CreateArrayLiteralImpl(isolate, literals, literals_index, elements,
ArrayLiteral::kShallowElements));
- return *result;
}
} // namespace internal
« no previous file with comments | « src/runtime/runtime-json.cc ('k') | src/runtime/runtime-liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698