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

Unified Diff: src/api.cc

Issue 223553003: Return MaybeHandle from JsonParser. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | « no previous file | src/json-parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 2ef58fdb32f3b7f006678084f9583cbe24e1d1da..060914a8d84973d0cfae15f091741ba0da9795d1 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2315,13 +2315,11 @@ Local<Value> JSON::Parse(Local<String> json_string) {
i::Handle<i::String> source = i::Handle<i::String>(
FlattenGetString(Utils::OpenHandle(*json_string)));
EXCEPTION_PREAMBLE(isolate);
+ i::MaybeHandle<i::Object> maybe_result =
+ source->IsSeqOneByteString() ? i::JsonParser<true>::Parse(source)
+ : i::JsonParser<false>::Parse(source);
i::Handle<i::Object> result;
- if (source->IsSeqOneByteString()) {
- result = i::JsonParser<true>::Parse(source);
- } else {
- result = i::JsonParser<false>::Parse(source);
- }
- has_pending_exception = result.is_null();
+ has_pending_exception = !maybe_result.ToHandle(&result);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
return Utils::ToLocal(
i::Handle<i::Object>::cast(scope.CloseAndEscape(result)));
« no previous file with comments | « no previous file | src/json-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698