Fix webkit/run-json-stringify in Debug mode

Clang is known to use a lot of stack space for Debug builds, so
this patch lowers the recursion depth of that test after recent
changes made Debug-mode stack frames a bit larger.

a bit of Debug-mode stack space.

Bonus: drops an unnecessary cast from SerializeJSObject to save
Change-Id: I22696a1d80a6a73b5049b018e72cc8a3d8693042
Reviewed-on: https://chromium-review.googlesource.com/c/1334448
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57516}
This commit is contained in:
Jakob Kummerow 2018-11-13 14:08:07 -08:00 committed by Commit Bot
parent 3a8c808221
commit 8c3b97b562
3 changed files with 11 additions and 14 deletions

View File

@ -638,14 +638,11 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject(
if (property_list_.is_null() &&
!object->map()->IsCustomElementsReceiverMap() &&
object->HasFastProperties() &&
Handle<JSObject>::cast(object)->elements()->length() == 0) {
DCHECK(object->IsJSObject());
object->HasFastProperties() && object->elements()->length() == 0) {
DCHECK(!object->IsJSGlobalProxy());
Handle<JSObject> js_obj = Handle<JSObject>::cast(object);
DCHECK(!js_obj->HasIndexedInterceptor());
DCHECK(!js_obj->HasNamedInterceptor());
Handle<Map> map(js_obj->map(), isolate_);
DCHECK(!object->HasIndexedInterceptor());
DCHECK(!object->HasNamedInterceptor());
Handle<Map> map(object->map(), isolate_);
builder_.AppendCharacter('{');
Indent();
bool comma = false;
@ -657,15 +654,15 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject(
PropertyDetails details = map->instance_descriptors()->GetDetails(i);
if (details.IsDontEnum()) continue;
Handle<Object> property;
if (details.location() == kField && *map == js_obj->map()) {
if (details.location() == kField && *map == object->map()) {
DCHECK_EQ(kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
property = JSObject::FastPropertyAt(js_obj, details.representation(),
property = JSObject::FastPropertyAt(object, details.representation(),
field_index);
} else {
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate_, property,
Object::GetPropertyOrElement(isolate_, js_obj, key), EXCEPTION);
Object::GetPropertyOrElement(isolate_, object, key), EXCEPTION);
}
Result result = SerializeProperty(property, comma, key);
if (!comma && result == SUCCESS) comma = true;

View File

@ -475,7 +475,7 @@ function createTests() {
});
result.push(function (jsonObject){
var deepObject = {};
for (var i = 0; i < 1000; i++)
for (var i = 0; i < 915; i++)
deepObject = {next:deepObject};
return jsonObject.stringify(deepObject);
});
@ -488,7 +488,7 @@ function createTests() {
result.push(function (jsonObject){
var depth = 0;
function toDeepVirtualJSONObject() {
if (++depth >= 1000)
if (++depth >= 915)
return {};
var r = {};
r.toJSON = toDeepVirtualJSONObject;

View File

@ -499,7 +499,7 @@ function (jsonObject){
PASS tests[i](nativeJSON) is tests[i](JSON)
function (jsonObject){
var deepObject = {};
for (var i = 0; i < 1000; i++)
for (var i = 0; i < 915; i++)
deepObject = {next:deepObject};
return jsonObject.stringify(deepObject);
}
@ -514,7 +514,7 @@ PASS tests[i](nativeJSON) is tests[i](JSON)
function (jsonObject){
var depth = 0;
function toDeepVirtualJSONObject() {
if (++depth >= 1000)
if (++depth >= 915)
return {};
var r = {};
r.toJSON = toDeepVirtualJSONObject;