OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 // - ExternalTwoByteInternalizedString | 124 // - ExternalTwoByteInternalizedString |
125 // - Symbol | 125 // - Symbol |
126 // - HeapNumber | 126 // - HeapNumber |
127 // - Cell | 127 // - Cell |
128 // - PropertyCell | 128 // - PropertyCell |
129 // - Code | 129 // - Code |
130 // - Map | 130 // - Map |
131 // - Oddball | 131 // - Oddball |
132 // - Foreign | 132 // - Foreign |
133 // - SharedFunctionInfo | 133 // - SharedFunctionInfo |
134 // - OptimizedCodeEntry | |
134 // - Struct | 135 // - Struct |
135 // - Box | 136 // - Box |
136 // - DeclaredAccessorDescriptor | 137 // - DeclaredAccessorDescriptor |
137 // - AccessorInfo | 138 // - AccessorInfo |
138 // - DeclaredAccessorInfo | 139 // - DeclaredAccessorInfo |
139 // - ExecutableAccessorInfo | 140 // - ExecutableAccessorInfo |
140 // - AccessorPair | 141 // - AccessorPair |
141 // - AccessCheckInfo | 142 // - AccessCheckInfo |
142 // - InterceptorInfo | 143 // - InterceptorInfo |
143 // - CallHandlerInfo | 144 // - CallHandlerInfo |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 V(SCRIPT_TYPE) \ | 400 V(SCRIPT_TYPE) \ |
400 V(CODE_CACHE_TYPE) \ | 401 V(CODE_CACHE_TYPE) \ |
401 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 402 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
402 V(TYPE_FEEDBACK_INFO_TYPE) \ | 403 V(TYPE_FEEDBACK_INFO_TYPE) \ |
403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 404 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
404 V(BOX_TYPE) \ | 405 V(BOX_TYPE) \ |
405 \ | 406 \ |
406 V(FIXED_ARRAY_TYPE) \ | 407 V(FIXED_ARRAY_TYPE) \ |
407 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 408 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
408 V(SHARED_FUNCTION_INFO_TYPE) \ | 409 V(SHARED_FUNCTION_INFO_TYPE) \ |
410 V(OPTIMIZED_CODE_ENTRY_TYPE) \ | |
409 \ | 411 \ |
410 V(JS_MESSAGE_OBJECT_TYPE) \ | 412 V(JS_MESSAGE_OBJECT_TYPE) \ |
411 \ | 413 \ |
412 V(JS_VALUE_TYPE) \ | 414 V(JS_VALUE_TYPE) \ |
413 V(JS_DATE_TYPE) \ | 415 V(JS_DATE_TYPE) \ |
414 V(JS_OBJECT_TYPE) \ | 416 V(JS_OBJECT_TYPE) \ |
415 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 417 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
416 V(JS_GENERATOR_OBJECT_TYPE) \ | 418 V(JS_GENERATOR_OBJECT_TYPE) \ |
417 V(JS_MODULE_TYPE) \ | 419 V(JS_MODULE_TYPE) \ |
418 V(JS_GLOBAL_OBJECT_TYPE) \ | 420 V(JS_GLOBAL_OBJECT_TYPE) \ |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 BOX_TYPE, | 751 BOX_TYPE, |
750 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT | 752 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
751 // is defined. However as include/v8.h contain some of the instance type | 753 // is defined. However as include/v8.h contain some of the instance type |
752 // constants always having them avoids them getting different numbers | 754 // constants always having them avoids them getting different numbers |
753 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. | 755 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. |
754 DEBUG_INFO_TYPE, | 756 DEBUG_INFO_TYPE, |
755 BREAK_POINT_INFO_TYPE, | 757 BREAK_POINT_INFO_TYPE, |
756 | 758 |
757 FIXED_ARRAY_TYPE, | 759 FIXED_ARRAY_TYPE, |
758 SHARED_FUNCTION_INFO_TYPE, | 760 SHARED_FUNCTION_INFO_TYPE, |
761 OPTIMIZED_CODE_ENTRY_TYPE, | |
759 | 762 |
760 JS_MESSAGE_OBJECT_TYPE, | 763 JS_MESSAGE_OBJECT_TYPE, |
761 | 764 |
762 // All the following types are subtypes of JSReceiver, which corresponds to | 765 // All the following types are subtypes of JSReceiver, which corresponds to |
763 // objects in the JS sense. The first and the last type in this range are | 766 // objects in the JS sense. The first and the last type in this range are |
764 // the two forms of function. This organization enables using the same | 767 // the two forms of function. This organization enables using the same |
765 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 768 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
766 // NONCALLABLE_JS_OBJECT range. | 769 // NONCALLABLE_JS_OBJECT range. |
767 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 770 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE |
768 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 771 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 V(TypeFeedbackCells) \ | 1013 V(TypeFeedbackCells) \ |
1011 V(FixedArray) \ | 1014 V(FixedArray) \ |
1012 V(FixedDoubleArray) \ | 1015 V(FixedDoubleArray) \ |
1013 V(Context) \ | 1016 V(Context) \ |
1014 V(NativeContext) \ | 1017 V(NativeContext) \ |
1015 V(ScopeInfo) \ | 1018 V(ScopeInfo) \ |
1016 V(JSFunction) \ | 1019 V(JSFunction) \ |
1017 V(Code) \ | 1020 V(Code) \ |
1018 V(Oddball) \ | 1021 V(Oddball) \ |
1019 V(SharedFunctionInfo) \ | 1022 V(SharedFunctionInfo) \ |
1023 V(OptimizedCodeEntry) \ | |
1020 V(JSValue) \ | 1024 V(JSValue) \ |
1021 V(JSDate) \ | 1025 V(JSDate) \ |
1022 V(JSMessageObject) \ | 1026 V(JSMessageObject) \ |
1023 V(StringWrapper) \ | 1027 V(StringWrapper) \ |
1024 V(Foreign) \ | 1028 V(Foreign) \ |
1025 V(Boolean) \ | 1029 V(Boolean) \ |
1026 V(JSArray) \ | 1030 V(JSArray) \ |
1027 V(JSArrayBuffer) \ | 1031 V(JSArrayBuffer) \ |
1028 V(JSArrayBufferView) \ | 1032 V(JSArrayBufferView) \ |
1029 V(JSTypedArray) \ | 1033 V(JSTypedArray) \ |
(...skipping 5805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6835 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); | 6839 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); |
6836 #else | 6840 #else |
6837 #error Unknown byte ordering | 6841 #error Unknown byte ordering |
6838 #endif | 6842 #endif |
6839 | 6843 |
6840 private: | 6844 private: |
6841 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 6845 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
6842 }; | 6846 }; |
6843 | 6847 |
6844 | 6848 |
6849 // An optimized code entry represents an association between the native | |
6850 // context, a function, optimized code, and the literals. The entries | |
6851 // are linked into two lists for efficient lookup: by native context | |
6852 // (linked through next_by_native_context), or by shared function | |
6853 // info (linked through next_by_shared_info). | |
6854 // The references to the native context, function, and code are weak, | |
6855 // in order not to leak native contexts or functions through | |
6856 // SharedFunctionInfo. This means an entry can become "dead" through GC. | |
6857 // Entries are cleaned up lazily as each list is traversed. | |
Michael Starzinger
2013/08/28 14:59:47
nit: s/cleaned up/removed from the list/ IIUC?
| |
6858 class OptimizedCodeEntry: public HeapObject { | |
6859 public: | |
6860 // [native_context]: The native context of this entry. (WEAK) | |
6861 DECL_ACCESSORS(native_context, Context) | |
6862 | |
6863 // [function]: The JSFunction of this entry. (WEAK) | |
6864 DECL_ACCESSORS(function, JSFunction) | |
6865 | |
6866 // [code]: The optimized code of this entry. (WEAK) | |
6867 DECL_ACCESSORS(code, Code) | |
6868 | |
6869 // [literals]: Array of literals for this entry. | |
6870 DECL_ACCESSORS(literals, FixedArray) | |
6871 | |
6872 // [next_by_shared_info]: The next link in the list, when traversing | |
6873 // starting with a SharedFunctionInfo. (NULL if none). | |
6874 DECL_ACCESSORS(next_by_shared_info, OptimizedCodeEntry) | |
6875 | |
6876 // [next_by_native_context]: The next link in the list, when traversing | |
6877 // starting with a native context. (NULL if none) | |
6878 DECL_ACCESSORS(next_by_native_context, OptimizedCodeEntry) | |
6879 | |
6880 // Casting. | |
6881 static inline OptimizedCodeEntry* cast(Object* obj); | |
6882 | |
6883 DECLARE_PRINTER(OptimizedCodeEntry) | |
6884 DECLARE_VERIFIER(OptimizedCodeEntry) | |
6885 | |
6886 // Layout description. | |
6887 static const int kNativeContextOffset = JSObject::kHeaderSize; | |
6888 static const int kFunctionOffset = kNativeContextOffset + kPointerSize; | |
6889 static const int kCodeOffset = kFunctionOffset + kPointerSize; | |
6890 static const int kLiteralsOffset = kCodeOffset + kPointerSize; | |
6891 static const int kNextBySharedInfoOffset = | |
6892 kLiteralsOffset + kPointerSize; | |
6893 static const int kNextByNativeContextOffset = | |
6894 kNextBySharedInfoOffset + kPointerSize; | |
6895 static const int kCacheableOffset = kNextByNativeContextOffset + kPointerSize; | |
6896 static const int kSize = kCacheableOffset + kIntSize; | |
6897 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kSize); | |
6898 | |
6899 typedef FixedBodyDescriptor<kLiteralsOffset, | |
6900 kNextByNativeContextOffset + kPointerSize, | |
6901 kSize> BodyDescriptor; | |
6902 | |
6903 // Kills an entry, nulling out its references to native context, function, | |
6904 // and code. | |
Michael Starzinger
2013/08/28 14:59:47
nit: ... and literals.
| |
6905 void Kill(); | |
6906 inline bool cacheable(); | |
6907 inline void set_cacheable(bool val); | |
6908 | |
6909 private: | |
6910 // Used internally during traversal to skip dead entries. | |
6911 inline bool IsDead() { | |
6912 return function() == NULL || code() == NULL; | |
6913 } | |
6914 | |
6915 DISALLOW_IMPLICIT_CONSTRUCTORS(OptimizedCodeEntry); | |
6916 }; | |
6917 | |
6918 | |
6845 class JSGeneratorObject: public JSObject { | 6919 class JSGeneratorObject: public JSObject { |
6846 public: | 6920 public: |
6847 // [function]: The function corresponding to this generator object. | 6921 // [function]: The function corresponding to this generator object. |
6848 DECL_ACCESSORS(function, JSFunction) | 6922 DECL_ACCESSORS(function, JSFunction) |
6849 | 6923 |
6850 // [context]: The context of the suspended computation. | 6924 // [context]: The context of the suspended computation. |
6851 DECL_ACCESSORS(context, Context) | 6925 DECL_ACCESSORS(context, Context) |
6852 | 6926 |
6853 // [receiver]: The receiver of the suspended computation. | 6927 // [receiver]: The receiver of the suspended computation. |
6854 DECL_ACCESSORS(receiver, Object) | 6928 DECL_ACCESSORS(receiver, Object) |
(...skipping 3351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10206 } else { | 10280 } else { |
10207 value &= ~(1 << bit_position); | 10281 value &= ~(1 << bit_position); |
10208 } | 10282 } |
10209 return value; | 10283 return value; |
10210 } | 10284 } |
10211 }; | 10285 }; |
10212 | 10286 |
10213 } } // namespace v8::internal | 10287 } } // namespace v8::internal |
10214 | 10288 |
10215 #endif // V8_OBJECTS_H_ | 10289 #endif // V8_OBJECTS_H_ |
OLD | NEW |