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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 bool IsFull(); | 3045 bool IsFull(); |
3046 DECLARE_CAST(ArrayList) | 3046 DECLARE_CAST(ArrayList) |
3047 | 3047 |
3048 private: | 3048 private: |
3049 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); | 3049 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); |
3050 static const int kLengthIndex = 0; | 3050 static const int kLengthIndex = 0; |
3051 static const int kFirstIndex = 1; | 3051 static const int kFirstIndex = 1; |
3052 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); | 3052 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); |
3053 }; | 3053 }; |
3054 | 3054 |
3055 // The property RegExpMatchInfo includes the matchIndices | |
3056 // array of the last successful regexp match (an array of start/end index | |
3057 // pairs for the match and all the captured substrings), the invariant is | |
3058 // that there are at least two capture indices. The array also contains | |
3059 // the subject string for the last successful match. | |
3060 // After creation the result must be treated as a FixedArray in all regards. | |
3061 class V8_EXPORT_PRIVATE RegExpMatchInfo : NON_EXPORTED_BASE(public FixedArray) { | |
3062 public: | |
3063 // Returns the number of captures, which is defined as the length of the | |
3064 // matchIndices objects of the last match. matchIndices contains two indices | |
3065 // for each capture (including the match itself), i.e. 2 * #captures + 2. | |
3066 inline int NumberOfCaptureRegisters(); | |
3067 inline void SetNumberOfCaptureRegisters(int value); | |
3068 | |
3069 // Returns the subject string of the last match. | |
3070 inline String* LastSubject(); | |
3071 inline void SetLastSubject(String* value); | |
3072 | |
3073 // Like LastSubject, but modifiable by the user. | |
3074 inline Object* LastInput(); | |
3075 inline void SetLastInput(Object* value); | |
3076 | |
3077 // Returns the i'th capture index, 0 <= i < NumberOfCaptures(). Capture(0) and | |
3078 // Capture(1) determine the start- and endpoint of the match itself. | |
3079 inline int Capture(int i); | |
3080 inline void SetCapture(int i, int value); | |
3081 | |
3082 // Reserves space for captures. | |
3083 static Handle<RegExpMatchInfo> ReserveCaptures( | |
3084 Handle<RegExpMatchInfo> match_info, int capture_count); | |
3085 | |
3086 DECLARE_CAST(RegExpMatchInfo) | |
3087 | |
3088 static const int kNumberOfCapturesIndex = 0; | |
3089 static const int kLastSubjectIndex = 1; | |
3090 static const int kLastInputIndex = 2; | |
3091 static const int kFirstCaptureIndex = 3; | |
3092 static const int kLastMatchOverhead = kFirstCaptureIndex; | |
3093 | |
3094 static const int kNumberOfCapturesOffset = FixedArray::kHeaderSize; | |
3095 static const int kLastSubjectOffset = kNumberOfCapturesOffset + kPointerSize; | |
3096 static const int kLastInputOffset = kLastSubjectOffset + kPointerSize; | |
3097 static const int kFirstCaptureOffset = kLastInputOffset + kPointerSize; | |
3098 | |
3099 // Every match info is guaranteed to have enough space to store two captures. | |
3100 static const int kInitialCaptureIndices = 2; | |
3101 | |
3102 private: | |
3103 DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMatchInfo); | |
3104 }; | |
3105 | |
3106 #define FRAME_ARRAY_FIELD_LIST(V) \ | 3055 #define FRAME_ARRAY_FIELD_LIST(V) \ |
3107 V(WasmInstance, Object) \ | 3056 V(WasmInstance, Object) \ |
3108 V(WasmFunctionIndex, Smi) \ | 3057 V(WasmFunctionIndex, Smi) \ |
3109 V(Receiver, Object) \ | 3058 V(Receiver, Object) \ |
3110 V(Function, JSFunction) \ | 3059 V(Function, JSFunction) \ |
3111 V(Code, AbstractCode) \ | 3060 V(Code, AbstractCode) \ |
3112 V(Offset, Smi) \ | 3061 V(Offset, Smi) \ |
3113 V(Flags, Smi) | 3062 V(Flags, Smi) |
3114 | 3063 |
3115 // Container object for data collected during simple stack trace captures. | 3064 // Container object for data collected during simple stack trace captures. |
(...skipping 8534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11650 } | 11599 } |
11651 }; | 11600 }; |
11652 | 11601 |
11653 | 11602 |
11654 } // NOLINT, false-positive due to second-order macros. | 11603 } // NOLINT, false-positive due to second-order macros. |
11655 } // NOLINT, false-positive due to second-order macros. | 11604 } // NOLINT, false-positive due to second-order macros. |
11656 | 11605 |
11657 #include "src/objects/object-macros-undef.h" | 11606 #include "src/objects/object-macros-undef.h" |
11658 | 11607 |
11659 #endif // V8_OBJECTS_H_ | 11608 #endif // V8_OBJECTS_H_ |
OLD | NEW |