diff options
Diffstat (limited to 'js/src/irregexp/RegExpTypes.h')
-rw-r--r-- | js/src/irregexp/RegExpTypes.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/js/src/irregexp/RegExpTypes.h b/js/src/irregexp/RegExpTypes.h index e2a619689c..620fac4ed5 100644 --- a/js/src/irregexp/RegExpTypes.h +++ b/js/src/irregexp/RegExpTypes.h @@ -21,15 +21,17 @@ namespace internal { class ByteArrayData { public: - uint32_t length; + ByteArrayData(uint32_t length) : length_(length) {} + + uint32_t length() { return length_; }; uint8_t* data(); uint8_t get(uint32_t index) { - MOZ_ASSERT(index < length); + MOZ_ASSERT(index < length()); return data()[index]; } void set(uint32_t index, uint8_t val) { - MOZ_ASSERT(index < length); + MOZ_ASSERT(index < length()); data()[index] = val; } @@ -39,9 +41,19 @@ class ByteArrayData { template <typename T> void setTyped(uint32_t index, T value); +#ifdef DEBUG + const static uint32_t ExpectedMagic = 0x12344321; + uint32_t magic() const { return magic_; } + + private: + uint32_t magic_ = ExpectedMagic; +#endif + private: template <typename T> T* typedData(); + + uint32_t length_; }; class Isolate; |