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 6888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6899 }; | 6899 }; |
6900 | 6900 |
6901 class JSPromise; | 6901 class JSPromise; |
6902 | 6902 |
6903 // Struct to hold state required for PromiseReactionJob. | 6903 // Struct to hold state required for PromiseReactionJob. |
6904 class PromiseReactionJobInfo : public Struct { | 6904 class PromiseReactionJobInfo : public Struct { |
6905 public: | 6905 public: |
6906 DECL_ACCESSORS(promise, JSPromise) | 6906 DECL_ACCESSORS(promise, JSPromise) |
6907 DECL_ACCESSORS(value, Object) | 6907 DECL_ACCESSORS(value, Object) |
6908 DECL_ACCESSORS(tasks, Object) | 6908 DECL_ACCESSORS(tasks, Object) |
6909 DECL_ACCESSORS(deferred, Object) | 6909 DECL_ACCESSORS(deferred_promise, Object) |
| 6910 DECL_ACCESSORS(deferred_on_resolve, Object) |
| 6911 DECL_ACCESSORS(deferred_on_reject, Object) |
6910 DECL_ACCESSORS(debug_id, Object) | 6912 DECL_ACCESSORS(debug_id, Object) |
6911 DECL_ACCESSORS(debug_name, Object) | 6913 DECL_ACCESSORS(debug_name, Object) |
6912 DECL_ACCESSORS(context, Context) | 6914 DECL_ACCESSORS(context, Context) |
6913 | 6915 |
6914 static const int kPromiseOffset = Struct::kHeaderSize; | 6916 static const int kPromiseOffset = Struct::kHeaderSize; |
6915 static const int kValueOffset = kPromiseOffset + kPointerSize; | 6917 static const int kValueOffset = kPromiseOffset + kPointerSize; |
6916 static const int kTasksOffset = kValueOffset + kPointerSize; | 6918 static const int kTasksOffset = kValueOffset + kPointerSize; |
6917 static const int kDeferredOffset = kTasksOffset + kPointerSize; | 6919 static const int kDeferredPromiseOffset = kTasksOffset + kPointerSize; |
6918 static const int kDebugIdOffset = kDeferredOffset + kPointerSize; | 6920 static const int kDeferredOnResolveOffset = |
| 6921 kDeferredPromiseOffset + kPointerSize; |
| 6922 static const int kDeferredOnRejectOffset = |
| 6923 kDeferredOnResolveOffset + kPointerSize; |
| 6924 static const int kDebugIdOffset = kDeferredOnRejectOffset + kPointerSize; |
6919 static const int kDebugNameOffset = kDebugIdOffset + kPointerSize; | 6925 static const int kDebugNameOffset = kDebugIdOffset + kPointerSize; |
6920 static const int kContextOffset = kDebugNameOffset + kPointerSize; | 6926 static const int kContextOffset = kDebugNameOffset + kPointerSize; |
6921 static const int kSize = kContextOffset + kPointerSize; | 6927 static const int kSize = kContextOffset + kPointerSize; |
6922 | 6928 |
6923 DECLARE_CAST(PromiseReactionJobInfo) | 6929 DECLARE_CAST(PromiseReactionJobInfo) |
6924 DECLARE_PRINTER(PromiseReactionJobInfo) | 6930 DECLARE_PRINTER(PromiseReactionJobInfo) |
6925 DECLARE_VERIFIER(PromiseReactionJobInfo) | 6931 DECLARE_VERIFIER(PromiseReactionJobInfo) |
6926 | 6932 |
6927 private: | 6933 private: |
6928 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo); | 6934 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo); |
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8955 DECL_ACCESSORS(result, Object) | 8961 DECL_ACCESSORS(result, Object) |
8956 | 8962 |
8957 // There are 3 possible states for these fields -- | 8963 // There are 3 possible states for these fields -- |
8958 // 1) Undefined -- This is the zero state when there is no callback | 8964 // 1) Undefined -- This is the zero state when there is no callback |
8959 // or deferred registered. | 8965 // or deferred registered. |
8960 // 2) Object -- There is a single Callable directly attached to the | 8966 // 2) Object -- There is a single Callable directly attached to the |
8961 // fulfill_reactions, reject_reactions and the deferred JSObject is | 8967 // fulfill_reactions, reject_reactions and the deferred JSObject is |
8962 // directly attached to the deferred field. | 8968 // directly attached to the deferred field. |
8963 // 3) FixedArray -- There is more than one callback and deferred | 8969 // 3) FixedArray -- There is more than one callback and deferred |
8964 // attached to a FixedArray. | 8970 // attached to a FixedArray. |
8965 DECL_ACCESSORS(deferred, Object) | 8971 DECL_ACCESSORS(deferred_promise, Object) |
| 8972 DECL_ACCESSORS(deferred_on_resolve, Object) |
| 8973 DECL_ACCESSORS(deferred_on_reject, Object) |
8966 DECL_ACCESSORS(fulfill_reactions, Object) | 8974 DECL_ACCESSORS(fulfill_reactions, Object) |
8967 DECL_ACCESSORS(reject_reactions, Object) | 8975 DECL_ACCESSORS(reject_reactions, Object) |
8968 | 8976 |
8969 DECL_INT_ACCESSORS(flags) | 8977 DECL_INT_ACCESSORS(flags) |
8970 | 8978 |
8971 // [has_handler]: Whether this promise has a reject handler or not. | 8979 // [has_handler]: Whether this promise has a reject handler or not. |
8972 DECL_BOOLEAN_ACCESSORS(has_handler) | 8980 DECL_BOOLEAN_ACCESSORS(has_handler) |
8973 | 8981 |
8974 static const char* Status(int status); | 8982 static const char* Status(int status); |
8975 | 8983 |
8976 DECLARE_CAST(JSPromise) | 8984 DECLARE_CAST(JSPromise) |
8977 | 8985 |
8978 // Dispatched behavior. | 8986 // Dispatched behavior. |
8979 DECLARE_PRINTER(JSPromise) | 8987 DECLARE_PRINTER(JSPromise) |
8980 DECLARE_VERIFIER(JSPromise) | 8988 DECLARE_VERIFIER(JSPromise) |
8981 | 8989 |
8982 // Layout description. | 8990 // Layout description. |
8983 static const int kStatusOffset = JSObject::kHeaderSize; | 8991 static const int kStatusOffset = JSObject::kHeaderSize; |
8984 static const int kResultOffset = kStatusOffset + kPointerSize; | 8992 static const int kResultOffset = kStatusOffset + kPointerSize; |
8985 static const int kDeferredOffset = kResultOffset + kPointerSize; | 8993 static const int kDeferredPromiseOffset = kResultOffset + kPointerSize; |
8986 static const int kFulfillReactionsOffset = kDeferredOffset + kPointerSize; | 8994 static const int kDeferredOnResolveOffset = |
| 8995 kDeferredPromiseOffset + kPointerSize; |
| 8996 static const int kDeferredOnRejectOffset = |
| 8997 kDeferredOnResolveOffset + kPointerSize; |
| 8998 static const int kFulfillReactionsOffset = |
| 8999 kDeferredOnRejectOffset + kPointerSize; |
8987 static const int kRejectReactionsOffset = | 9000 static const int kRejectReactionsOffset = |
8988 kFulfillReactionsOffset + kPointerSize; | 9001 kFulfillReactionsOffset + kPointerSize; |
8989 static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize; | 9002 static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize; |
8990 static const int kSize = kFlagsOffset + kPointerSize; | 9003 static const int kSize = kFlagsOffset + kPointerSize; |
8991 | 9004 |
8992 // Flags layout. | 9005 // Flags layout. |
8993 static const int kHasHandlerBit = 0; | 9006 static const int kHasHandlerBit = 0; |
8994 }; | 9007 }; |
8995 | 9008 |
8996 // Regular expressions | 9009 // Regular expressions |
(...skipping 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12022 } | 12035 } |
12023 return value; | 12036 return value; |
12024 } | 12037 } |
12025 }; | 12038 }; |
12026 | 12039 |
12027 | 12040 |
12028 } // NOLINT, false-positive due to second-order macros. | 12041 } // NOLINT, false-positive due to second-order macros. |
12029 } // NOLINT, false-positive due to second-order macros. | 12042 } // NOLINT, false-positive due to second-order macros. |
12030 | 12043 |
12031 #endif // V8_OBJECTS_H_ | 12044 #endif // V8_OBJECTS_H_ |
OLD | NEW |