Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / js / src / jit / TemplateObject-inl.h
blob3bfeb8e72d4519a4b6198070276eb3214834b2b3
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 jit_TemplateObject_inl_h
8 #define jit_TemplateObject_inl_h
10 #include "jit/TemplateObject.h"
12 #include "vm/EnvironmentObject.h"
13 #include "vm/PlainObject.h" // js::PlainObject
14 #include "vm/RegExpObject.h"
16 namespace js {
17 namespace jit {
19 inline gc::AllocKind TemplateObject::getAllocKind() const {
20 return obj_->asTenured().getAllocKind();
23 inline bool TemplateObject::isNativeObject() const {
24 return obj_->is<NativeObject>();
27 inline bool TemplateObject::isArrayObject() const {
28 return obj_->is<ArrayObject>();
31 inline bool TemplateObject::isArgumentsObject() const {
32 return obj_->is<ArgumentsObject>();
35 inline bool TemplateObject::isTypedArrayObject() const {
36 return obj_->is<TypedArrayObject>();
39 inline bool TemplateObject::isRegExpObject() const {
40 return obj_->is<RegExpObject>();
43 inline bool TemplateObject::isCallObject() const {
44 return obj_->is<CallObject>();
47 inline bool TemplateObject::isBlockLexicalEnvironmentObject() const {
48 return obj_->is<BlockLexicalEnvironmentObject>();
51 inline bool TemplateObject::isPlainObject() const {
52 return obj_->is<PlainObject>();
55 inline gc::Cell* TemplateObject::shape() const {
56 Shape* shape = obj_->shape();
57 MOZ_ASSERT(!shape->isDictionary());
58 return shape;
61 inline const TemplateNativeObject& TemplateObject::asTemplateNativeObject()
62 const {
63 MOZ_ASSERT(isNativeObject());
64 return *static_cast<const TemplateNativeObject*>(this);
67 inline bool TemplateNativeObject::hasDynamicSlots() const {
68 return asNativeObject().hasDynamicSlots();
71 inline uint32_t TemplateNativeObject::numDynamicSlots() const {
72 return asNativeObject().numDynamicSlots();
75 inline uint32_t TemplateNativeObject::numUsedFixedSlots() const {
76 return asNativeObject().numUsedFixedSlots();
79 inline uint32_t TemplateNativeObject::numFixedSlots() const {
80 return asNativeObject().numFixedSlots();
83 inline uint32_t TemplateNativeObject::slotSpan() const {
84 return asNativeObject().sharedShape()->slotSpan();
87 inline Value TemplateNativeObject::getSlot(uint32_t i) const {
88 return asNativeObject().getSlot(i);
91 inline const Value* TemplateNativeObject::getDenseElements() const {
92 return asNativeObject().getDenseElements();
95 #ifdef DEBUG
96 inline bool TemplateNativeObject::isSharedMemory() const {
97 return asNativeObject().isSharedMemory();
99 #endif
101 inline uint32_t TemplateNativeObject::getDenseCapacity() const {
102 return asNativeObject().getDenseCapacity();
105 inline uint32_t TemplateNativeObject::getDenseInitializedLength() const {
106 return asNativeObject().getDenseInitializedLength();
109 inline uint32_t TemplateNativeObject::getArrayLength() const {
110 return obj_->as<ArrayObject>().length();
113 inline bool TemplateNativeObject::hasDynamicElements() const {
114 return asNativeObject().hasDynamicElements();
117 inline gc::Cell* TemplateNativeObject::regExpShared() const {
118 RegExpObject* regexp = &obj_->as<RegExpObject>();
119 MOZ_ASSERT(regexp->hasShared());
120 return regexp->getShared();
123 } // namespace jit
124 } // namespace js
126 #endif /* jit_TemplateObject_inl_h */