Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: src/objects.h

Issue 2050343002: [regexp] Experimental support for regexp named captures (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: static_cast<int> Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7924 matching lines...) Expand 10 before | Expand all | Expand 10 after
7935 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi 7935 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi
7936 // used for tracking the last usage (used for code flushing).. 7936 // used for tracking the last usage (used for code flushing)..
7937 // - max number of registers used by irregexp implementations. 7937 // - max number of registers used by irregexp implementations.
7938 // - number of capture registers (output values) of the regexp. 7938 // - number of capture registers (output values) of the regexp.
7939 class JSRegExp: public JSObject { 7939 class JSRegExp: public JSObject {
7940 public: 7940 public:
7941 // Meaning of Type: 7941 // Meaning of Type:
7942 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. 7942 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet.
7943 // ATOM: A simple string to match against using an indexOf operation. 7943 // ATOM: A simple string to match against using an indexOf operation.
7944 // IRREGEXP: Compiled with Irregexp. 7944 // IRREGEXP: Compiled with Irregexp.
7945 // IRREGEXP_NATIVE: Compiled to native code with Irregexp.
7946 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; 7945 enum Type { NOT_COMPILED, ATOM, IRREGEXP };
7947 enum Flag { 7946 enum Flag {
7948 kNone = 0, 7947 kNone = 0,
7949 kGlobal = 1 << 0, 7948 kGlobal = 1 << 0,
7950 kIgnoreCase = 1 << 1, 7949 kIgnoreCase = 1 << 1,
7951 kMultiline = 1 << 2, 7950 kMultiline = 1 << 2,
7952 kSticky = 1 << 3, 7951 kSticky = 1 << 3,
7953 kUnicode = 1 << 4, 7952 kUnicode = 1 << 4,
7954 }; 7953 };
7955 typedef base::Flags<Flag> Flags; 7954 typedef base::Flags<Flag> Flags;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
8028 static const int kIrregexpLatin1CodeSavedIndex = kDataIndex + 2; 8027 static const int kIrregexpLatin1CodeSavedIndex = kDataIndex + 2;
8029 // Saved instance of Irregexp compiled code or bytecode for UC16 that is 8028 // Saved instance of Irregexp compiled code or bytecode for UC16 that is
8030 // a potential candidate for flushing. 8029 // a potential candidate for flushing.
8031 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3; 8030 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3;
8032 8031
8033 // Maximal number of registers used by either Latin1 or UC16. 8032 // Maximal number of registers used by either Latin1 or UC16.
8034 // Only used to check that there is enough stack space 8033 // Only used to check that there is enough stack space
8035 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4; 8034 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4;
8036 // Number of captures in the compiled regexp. 8035 // Number of captures in the compiled regexp.
8037 static const int kIrregexpCaptureCountIndex = kDataIndex + 5; 8036 static const int kIrregexpCaptureCountIndex = kDataIndex + 5;
8037 // Maps names of named capture groups (at indices 2i) to their corresponding
8038 // capture group indices (at indices 2i + 1).
8039 static const int kIrregexpCaptureNameMapIndex = kDataIndex + 6;
8038 8040
8039 static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1; 8041 static const int kIrregexpDataSize = kIrregexpCaptureNameMapIndex + 1;
8040 8042
8041 // Offsets directly into the data fixed array. 8043 // Offsets directly into the data fixed array.
8042 static const int kDataTagOffset = 8044 static const int kDataTagOffset =
8043 FixedArray::kHeaderSize + kTagIndex * kPointerSize; 8045 FixedArray::kHeaderSize + kTagIndex * kPointerSize;
8044 static const int kDataOneByteCodeOffset = 8046 static const int kDataOneByteCodeOffset =
8045 FixedArray::kHeaderSize + kIrregexpLatin1CodeIndex * kPointerSize; 8047 FixedArray::kHeaderSize + kIrregexpLatin1CodeIndex * kPointerSize;
8046 static const int kDataUC16CodeOffset = 8048 static const int kDataUC16CodeOffset =
8047 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; 8049 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize;
8048 static const int kIrregexpCaptureCountOffset = 8050 static const int kIrregexpCaptureCountOffset =
8049 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; 8051 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize;
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after
10806 } 10808 }
10807 return value; 10809 return value;
10808 } 10810 }
10809 }; 10811 };
10810 10812
10811 10813
10812 } // NOLINT, false-positive due to second-order macros. 10814 } // NOLINT, false-positive due to second-order macros.
10813 } // NOLINT, false-positive due to second-order macros. 10815 } // NOLINT, false-positive due to second-order macros.
10814 10816
10815 #endif // V8_OBJECTS_H_ 10817 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698