Bug 1885489 - Part 11: Use SnapshotIterator::readBigInt() when recovering BigInt...
[gecko.git] / js / src / jit / TypeData.h
blob4a05895e878a6cf3f577dcc381e59940d86e382c
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_TypeData_h
8 #define jit_TypeData_h
10 #include "js/Value.h"
12 namespace js {
13 namespace jit {
15 class TypeData {
16 JSValueType type_;
18 public:
19 TypeData() : type_(JSVAL_TYPE_UNKNOWN) {}
20 explicit TypeData(JSValueType type) : type_(type) {}
22 JSValueType type() const { return type_; }
23 bool hasData() const { return type_ != JSVAL_TYPE_UNKNOWN; }
26 class TypeDataList {
27 const static size_t MaxLength = 6;
29 uint8_t count_ = 0;
30 TypeData typeData_[MaxLength];
32 public:
33 TypeDataList() {}
35 uint8_t count() const { return count_; }
37 void addTypeData(TypeData data) {
38 MOZ_ASSERT(count_ < MaxLength);
39 MOZ_ASSERT(!typeData_[count_].hasData());
40 typeData_[count_++] = data;
42 TypeData get(uint32_t idx) const {
43 MOZ_ASSERT(idx < count_);
44 return typeData_[idx];
47 const TypeData* begin() const { return &typeData_[0]; }
48 const TypeData* end() const { return begin() + count_; }
51 } // namespace jit
52 } // namespace js
54 #endif /* jit_TypeData_h */