Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: src/objects.h

Issue 23584004: Remove OptimizedCodeEntry *sigh*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
135 // - Struct 134 // - Struct
136 // - Box 135 // - Box
137 // - DeclaredAccessorDescriptor 136 // - DeclaredAccessorDescriptor
138 // - AccessorInfo 137 // - AccessorInfo
139 // - DeclaredAccessorInfo 138 // - DeclaredAccessorInfo
140 // - ExecutableAccessorInfo 139 // - ExecutableAccessorInfo
141 // - AccessorPair 140 // - AccessorPair
142 // - AccessCheckInfo 141 // - AccessCheckInfo
143 // - InterceptorInfo 142 // - InterceptorInfo
144 // - CallHandlerInfo 143 // - CallHandlerInfo
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 V(SCRIPT_TYPE) \ 399 V(SCRIPT_TYPE) \
401 V(CODE_CACHE_TYPE) \ 400 V(CODE_CACHE_TYPE) \
402 V(POLYMORPHIC_CODE_CACHE_TYPE) \ 401 V(POLYMORPHIC_CODE_CACHE_TYPE) \
403 V(TYPE_FEEDBACK_INFO_TYPE) \ 402 V(TYPE_FEEDBACK_INFO_TYPE) \
404 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ 403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
405 V(BOX_TYPE) \ 404 V(BOX_TYPE) \
406 \ 405 \
407 V(FIXED_ARRAY_TYPE) \ 406 V(FIXED_ARRAY_TYPE) \
408 V(FIXED_DOUBLE_ARRAY_TYPE) \ 407 V(FIXED_DOUBLE_ARRAY_TYPE) \
409 V(SHARED_FUNCTION_INFO_TYPE) \ 408 V(SHARED_FUNCTION_INFO_TYPE) \
410 V(OPTIMIZED_CODE_ENTRY_TYPE) \
411 \ 409 \
412 V(JS_MESSAGE_OBJECT_TYPE) \ 410 V(JS_MESSAGE_OBJECT_TYPE) \
413 \ 411 \
414 V(JS_VALUE_TYPE) \ 412 V(JS_VALUE_TYPE) \
415 V(JS_DATE_TYPE) \ 413 V(JS_DATE_TYPE) \
416 V(JS_OBJECT_TYPE) \ 414 V(JS_OBJECT_TYPE) \
417 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 415 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
418 V(JS_GENERATOR_OBJECT_TYPE) \ 416 V(JS_GENERATOR_OBJECT_TYPE) \
419 V(JS_MODULE_TYPE) \ 417 V(JS_MODULE_TYPE) \
420 V(JS_GLOBAL_OBJECT_TYPE) \ 418 V(JS_GLOBAL_OBJECT_TYPE) \
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 BOX_TYPE, 749 BOX_TYPE,
752 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT 750 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT
753 // is defined. However as include/v8.h contain some of the instance type 751 // is defined. However as include/v8.h contain some of the instance type
754 // constants always having them avoids them getting different numbers 752 // constants always having them avoids them getting different numbers
755 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. 753 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not.
756 DEBUG_INFO_TYPE, 754 DEBUG_INFO_TYPE,
757 BREAK_POINT_INFO_TYPE, 755 BREAK_POINT_INFO_TYPE,
758 756
759 FIXED_ARRAY_TYPE, 757 FIXED_ARRAY_TYPE,
760 SHARED_FUNCTION_INFO_TYPE, 758 SHARED_FUNCTION_INFO_TYPE,
761 OPTIMIZED_CODE_ENTRY_TYPE,
762 759
763 JS_MESSAGE_OBJECT_TYPE, 760 JS_MESSAGE_OBJECT_TYPE,
764 761
765 // All the following types are subtypes of JSReceiver, which corresponds to 762 // All the following types are subtypes of JSReceiver, which corresponds to
766 // objects in the JS sense. The first and the last type in this range are 763 // objects in the JS sense. The first and the last type in this range are
767 // the two forms of function. This organization enables using the same 764 // the two forms of function. This organization enables using the same
768 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the 765 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the
769 // NONCALLABLE_JS_OBJECT range. 766 // NONCALLABLE_JS_OBJECT range.
770 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE 767 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE
771 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE 768 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 V(TypeFeedbackCells) \ 1010 V(TypeFeedbackCells) \
1014 V(FixedArray) \ 1011 V(FixedArray) \
1015 V(FixedDoubleArray) \ 1012 V(FixedDoubleArray) \
1016 V(Context) \ 1013 V(Context) \
1017 V(NativeContext) \ 1014 V(NativeContext) \
1018 V(ScopeInfo) \ 1015 V(ScopeInfo) \
1019 V(JSFunction) \ 1016 V(JSFunction) \
1020 V(Code) \ 1017 V(Code) \
1021 V(Oddball) \ 1018 V(Oddball) \
1022 V(SharedFunctionInfo) \ 1019 V(SharedFunctionInfo) \
1023 V(OptimizedCodeEntry) \
1024 V(JSValue) \ 1020 V(JSValue) \
1025 V(JSDate) \ 1021 V(JSDate) \
1026 V(JSMessageObject) \ 1022 V(JSMessageObject) \
1027 V(StringWrapper) \ 1023 V(StringWrapper) \
1028 V(Foreign) \ 1024 V(Foreign) \
1029 V(Boolean) \ 1025 V(Boolean) \
1030 V(JSArray) \ 1026 V(JSArray) \
1031 V(JSArrayBuffer) \ 1027 V(JSArrayBuffer) \
1032 V(JSArrayBufferView) \ 1028 V(JSArrayBufferView) \
1033 V(JSTypedArray) \ 1029 V(JSTypedArray) \
(...skipping 5761 matching lines...) Expand 10 before | Expand all | Expand 10 after
6795 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); 6791 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte);
6796 #else 6792 #else
6797 #error Unknown byte ordering 6793 #error Unknown byte ordering
6798 #endif 6794 #endif
6799 6795
6800 private: 6796 private:
6801 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); 6797 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
6802 }; 6798 };
6803 6799
6804 6800
6805 // An optimized code entry represents an association between the native
6806 // context, a function, optimized code, and the literals. The entries
6807 // are linked into two lists for efficient lookup: by native context
6808 // (linked through next_by_native_context), or by shared function
6809 // info (linked through next_by_shared_info).
6810 // The references to the native context, function, and code are weak,
6811 // in order not to leak native contexts or functions through
6812 // SharedFunctionInfo. This means an entry can become "dead" through GC.
6813 // Entries are removed lazily as each list is traversed.
6814 class OptimizedCodeEntry: public HeapObject {
6815 public:
6816 // [native_context]: The native context of this entry. (WEAK)
6817 DECL_ACCESSORS(native_context, Context)
6818
6819 // [function]: The JSFunction of this entry. (WEAK)
6820 DECL_ACCESSORS(function, JSFunction)
6821
6822 // [code]: The optimized code of this entry. (WEAK)
6823 DECL_ACCESSORS(code, Code)
6824
6825 // [literals]: Array of literals for this entry.
6826 DECL_ACCESSORS(literals, FixedArray)
6827
6828 // [next_by_shared_info]: The next link in the list, when traversing
6829 // starting with a SharedFunctionInfo. (NULL if none).
6830 DECL_ACCESSORS(next_by_shared_info, OptimizedCodeEntry)
6831
6832 // [next_by_native_context]: The next link in the list, when traversing
6833 // starting with a native context. (NULL if none)
6834 DECL_ACCESSORS(next_by_native_context, OptimizedCodeEntry)
6835
6836 // Casting.
6837 static inline OptimizedCodeEntry* cast(Object* obj);
6838
6839 DECLARE_PRINTER(OptimizedCodeEntry)
6840 DECLARE_VERIFIER(OptimizedCodeEntry)
6841
6842 // Layout description.
6843 static const int kNativeContextOffset = JSObject::kHeaderSize;
6844 static const int kFunctionOffset = kNativeContextOffset + kPointerSize;
6845 static const int kCodeOffset = kFunctionOffset + kPointerSize;
6846 static const int kLiteralsOffset = kCodeOffset + kPointerSize;
6847 static const int kNextBySharedInfoOffset =
6848 kLiteralsOffset + kPointerSize;
6849 static const int kNextByNativeContextOffset =
6850 kNextBySharedInfoOffset + kPointerSize;
6851 static const int kCacheableOffset = kNextByNativeContextOffset + kPointerSize;
6852 static const int kSize = kCacheableOffset + kIntSize;
6853 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kSize);
6854
6855 typedef FixedBodyDescriptor<kLiteralsOffset,
6856 kNextByNativeContextOffset + kPointerSize,
6857 kSize> BodyDescriptor;
6858
6859 // Kills an entry, nulling out its references to native context, function,
6860 // code, and literals.
6861 void Kill();
6862 inline bool cacheable();
6863 inline void set_cacheable(bool val);
6864
6865 private:
6866 // Used internally during traversal to skip dead entries.
6867 inline bool IsDead() {
6868 return function() == NULL || code() == NULL;
6869 }
6870
6871 DISALLOW_IMPLICIT_CONSTRUCTORS(OptimizedCodeEntry);
6872 };
6873
6874
6875 class JSGeneratorObject: public JSObject { 6801 class JSGeneratorObject: public JSObject {
6876 public: 6802 public:
6877 // [function]: The function corresponding to this generator object. 6803 // [function]: The function corresponding to this generator object.
6878 DECL_ACCESSORS(function, JSFunction) 6804 DECL_ACCESSORS(function, JSFunction)
6879 6805
6880 // [context]: The context of the suspended computation. 6806 // [context]: The context of the suspended computation.
6881 DECL_ACCESSORS(context, Context) 6807 DECL_ACCESSORS(context, Context)
6882 6808
6883 // [receiver]: The receiver of the suspended computation. 6809 // [receiver]: The receiver of the suspended computation.
6884 DECL_ACCESSORS(receiver, Object) 6810 DECL_ACCESSORS(receiver, Object)
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after
10233 } else { 10159 } else {
10234 value &= ~(1 << bit_position); 10160 value &= ~(1 << bit_position);
10235 } 10161 }
10236 return value; 10162 return value;
10237 } 10163 }
10238 }; 10164 };
10239 10165
10240 } } // namespace v8::internal 10166 } } // namespace v8::internal
10241 10167
10242 #endif // V8_OBJECTS_H_ 10168 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698