Commit 495a8ed4 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

Revert "[diagnostics] Adapt printing logic for huge TypedArrays"

This reverts commit 9cca9eec.

Reason for revert: UBSan is not happy

Original change's description:
> [diagnostics] Adapt printing logic for huge TypedArrays
> 
> 1) don't print off-heap TypedArray elements with --mock-arraybuffer-allocator
> 2) print integer HeapNumbers with max precision
> 
> Bug: v8:4153
> Change-Id: I4ae00b5044e3a9b2dd641aba0e06496042d6ff76
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1875095
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#64520}

TBR=ishell@chromium.org,verwaest@chromium.org

Change-Id: I064efb3ca06cc56fff209bc1c6fb6fb518af4f83
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:4153
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1876066Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64521}
parent 9cca9eec
......@@ -569,15 +569,9 @@ void DoPrintElements(std::ostream& os, Object object, int length) { // NOLINT
template <typename ElementType>
void PrintTypedArrayElements(std::ostream& os, const ElementType* data_ptr,
size_t length, bool is_on_heap) {
size_t length) {
if (length == 0) return;
size_t previous_index = 0;
if (i::FLAG_mock_arraybuffer_allocator && !is_on_heap) {
// Don't try to print data that's not actually allocated.
os << "\n 0-" << length << ": <mocked array buffer bytes>";
return;
}
ElementType previous_value = data_ptr[0];
ElementType value = 0;
for (size_t i = 1; i <= length; i++) {
......@@ -701,10 +695,9 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT
#define PRINT_ELEMENTS(Type, type, TYPE, elementType) \
case TYPE##_ELEMENTS: { \
size_t length = JSTypedArray::cast(*this).length(); \
bool is_on_heap = JSTypedArray::cast(*this).is_on_heap(); \
const elementType* data_ptr = \
static_cast<const elementType*>(JSTypedArray::cast(*this).DataPtr()); \
PrintTypedArrayElements<elementType>(os, data_ptr, length, is_on_heap); \
PrintTypedArrayElements<elementType>(os, data_ptr, length); \
break; \
}
TYPED_ARRAYS(PRINT_ELEMENTS)
......@@ -2473,15 +2466,7 @@ void TaggedImpl<kRefType, StorageType>::Print(std::ostream& os) {
#endif // OBJECT_PRINT
void HeapNumber::HeapNumberPrint(std::ostream& os) {
double val = value();
int64_t i = static_cast<int64_t>(DoubleToInteger(val));
if (static_cast<double>(i) == val) {
os << i;
} else {
os << val;
}
}
void HeapNumber::HeapNumberPrint(std::ostream& os) { os << value(); }
// TODO(cbruni): remove once the new maptracer is in place.
void Name::NameShortPrint() {
......
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