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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 V(TypeFeedbackMetadata) \ | 997 V(TypeFeedbackMetadata) \ |
998 V(TypeFeedbackVector) \ | 998 V(TypeFeedbackVector) \ |
999 V(DeoptimizationInputData) \ | 999 V(DeoptimizationInputData) \ |
1000 V(DeoptimizationOutputData) \ | 1000 V(DeoptimizationOutputData) \ |
1001 V(DependentCode) \ | 1001 V(DependentCode) \ |
1002 V(HandlerTable) \ | 1002 V(HandlerTable) \ |
1003 V(FixedArray) \ | 1003 V(FixedArray) \ |
1004 V(FixedDoubleArray) \ | 1004 V(FixedDoubleArray) \ |
1005 V(WeakFixedArray) \ | 1005 V(WeakFixedArray) \ |
1006 V(ArrayList) \ | 1006 V(ArrayList) \ |
| 1007 V(RegExpMatchInfo) \ |
1007 V(Context) \ | 1008 V(Context) \ |
1008 V(ScriptContextTable) \ | 1009 V(ScriptContextTable) \ |
1009 V(NativeContext) \ | 1010 V(NativeContext) \ |
1010 V(ScopeInfo) \ | 1011 V(ScopeInfo) \ |
1011 V(ModuleInfoEntry) \ | 1012 V(ModuleInfoEntry) \ |
1012 V(ModuleInfo) \ | 1013 V(ModuleInfo) \ |
1013 V(JSBoundFunction) \ | 1014 V(JSBoundFunction) \ |
1014 V(JSFunction) \ | 1015 V(JSFunction) \ |
1015 V(Code) \ | 1016 V(Code) \ |
1016 V(AbstractCode) \ | 1017 V(AbstractCode) \ |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 bool IsFull(); | 2958 bool IsFull(); |
2958 DECLARE_CAST(ArrayList) | 2959 DECLARE_CAST(ArrayList) |
2959 | 2960 |
2960 private: | 2961 private: |
2961 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); | 2962 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); |
2962 static const int kLengthIndex = 0; | 2963 static const int kLengthIndex = 0; |
2963 static const int kFirstIndex = 1; | 2964 static const int kFirstIndex = 1; |
2964 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); | 2965 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); |
2965 }; | 2966 }; |
2966 | 2967 |
| 2968 // The property RegExpMatchInfo includes the matchIndices |
| 2969 // array of the last successful regexp match (an array of start/end index |
| 2970 // pairs for the match and all the captured substrings), the invariant is |
| 2971 // that there are at least two capture indices. The array also contains |
| 2972 // the subject string for the last successful match. |
| 2973 // After creation the result must be treated as a FixedArray in all regards. |
| 2974 class RegExpMatchInfo : public FixedArray { |
| 2975 public: |
| 2976 // Returns the number of captures, which is defined as the length of the |
| 2977 // matchIndices objects of the last match. matchIndices contains two indices |
| 2978 // for each capture (including the match itself), i.e. 2 * #captures + 2. |
| 2979 inline int NumberOfCaptureRegisters(); |
| 2980 inline void SetNumberOfCaptureRegisters(int value); |
| 2981 |
| 2982 // Returns the subject string of the last match. |
| 2983 inline String* LastSubject(); |
| 2984 inline void SetLastSubject(String* value); |
| 2985 |
| 2986 // Like LastSubject, but modifiable by the user. |
| 2987 inline Object* LastInput(); |
| 2988 inline void SetLastInput(Object* value); |
| 2989 |
| 2990 // Returns the i'th capture index, 0 <= i < NumberOfCaptures(). Capture(0) and |
| 2991 // Capture(1) determine the start- and endpoint of the match itself. |
| 2992 inline int Capture(int i); |
| 2993 inline void SetCapture(int i, int value); |
| 2994 |
| 2995 // Reserves space for captures. |
| 2996 static Handle<RegExpMatchInfo> ReserveCaptures( |
| 2997 Handle<RegExpMatchInfo> match_info, int capture_count); |
| 2998 |
| 2999 DECLARE_CAST(RegExpMatchInfo) |
| 3000 |
| 3001 static const int kNumberOfCapturesIndex = 0; |
| 3002 static const int kLastSubjectIndex = 1; |
| 3003 static const int kLastInputIndex = 2; |
| 3004 static const int kFirstCaptureIndex = 3; |
| 3005 static const int kLastMatchOverhead = kFirstCaptureIndex; |
| 3006 |
| 3007 static const int kNumberOfCapturesOffset = FixedArray::kHeaderSize; |
| 3008 static const int kLastSubjectOffset = kNumberOfCapturesOffset + kPointerSize; |
| 3009 static const int kLastInputOffset = kLastSubjectOffset + kPointerSize; |
| 3010 static const int kFirstCaptureOffset = kLastInputOffset + kPointerSize; |
| 3011 |
| 3012 // Every match info is guaranteed to have enough space to store two captures. |
| 3013 static const int kInitialCaptureIndices = 2; |
| 3014 |
| 3015 private: |
| 3016 DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMatchInfo); |
| 3017 }; |
| 3018 |
2967 #define FRAME_ARRAY_FIELD_LIST(V) \ | 3019 #define FRAME_ARRAY_FIELD_LIST(V) \ |
2968 V(WasmObject, Object) \ | 3020 V(WasmObject, Object) \ |
2969 V(WasmFunctionIndex, Smi) \ | 3021 V(WasmFunctionIndex, Smi) \ |
2970 V(Receiver, Object) \ | 3022 V(Receiver, Object) \ |
2971 V(Function, JSFunction) \ | 3023 V(Function, JSFunction) \ |
2972 V(Code, AbstractCode) \ | 3024 V(Code, AbstractCode) \ |
2973 V(Offset, Smi) \ | 3025 V(Offset, Smi) \ |
2974 V(Flags, Smi) | 3026 V(Flags, Smi) |
2975 | 3027 |
2976 // Container object for data collected during simple stack trace captures. | 3028 // Container object for data collected during simple stack trace captures. |
(...skipping 8578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11555 } | 11607 } |
11556 return value; | 11608 return value; |
11557 } | 11609 } |
11558 }; | 11610 }; |
11559 | 11611 |
11560 | 11612 |
11561 } // NOLINT, false-positive due to second-order macros. | 11613 } // NOLINT, false-positive due to second-order macros. |
11562 } // NOLINT, false-positive due to second-order macros. | 11614 } // NOLINT, false-positive due to second-order macros. |
11563 | 11615 |
11564 #endif // V8_OBJECTS_H_ | 11616 #endif // V8_OBJECTS_H_ |
OLD | NEW |