OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 7916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7927 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi | 7927 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi |
7928 // used for tracking the last usage (used for code flushing).. | 7928 // used for tracking the last usage (used for code flushing).. |
7929 // - max number of registers used by irregexp implementations. | 7929 // - max number of registers used by irregexp implementations. |
7930 // - number of capture registers (output values) of the regexp. | 7930 // - number of capture registers (output values) of the regexp. |
7931 class JSRegExp: public JSObject { | 7931 class JSRegExp: public JSObject { |
7932 public: | 7932 public: |
7933 // Meaning of Type: | 7933 // Meaning of Type: |
7934 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. | 7934 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. |
7935 // ATOM: A simple string to match against using an indexOf operation. | 7935 // ATOM: A simple string to match against using an indexOf operation. |
7936 // IRREGEXP: Compiled with Irregexp. | 7936 // IRREGEXP: Compiled with Irregexp. |
7937 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. | |
7938 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; | 7937 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; |
7939 enum Flag { | 7938 enum Flag { |
7940 kNone = 0, | 7939 kNone = 0, |
7941 kGlobal = 1 << 0, | 7940 kGlobal = 1 << 0, |
7942 kIgnoreCase = 1 << 1, | 7941 kIgnoreCase = 1 << 1, |
7943 kMultiline = 1 << 2, | 7942 kMultiline = 1 << 2, |
7944 kSticky = 1 << 3, | 7943 kSticky = 1 << 3, |
7945 kUnicode = 1 << 4, | 7944 kUnicode = 1 << 4, |
7946 }; | 7945 }; |
7947 typedef base::Flags<Flag> Flags; | 7946 typedef base::Flags<Flag> Flags; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8020 static const int kIrregexpLatin1CodeSavedIndex = kDataIndex + 2; | 8019 static const int kIrregexpLatin1CodeSavedIndex = kDataIndex + 2; |
8021 // Saved instance of Irregexp compiled code or bytecode for UC16 that is | 8020 // Saved instance of Irregexp compiled code or bytecode for UC16 that is |
8022 // a potential candidate for flushing. | 8021 // a potential candidate for flushing. |
8023 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3; | 8022 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3; |
8024 | 8023 |
8025 // Maximal number of registers used by either Latin1 or UC16. | 8024 // Maximal number of registers used by either Latin1 or UC16. |
8026 // Only used to check that there is enough stack space | 8025 // Only used to check that there is enough stack space |
8027 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4; | 8026 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4; |
8028 // Number of captures in the compiled regexp. | 8027 // Number of captures in the compiled regexp. |
8029 static const int kIrregexpCaptureCountIndex = kDataIndex + 5; | 8028 static const int kIrregexpCaptureCountIndex = kDataIndex + 5; |
| 8029 // Maps names of named capture groups (at indices 2i) to their corresponding |
| 8030 // capture group indices (at indices 2i + 1). |
| 8031 static const int kIrregexpCaptureNameMapIndex = kDataIndex + 6; |
8030 | 8032 |
8031 static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1; | 8033 static const int kIrregexpDataSize = kIrregexpCaptureNameMapIndex + 1; |
8032 | 8034 |
8033 // Offsets directly into the data fixed array. | 8035 // Offsets directly into the data fixed array. |
8034 static const int kDataTagOffset = | 8036 static const int kDataTagOffset = |
8035 FixedArray::kHeaderSize + kTagIndex * kPointerSize; | 8037 FixedArray::kHeaderSize + kTagIndex * kPointerSize; |
8036 static const int kDataOneByteCodeOffset = | 8038 static const int kDataOneByteCodeOffset = |
8037 FixedArray::kHeaderSize + kIrregexpLatin1CodeIndex * kPointerSize; | 8039 FixedArray::kHeaderSize + kIrregexpLatin1CodeIndex * kPointerSize; |
8038 static const int kDataUC16CodeOffset = | 8040 static const int kDataUC16CodeOffset = |
8039 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; | 8041 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; |
8040 static const int kIrregexpCaptureCountOffset = | 8042 static const int kIrregexpCaptureCountOffset = |
8041 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; | 8043 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; |
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10798 } | 10800 } |
10799 return value; | 10801 return value; |
10800 } | 10802 } |
10801 }; | 10803 }; |
10802 | 10804 |
10803 | 10805 |
10804 } // NOLINT, false-positive due to second-order macros. | 10806 } // NOLINT, false-positive due to second-order macros. |
10805 } // NOLINT, false-positive due to second-order macros. | 10807 } // NOLINT, false-positive due to second-order macros. |
10806 | 10808 |
10807 #endif // V8_OBJECTS_H_ | 10809 #endif // V8_OBJECTS_H_ |
OLD | NEW |