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

Unified Diff: src/json-stringifier.h

Issue 225673003: Return MaybeHandle from GetProperty. (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 | « src/ic.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index f8bac94d1353b8f86b482cd1e3c580e799aaa844..8de600eedfe19e3d81b0ada5e15cc9f6a8150491 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -81,8 +81,9 @@ class BasicJsonStringifier BASE_EMBEDDED {
}
}
- Handle<Object> ApplyToJsonFunction(Handle<Object> object,
- Handle<Object> key);
+ MUST_USE_RESULT MaybeHandle<Object> ApplyToJsonFunction
+ Handle<Object> object,
+ Handle<Object> key);
Result SerializeGeneric(Handle<Object> object,
Handle<Object> key,
@@ -361,15 +362,17 @@ void BasicJsonStringifier::Append_(const Char* chars) {
}
-Handle<Object> BasicJsonStringifier::ApplyToJsonFunction(
+MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction(
Handle<Object> object, Handle<Object> key) {
LookupResult lookup(isolate_);
JSObject::cast(*object)->LookupRealNamedProperty(*tojson_string_, &lookup);
if (!lookup.IsProperty()) return object;
PropertyAttributes attr;
- Handle<Object> fun =
- Object::GetProperty(object, object, &lookup, tojson_string_, &attr);
- if (fun.is_null()) return Handle<Object>::null();
+ Handle<Object> fun;
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate_, fun,
+ Object::GetProperty(object, object, &lookup, tojson_string_, &attr),
+ Object);
if (!fun->IsJSFunction()) return object;
// Call toJSON function.
@@ -379,7 +382,7 @@ Handle<Object> BasicJsonStringifier::ApplyToJsonFunction(
HandleScope scope(isolate_);
object = Execution::Call(isolate_, fun, object, 1, argv, &has_exception);
// Return empty handle to signal an exception.
- if (has_exception) return Handle<Object>::null();
+ if (has_exception) return MaybeHandle<Object>();
return scope.CloseAndEscape(object);
}
@@ -416,8 +419,10 @@ template <bool deferred_string_key>
BasicJsonStringifier::Result BasicJsonStringifier::Serialize_(
Handle<Object> object, bool comma, Handle<Object> key) {
if (object->IsJSObject()) {
- object = ApplyToJsonFunction(object, key);
- if (object.is_null()) return EXCEPTION;
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(
+ isolate_, object,
+ ApplyToJsonFunction(object, key),
+ EXCEPTION);
}
if (object->IsSmi()) {
« no previous file with comments | « src/ic.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698