Commit e04fbec1 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

Revert "Make NoSideEffectsToString gracefully handle huge msgs on error objects"

This reverts commit b0ebfabc.

Reason for revert: Speculative revert for nvidia bot failure: https://ci.chromium.org/p/v8/builders/ci/Linux%20V8%20FYI%20Release%20(NVIDIA)/7953

Original change's description:
> Make NoSideEffectsToString gracefully handle huge msgs on error objects
> 
> Bug: chromium:1032512
> Change-Id: I323981a08e316ebc10c729f2f04b7832373937b0
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1962865
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Commit-Queue: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#65782}

TBR=neis@chromium.org,jgruber@chromium.org

Change-Id: Ibdc1efccab3edcd05dd1df99ad0263ea4bce9989
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1032512
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2002532Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65793}
parent c0c7680e
......@@ -406,13 +406,15 @@ Handle<String> AsStringOrEmpty(Isolate* isolate, Handle<Object> object) {
}
Handle<String> NoSideEffectsErrorToString(Isolate* isolate,
Handle<JSReceiver> error) {
Handle<Object> input) {
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(input);
Handle<Name> name_key = isolate->factory()->name_string();
Handle<Object> name = JSReceiver::GetDataProperty(error, name_key);
Handle<Object> name = JSReceiver::GetDataProperty(receiver, name_key);
Handle<String> name_str = AsStringOrEmpty(isolate, name);
Handle<Name> msg_key = isolate->factory()->message_string();
Handle<Object> msg = JSReceiver::GetDataProperty(error, msg_key);
Handle<Object> msg = JSReceiver::GetDataProperty(receiver, msg_key);
Handle<String> msg_str = AsStringOrEmpty(isolate, msg);
if (name_str->length() == 0) return msg_str;
......@@ -421,12 +423,7 @@ Handle<String> NoSideEffectsErrorToString(Isolate* isolate,
IncrementalStringBuilder builder(isolate);
builder.AppendString(name_str);
builder.AppendCString(": ");
if (builder.Length() + msg_str->length() <= String::kMaxLength) {
builder.AppendString(msg_str);
} else {
builder.AppendCString("<a very large string>");
}
builder.AppendString(msg_str);
return builder.Finish().ToHandleChecked();
}
......@@ -497,8 +494,7 @@ Handle<String> Object::NoSideEffectsToString(Isolate* isolate,
// When internally formatting error objects, use a side-effects-free
// version of Error.prototype.toString independent of the actually
// installed toString method.
return NoSideEffectsErrorToString(isolate,
Handle<JSReceiver>::cast(input));
return NoSideEffectsErrorToString(isolate, input);
} else if (*to_string == *isolate->object_to_string()) {
Handle<Object> ctor = JSReceiver::GetDataProperty(
receiver, isolate->factory()->constructor_string());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment