tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TemplateObject-inl.h (3392B)


      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/. */
      6 
      7 #ifndef jit_TemplateObject_inl_h
      8 #define jit_TemplateObject_inl_h
      9 
     10 #include "jit/TemplateObject.h"
     11 
     12 #include "vm/EnvironmentObject.h"
     13 #include "vm/PlainObject.h"  // js::PlainObject
     14 #include "vm/RegExpObject.h"
     15 
     16 namespace js {
     17 namespace jit {
     18 
     19 inline gc::AllocKind TemplateObject::getAllocKind() const {
     20  return obj_->asTenured().getAllocKind();
     21 }
     22 
     23 inline bool TemplateObject::isNativeObject() const {
     24  return obj_->is<NativeObject>();
     25 }
     26 
     27 inline bool TemplateObject::isArrayObject() const {
     28  return obj_->is<ArrayObject>();
     29 }
     30 
     31 inline bool TemplateObject::isArgumentsObject() const {
     32  return obj_->is<ArgumentsObject>();
     33 }
     34 
     35 inline bool TemplateObject::isTypedArrayObject() const {
     36  return obj_->is<TypedArrayObject>();
     37 }
     38 
     39 inline bool TemplateObject::isRegExpObject() const {
     40  return obj_->is<RegExpObject>();
     41 }
     42 
     43 inline bool TemplateObject::isCallObject() const {
     44  return obj_->is<CallObject>();
     45 }
     46 
     47 inline bool TemplateObject::isBlockLexicalEnvironmentObject() const {
     48  return obj_->is<BlockLexicalEnvironmentObject>();
     49 }
     50 
     51 inline bool TemplateObject::isPlainObject() const {
     52  return obj_->is<PlainObject>();
     53 }
     54 
     55 inline gc::Cell* TemplateObject::shape() const {
     56  Shape* shape = obj_->shape();
     57  MOZ_ASSERT(!shape->isDictionary());
     58  return shape;
     59 }
     60 
     61 inline const TemplateNativeObject& TemplateObject::asTemplateNativeObject()
     62    const {
     63  MOZ_ASSERT(isNativeObject());
     64  return *static_cast<const TemplateNativeObject*>(this);
     65 }
     66 
     67 inline bool TemplateNativeObject::hasDynamicSlots() const {
     68  return asNativeObject().hasDynamicSlots();
     69 }
     70 
     71 inline uint32_t TemplateNativeObject::numDynamicSlots() const {
     72  return asNativeObject().numDynamicSlots();
     73 }
     74 
     75 inline uint32_t TemplateNativeObject::numUsedFixedSlots() const {
     76  return asNativeObject().numUsedFixedSlots();
     77 }
     78 
     79 inline uint32_t TemplateNativeObject::numFixedSlots() const {
     80  return asNativeObject().numFixedSlots();
     81 }
     82 
     83 inline uint32_t TemplateNativeObject::slotSpan() const {
     84  return asNativeObject().sharedShape()->slotSpan();
     85 }
     86 
     87 inline Value TemplateNativeObject::getSlot(uint32_t i) const {
     88  return asNativeObject().getSlot(i);
     89 }
     90 
     91 inline const Value* TemplateNativeObject::getDenseElements() const {
     92  return asNativeObject().getDenseElements();
     93 }
     94 
     95 #ifdef DEBUG
     96 inline bool TemplateNativeObject::isSharedMemory() const {
     97  return asNativeObject().isSharedMemory();
     98 }
     99 #endif
    100 
    101 inline uint32_t TemplateNativeObject::getDenseCapacity() const {
    102  return asNativeObject().getDenseCapacity();
    103 }
    104 
    105 inline uint32_t TemplateNativeObject::getDenseInitializedLength() const {
    106  return asNativeObject().getDenseInitializedLength();
    107 }
    108 
    109 inline uint32_t TemplateNativeObject::getArrayLength() const {
    110  return obj_->as<ArrayObject>().length();
    111 }
    112 
    113 inline bool TemplateNativeObject::hasDynamicElements() const {
    114  return asNativeObject().hasDynamicElements();
    115 }
    116 
    117 inline gc::Cell* TemplateNativeObject::regExpShared() const {
    118  RegExpObject* regexp = &obj_->as<RegExpObject>();
    119  MOZ_ASSERT(regexp->hasShared());
    120  return regexp->getShared();
    121 }
    122 
    123 }  // namespace jit
    124 }  // namespace js
    125 
    126 #endif /* jit_TemplateObject_inl_h */