Bug 1599416 - Part 10: Simplify TypedObject::isAttached. r=mgaudet
authorAndré Bargull <andre.bargull@gmail.com>
Wed, 27 Nov 2019 13:58:05 +0000
changeset 504046 f98095b88847ac5ce7693dde47d1ff28528cce9a
parent 504045 039c220b566646e5c1d6c55a47be7cd941012786
child 504047 27b601310b36bd37243a4b0e8600533d1f052e68
push id36855
push useraiakab@mozilla.com
push dateWed, 27 Nov 2019 21:56:55 +0000
treeherdermozilla-central@62ae0fda7cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1599416
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1599416 - Part 10: Simplify TypedObject::isAttached. r=mgaudet - Instead of testing for `InlineTransparentTypedObject` and `InlineOpaqueTypedObject` separately, we can directly test for `InlineTypedObject`. - Because the ArrayBuffer of an `OutlineTypedObject` can never be detached, we don't need to test for it. Differential Revision: https://phabricator.services.mozilla.com/D54714
js/src/builtin/TypedObject.cpp
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -1509,31 +1509,20 @@ uint8_t* TypedObject::typedMemBase() con
   JSObject& owner = as<OutlineTypedObject>().owner();
   if (owner.is<ArrayBufferObject>()) {
     return owner.as<ArrayBufferObject>().dataPointer();
   }
   return owner.as<InlineTypedObject>().inlineTypedMem();
 }
 
 bool TypedObject::isAttached() const {
-  if (is<InlineTransparentTypedObject>()) {
-    return true;
-  }
-  if (is<InlineOpaqueTypedObject>()) {
+  if (is<InlineTypedObject>()) {
     return true;
   }
-  if (!as<OutlineTypedObject>().outOfLineTypedMem()) {
-    return false;
-  }
-  JSObject& owner = as<OutlineTypedObject>().owner();
-  if (owner.is<ArrayBufferObject>() &&
-      owner.as<ArrayBufferObject>().isDetached()) {
-    return false;
-  }
-  return true;
+  return as<OutlineTypedObject>().outOfLineTypedMem();
 }
 
 /******************************************************************************
  * Outline typed objects
  */
 
 /*static*/
 OutlineTypedObject* OutlineTypedObject::createUnattached(JSContext* cx,