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 8877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8888 static const int kStackFramesOffset = kScriptOffset + kPointerSize; | 8888 static const int kStackFramesOffset = kScriptOffset + kPointerSize; |
8889 static const int kStartPositionOffset = kStackFramesOffset + kPointerSize; | 8889 static const int kStartPositionOffset = kStackFramesOffset + kPointerSize; |
8890 static const int kEndPositionOffset = kStartPositionOffset + kPointerSize; | 8890 static const int kEndPositionOffset = kStartPositionOffset + kPointerSize; |
8891 static const int kSize = kEndPositionOffset + kPointerSize; | 8891 static const int kSize = kEndPositionOffset + kPointerSize; |
8892 | 8892 |
8893 typedef FixedBodyDescriptor<HeapObject::kMapOffset, | 8893 typedef FixedBodyDescriptor<HeapObject::kMapOffset, |
8894 kStackFramesOffset + kPointerSize, | 8894 kStackFramesOffset + kPointerSize, |
8895 kSize> BodyDescriptor; | 8895 kSize> BodyDescriptor; |
8896 }; | 8896 }; |
8897 | 8897 |
| 8898 class JSPromise : public JSObject { |
| 8899 public: |
| 8900 DECL_INT_ACCESSORS(status) |
| 8901 DECL_ACCESSORS(result, Object) |
| 8902 |
| 8903 // There are 3 possible states for these fields -- |
| 8904 // 1) Undefined -- This is the zero state when there is no callback |
| 8905 // or deferred registered. |
| 8906 // 2) Object -- There is a single Callable directly attached to the |
| 8907 // fulfill_reactions, reject_reactions and the deferred JSObject is |
| 8908 // directly attached to the deferred field. |
| 8909 // 3) FixedArray -- There is more than one callback and deferred |
| 8910 // attached to a FixedArray. |
| 8911 DECL_ACCESSORS(deferred, Object) |
| 8912 DECL_ACCESSORS(fulfill_reactions, Object) |
| 8913 DECL_ACCESSORS(reject_reactions, Object) |
| 8914 |
| 8915 static const char* Status(int status); |
| 8916 |
| 8917 DECLARE_CAST(JSPromise) |
| 8918 |
| 8919 // Dispatched behavior. |
| 8920 DECLARE_PRINTER(JSPromise) |
| 8921 DECLARE_VERIFIER(JSPromise) |
| 8922 |
| 8923 // Layout description. |
| 8924 static const int kStatusOffset = JSObject::kHeaderSize; |
| 8925 static const int kResultOffset = kStatusOffset + kPointerSize; |
| 8926 static const int kDeferredOffset = kResultOffset + kPointerSize; |
| 8927 static const int kFulfillReactionsOffset = kDeferredOffset + kPointerSize; |
| 8928 static const int kRejectReactionsOffset = |
| 8929 kFulfillReactionsOffset + kPointerSize; |
| 8930 static const int kSize = kRejectReactionsOffset + kPointerSize; |
| 8931 }; |
| 8932 |
8898 // Regular expressions | 8933 // Regular expressions |
8899 // The regular expression holds a single reference to a FixedArray in | 8934 // The regular expression holds a single reference to a FixedArray in |
8900 // the kDataOffset field. | 8935 // the kDataOffset field. |
8901 // The FixedArray contains the following data: | 8936 // The FixedArray contains the following data: |
8902 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) | 8937 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) |
8903 // - reference to the original source string | 8938 // - reference to the original source string |
8904 // - reference to the original flag string | 8939 // - reference to the original flag string |
8905 // If it is an atom regexp | 8940 // If it is an atom regexp |
8906 // - a reference to a literal string to search for | 8941 // - a reference to a literal string to search for |
8907 // If it is an irregexp regexp: | 8942 // If it is an irregexp regexp: |
(...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11953 } | 11988 } |
11954 return value; | 11989 return value; |
11955 } | 11990 } |
11956 }; | 11991 }; |
11957 | 11992 |
11958 | 11993 |
11959 } // NOLINT, false-positive due to second-order macros. | 11994 } // NOLINT, false-positive due to second-order macros. |
11960 } // NOLINT, false-positive due to second-order macros. | 11995 } // NOLINT, false-positive due to second-order macros. |
11961 | 11996 |
11962 #endif // V8_OBJECTS_H_ | 11997 #endif // V8_OBJECTS_H_ |
OLD | NEW |