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

Unified Diff: src/runtime/runtime-json.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-internal.cc ('k') | src/runtime/runtime-literals.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-json.cc
diff --git a/src/runtime/runtime-json.cc b/src/runtime/runtime-json.cc
index d953eeb40425b9fc4fd80a84b90eb074d721c8a8..576e5400927d1cf37c56fa68b70f96aa305bdf24 100644
--- a/src/runtime/runtime-json.cc
+++ b/src/runtime/runtime-json.cc
@@ -18,10 +18,8 @@ RUNTIME_FUNCTION(Runtime_QuoteJSONString) {
HandleScope scope(isolate);
CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
DCHECK(args.length() == 1);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, BasicJsonStringifier::StringifyString(isolate, string));
- return *result;
+ RETURN_RESULT_OR_FAILURE(
+ isolate, BasicJsonStringifier::StringifyString(isolate, string));
}
RUNTIME_FUNCTION(Runtime_BasicJSONStringify) {
@@ -29,10 +27,8 @@ RUNTIME_FUNCTION(Runtime_BasicJSONStringify) {
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, gap, 1);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, BasicJsonStringifier(isolate).Stringify(object, gap));
- return *result;
+ RETURN_RESULT_OR_FAILURE(
+ isolate, BasicJsonStringifier(isolate).Stringify(object, gap));
}
RUNTIME_FUNCTION(Runtime_ParseJson) {
@@ -44,12 +40,9 @@ RUNTIME_FUNCTION(Runtime_ParseJson) {
Object::ToString(isolate, object));
source = String::Flatten(source);
// Optimized fast case where we only have Latin1 characters.
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
- source->IsSeqOneByteString()
- ? JsonParser<true>::Parse(source)
- : JsonParser<false>::Parse(source));
- return *result;
+ RETURN_RESULT_OR_FAILURE(isolate, source->IsSeqOneByteString()
+ ? JsonParser<true>::Parse(source)
+ : JsonParser<false>::Parse(source));
}
} // namespace internal
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | src/runtime/runtime-literals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698