LCOV - code coverage report
Current view: top level - js/src/vm - ArrayBufferObject-inl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 21 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * vim: set ts=8 sts=4 et sw=4 tw=99:
       3             :  * This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef vm_ArrayBufferObject_inl_h
       8             : #define vm_ArrayBufferObject_inl_h
       9             : 
      10             : /* Utilities and common inline code for ArrayBufferObject and SharedArrayBufferObject */
      11             : 
      12             : #include "vm/ArrayBufferObject.h"
      13             : 
      14             : #include "js/Value.h"
      15             : 
      16             : #include "vm/SharedArrayObject.h"
      17             : #include "vm/SharedMem.h"
      18             : 
      19             : namespace js {
      20             : 
      21             : inline SharedMem<uint8_t*>
      22           0 : ArrayBufferObjectMaybeShared::dataPointerEither()
      23             : {
      24           0 :     ArrayBufferObjectMaybeShared* buf = this;
      25           0 :     if (buf->is<ArrayBufferObject>())
      26           0 :         return buf->as<ArrayBufferObject>().dataPointerShared();
      27           0 :     return buf->as<SharedArrayBufferObject>().dataPointerShared();
      28             : }
      29             : 
      30             : inline bool
      31           0 : ArrayBufferObjectMaybeShared::isDetached() const
      32             : {
      33           0 :     if (this->is<ArrayBufferObject>())
      34           0 :         return this->as<ArrayBufferObject>().isDetached();
      35           0 :     return false;
      36             : }
      37             : 
      38             : inline uint32_t
      39           0 : AnyArrayBufferByteLength(const ArrayBufferObjectMaybeShared* buf)
      40             : {
      41           0 :     if (buf->is<ArrayBufferObject>())
      42           0 :         return buf->as<ArrayBufferObject>().byteLength();
      43           0 :     return buf->as<SharedArrayBufferObject>().byteLength();
      44             : }
      45             : 
      46             : inline bool
      47           0 : AnyArrayBufferIsPreparedForAsmJS(const ArrayBufferObjectMaybeShared* buf)
      48             : {
      49           0 :     if (buf->is<ArrayBufferObject>())
      50           0 :         return buf->as<ArrayBufferObject>().isPreparedForAsmJS();
      51           0 :     return buf->as<SharedArrayBufferObject>().isPreparedForAsmJS();
      52             : }
      53             : 
      54             : inline ArrayBufferObjectMaybeShared&
      55           0 : AsAnyArrayBuffer(HandleValue val)
      56             : {
      57           0 :     if (val.toObject().is<ArrayBufferObject>())
      58           0 :         return val.toObject().as<ArrayBufferObject>();
      59           0 :     return val.toObject().as<SharedArrayBufferObject>();
      60             : }
      61             : 
      62             : } // namespace js
      63             : 
      64             : #endif // vm_ArrayBufferObject_inl_h

Generated by: LCOV version 1.13