Only print elements of a typed array if the buffer wasn't neutered
authorjochen <jochen@chromium.org>
Thu, 7 May 2015 15:55:23 +0000 (08:55 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 7 May 2015 15:55:25 +0000 (15:55 +0000)
BUG=chromium:485534
R=yangguo@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1130063004

Cr-Commit-Position: refs/heads/master@{#28302}

src/objects-printer.cc

index 00a1002..c9fdcd9 100644 (file)
@@ -719,6 +719,7 @@ void JSArrayBuffer::JSArrayBufferPrint(std::ostream& os) {  // NOLINT
   os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
   os << " - backing_store = " << backing_store() << "\n";
   os << " - byte_length = " << Brief(byte_length());
+  if (was_neutered()) os << " - neutered\n";
   os << "\n";
 }
 
@@ -730,8 +731,9 @@ void JSTypedArray::JSTypedArrayPrint(std::ostream& os) {  // NOLINT
   os << "\n - byte_offset = " << Brief(byte_offset());
   os << "\n - byte_length = " << Brief(byte_length());
   os << "\n - length = " << Brief(length());
+  if (WasNeutered()) os << " - neutered\n";
   os << "\n";
-  PrintElements(os);
+  if (!WasNeutered()) PrintElements(os);
 }
 
 
@@ -741,6 +743,7 @@ void JSDataView::JSDataViewPrint(std::ostream& os) {  // NOLINT
   os << " - buffer =" << Brief(buffer());
   os << "\n - byte_offset = " << Brief(byte_offset());
   os << "\n - byte_length = " << Brief(byte_length());
+  if (WasNeutered()) os << " - neutered\n";
   os << "\n";
 }