Bug 1865597 - Add error checking when initializing parallel marking and disable on...
[gecko.git] / js / src / vm / ArrayBufferObject-inl.h
blob1ca36c243d1e484701d8a0b72f36b2a56ad5b6b3
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
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/. */
7 #ifndef vm_ArrayBufferObject_inl_h
8 #define vm_ArrayBufferObject_inl_h
10 // Utilities and common inline code for ArrayBufferObject and
11 // SharedArrayBufferObject.
13 #include "vm/ArrayBufferObject.h"
15 #include "vm/SharedArrayObject.h"
16 #include "vm/SharedMem.h"
18 namespace js {
20 inline SharedMem<uint8_t*> ArrayBufferObjectMaybeShared::dataPointerEither() {
21 if (this->is<ArrayBufferObject>()) {
22 return this->as<ArrayBufferObject>().dataPointerShared();
24 return this->as<SharedArrayBufferObject>().dataPointerShared();
27 inline bool ArrayBufferObjectMaybeShared::isDetached() const {
28 if (this->is<ArrayBufferObject>()) {
29 return this->as<ArrayBufferObject>().isDetached();
31 return false;
34 inline size_t ArrayBufferObjectMaybeShared::byteLength() const {
35 if (this->is<ArrayBufferObject>()) {
36 return this->as<ArrayBufferObject>().byteLength();
38 return this->as<SharedArrayBufferObject>().byteLength();
41 inline bool ArrayBufferObjectMaybeShared::isPreparedForAsmJS() const {
42 if (this->is<ArrayBufferObject>()) {
43 return this->as<ArrayBufferObject>().isPreparedForAsmJS();
45 return false;
48 inline bool ArrayBufferObjectMaybeShared::isWasm() const {
49 if (this->is<ArrayBufferObject>()) {
50 return this->as<ArrayBufferObject>().isWasm();
52 return this->as<SharedArrayBufferObject>().isWasm();
55 } // namespace js
57 #endif // vm_ArrayBufferObject_inl_h