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

Unified Diff: src/json-stringifier.h

Issue 231103002: Object::GetElements() and friends maybehandlification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: FixedArray::UnionOfKeys() maybehandlified Created 6 years, 8 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/isolate.cc ('k') | src/log.cc » ('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 dcb5cc549645b5c9ba5c5953bf0817f1865af81c..e50f11bb7047237bf47c7d186de459d22ca12886 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -482,8 +482,8 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeGeneric(
bool deferred_comma,
bool deferred_key) {
Handle<JSObject> builtins(isolate_->native_context()->builtins());
- Handle<JSFunction> builtin =
- Handle<JSFunction>::cast(GetProperty(builtins, "JSONSerializeAdapter"));
+ Handle<JSFunction> builtin = Handle<JSFunction>::cast(
+ GetProperty(builtins, "JSONSerializeAdapter").ToHandleChecked());
Handle<Object> argv[] = { key, object };
bool has_exception = false;
@@ -625,8 +625,11 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArraySlow(
Handle<JSArray> object, int length) {
for (int i = 0; i < length; i++) {
if (i > 0) Append(',');
- Handle<Object> element = Object::GetElement(isolate_, object, i);
- RETURN_IF_EMPTY_HANDLE_VALUE(isolate_, element, EXCEPTION);
+ Handle<Object> element;
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(
+ isolate_, element,
+ Object::GetElement(isolate_, object, i),
+ EXCEPTION);
if (element->IsUndefined()) {
AppendAscii("null");
} else {
@@ -676,40 +679,45 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
map->instance_descriptors()->GetFieldIndex(i)),
isolate_);
} else {
- property = Object::GetPropertyOrElement(object, key);
- RETURN_IF_EMPTY_HANDLE_VALUE(isolate_, property, EXCEPTION);
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(
+ isolate_, property,
+ Object::GetPropertyOrElement(object, key),
+ EXCEPTION);
}
Result result = SerializeProperty(property, comma, key);
if (!comma && result == SUCCESS) comma = true;
if (result >= EXCEPTION) return result;
}
} else {
- bool has_exception = false;
- Handle<FixedArray> contents =
- GetKeysInFixedArrayFor(object, LOCAL_ONLY, &has_exception);
- if (has_exception) return EXCEPTION;
+ Handle<FixedArray> contents;
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(
+ isolate_, contents,
+ GetKeysInFixedArrayFor(object, LOCAL_ONLY),
+ EXCEPTION);
for (int i = 0; i < contents->length(); i++) {
Object* key = contents->get(i);
Handle<String> key_handle;
- Handle<Object> property;
+ MaybeHandle<Object> maybe_property;
if (key->IsString()) {
key_handle = Handle<String>(String::cast(key), isolate_);
- property = Object::GetPropertyOrElement(object, key_handle);
+ maybe_property = Object::GetPropertyOrElement(object, key_handle);
} else {
ASSERT(key->IsNumber());
key_handle = factory_->NumberToString(Handle<Object>(key, isolate_));
uint32_t index;
if (key->IsSmi()) {
- property = Object::GetElement(
+ maybe_property = Object::GetElement(
isolate_, object, Smi::cast(key)->value());
} else if (key_handle->AsArrayIndex(&index)) {
- property = Object::GetElement(isolate_, object, index);
+ maybe_property = Object::GetElement(isolate_, object, index);
} else {
- property = Object::GetPropertyOrElement(object, key_handle);
+ maybe_property = Object::GetPropertyOrElement(object, key_handle);
}
}
- RETURN_IF_EMPTY_HANDLE_VALUE(isolate_, property, EXCEPTION);
+ Handle<Object> property;
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(
+ isolate_, property, maybe_property, EXCEPTION);
Result result = SerializeProperty(property, comma, key_handle);
if (!comma && result == SUCCESS) comma = true;
if (result >= EXCEPTION) return result;
« no previous file with comments | « src/isolate.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698