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