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 5451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5462 | 5462 |
5463 template<typename StaticVisitor> | 5463 template<typename StaticVisitor> |
5464 inline void CodeIterateBody(Heap* heap); | 5464 inline void CodeIterateBody(Heap* heap); |
5465 | 5465 |
5466 DECLARE_PRINTER(Code) | 5466 DECLARE_PRINTER(Code) |
5467 DECLARE_VERIFIER(Code) | 5467 DECLARE_VERIFIER(Code) |
5468 | 5468 |
5469 void ClearInlineCaches(); | 5469 void ClearInlineCaches(); |
5470 void ClearInlineCaches(Kind kind); | 5470 void ClearInlineCaches(Kind kind); |
5471 | 5471 |
5472 void ClearTypeFeedbackInfo(Heap* heap); | |
5473 | |
5474 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5472 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
5475 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); | 5473 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); |
5476 | 5474 |
5477 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5475 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
5478 enum Age { | 5476 enum Age { |
5479 kNotExecutedCodeAge = -2, | 5477 kNotExecutedCodeAge = -2, |
5480 kExecutedOnceCodeAge = -1, | 5478 kExecutedOnceCodeAge = -1, |
5481 kNoAgeCodeAge = 0, | 5479 kNoAgeCodeAge = 0, |
5482 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5480 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
5483 kAfterLastCodeAge, | 5481 kAfterLastCodeAge, |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6659 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); | 6657 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); |
6660 | 6658 |
6661 Code* GetCodeFromOptimizedCodeMap(int index); | 6659 Code* GetCodeFromOptimizedCodeMap(int index); |
6662 | 6660 |
6663 // Clear optimized code map. | 6661 // Clear optimized code map. |
6664 void ClearOptimizedCodeMap(); | 6662 void ClearOptimizedCodeMap(); |
6665 | 6663 |
6666 // Removed a specific optimized code object from the optimized code map. | 6664 // Removed a specific optimized code object from the optimized code map. |
6667 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 6665 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
6668 | 6666 |
| 6667 void ClearTypeFeedbackInfo(Heap* heap); |
| 6668 |
6669 // Trims the optimized code map after entries have been removed. | 6669 // Trims the optimized code map after entries have been removed. |
6670 void TrimOptimizedCodeMap(int shrink_by); | 6670 void TrimOptimizedCodeMap(int shrink_by); |
6671 | 6671 |
6672 // Add a new entry to the optimized code map. | 6672 // Add a new entry to the optimized code map. |
6673 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, | 6673 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, |
6674 Code* code, | 6674 Code* code, |
6675 FixedArray* literals, | 6675 FixedArray* literals, |
6676 BailoutId osr_ast_id); | 6676 BailoutId osr_ast_id); |
6677 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 6677 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
6678 Handle<Context> native_context, | 6678 Handle<Context> native_context, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6774 // Important: inobject slack tracking is not attempted during the snapshot | 6774 // Important: inobject slack tracking is not attempted during the snapshot |
6775 // creation. | 6775 // creation. |
6776 | 6776 |
6777 static const int kGenerousAllocationCount = 8; | 6777 static const int kGenerousAllocationCount = 8; |
6778 | 6778 |
6779 // [construction_count]: Counter for constructor calls made during | 6779 // [construction_count]: Counter for constructor calls made during |
6780 // the tracking phase. | 6780 // the tracking phase. |
6781 inline int construction_count(); | 6781 inline int construction_count(); |
6782 inline void set_construction_count(int value); | 6782 inline void set_construction_count(int value); |
6783 | 6783 |
| 6784 // [feedback_vector] - accumulates ast node feedback from full-codegen and |
| 6785 // (increasingly) from crankshafted code where sufficient feedback isn't |
| 6786 // available. Currently the field is duplicated in |
| 6787 // TypeFeedbackInfo::feedback_vector, but the allocation is done here. |
| 6788 DECL_ACCESSORS(feedback_vector, FixedArray) |
| 6789 |
6784 // [initial_map]: initial map of the first function called as a constructor. | 6790 // [initial_map]: initial map of the first function called as a constructor. |
6785 // Saved for the duration of the tracking phase. | 6791 // Saved for the duration of the tracking phase. |
6786 // This is a weak link (GC resets it to undefined_value if no other live | 6792 // This is a weak link (GC resets it to undefined_value if no other live |
6787 // object reference this map). | 6793 // object reference this map). |
6788 DECL_ACCESSORS(initial_map, Object) | 6794 DECL_ACCESSORS(initial_map, Object) |
6789 | 6795 |
6790 // True if the initial_map is not undefined and the countdown stub is | 6796 // True if the initial_map is not undefined and the countdown stub is |
6791 // installed. | 6797 // installed. |
6792 inline bool IsInobjectSlackTrackingInProgress(); | 6798 inline bool IsInobjectSlackTrackingInProgress(); |
6793 | 6799 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7065 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; | 7071 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; |
7066 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; | 7072 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; |
7067 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 7073 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
7068 static const int kInstanceClassNameOffset = | 7074 static const int kInstanceClassNameOffset = |
7069 kConstructStubOffset + kPointerSize; | 7075 kConstructStubOffset + kPointerSize; |
7070 static const int kFunctionDataOffset = | 7076 static const int kFunctionDataOffset = |
7071 kInstanceClassNameOffset + kPointerSize; | 7077 kInstanceClassNameOffset + kPointerSize; |
7072 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 7078 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
7073 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 7079 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
7074 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 7080 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 7081 static const int kFeedbackVectorOffset = |
| 7082 kInferredNameOffset + kPointerSize; |
7075 static const int kInitialMapOffset = | 7083 static const int kInitialMapOffset = |
7076 kInferredNameOffset + kPointerSize; | 7084 kFeedbackVectorOffset + kPointerSize; |
7077 // ast_node_count is a Smi field. It could be grouped with another Smi field | 7085 // ast_node_count is a Smi field. It could be grouped with another Smi field |
7078 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. | 7086 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. |
7079 static const int kAstNodeCountOffset = | 7087 static const int kAstNodeCountOffset = |
7080 kInitialMapOffset + kPointerSize; | 7088 kInitialMapOffset + kPointerSize; |
7081 #if V8_HOST_ARCH_32_BIT | 7089 #if V8_HOST_ARCH_32_BIT |
7082 // Smi fields. | 7090 // Smi fields. |
7083 static const int kLengthOffset = | 7091 static const int kLengthOffset = |
7084 kAstNodeCountOffset + kPointerSize; | 7092 kAstNodeCountOffset + kPointerSize; |
7085 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 7093 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
7086 static const int kExpectedNofPropertiesOffset = | 7094 static const int kExpectedNofPropertiesOffset = |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8161 inline void change_ic_with_type_info_count(int count); | 8169 inline void change_ic_with_type_info_count(int count); |
8162 | 8170 |
8163 inline void initialize_storage(); | 8171 inline void initialize_storage(); |
8164 | 8172 |
8165 inline void change_own_type_change_checksum(); | 8173 inline void change_own_type_change_checksum(); |
8166 inline int own_type_change_checksum(); | 8174 inline int own_type_change_checksum(); |
8167 | 8175 |
8168 inline void set_inlined_type_change_checksum(int checksum); | 8176 inline void set_inlined_type_change_checksum(int checksum); |
8169 inline bool matches_inlined_type_change_checksum(int checksum); | 8177 inline bool matches_inlined_type_change_checksum(int checksum); |
8170 | 8178 |
8171 DECL_ACCESSORS(feedback_vector, FixedArray) | |
8172 | |
8173 static inline TypeFeedbackInfo* cast(Object* obj); | 8179 static inline TypeFeedbackInfo* cast(Object* obj); |
8174 | 8180 |
8175 // Dispatched behavior. | 8181 // Dispatched behavior. |
8176 DECLARE_PRINTER(TypeFeedbackInfo) | 8182 DECLARE_PRINTER(TypeFeedbackInfo) |
8177 DECLARE_VERIFIER(TypeFeedbackInfo) | 8183 DECLARE_VERIFIER(TypeFeedbackInfo) |
8178 | 8184 |
8179 static const int kStorage1Offset = HeapObject::kHeaderSize; | 8185 static const int kStorage1Offset = HeapObject::kHeaderSize; |
8180 static const int kStorage2Offset = kStorage1Offset + kPointerSize; | 8186 static const int kStorage2Offset = kStorage1Offset + kPointerSize; |
8181 static const int kFeedbackVectorOffset = | 8187 static const int kSize = kStorage2Offset + kPointerSize; |
8182 kStorage2Offset + kPointerSize; | |
8183 static const int kSize = kFeedbackVectorOffset + kPointerSize; | |
8184 | 8188 |
| 8189 // TODO(mvstanton): move these sentinel declarations to shared function info. |
8185 // The object that indicates an uninitialized cache. | 8190 // The object that indicates an uninitialized cache. |
8186 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | 8191 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
8187 | 8192 |
8188 // The object that indicates a megamorphic state. | 8193 // The object that indicates a megamorphic state. |
8189 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | 8194 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
8190 | 8195 |
8191 // The object that indicates a monomorphic state of Array with | 8196 // The object that indicates a monomorphic state of Array with |
8192 // ElementsKind | 8197 // ElementsKind |
8193 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, | 8198 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, |
8194 ElementsKind elements_kind); | 8199 ElementsKind elements_kind); |
8195 | 8200 |
8196 // A raw version of the uninitialized sentinel that's safe to read during | 8201 // A raw version of the uninitialized sentinel that's safe to read during |
8197 // garbage collection (e.g., for patching the cache). | 8202 // garbage collection (e.g., for patching the cache). |
8198 static inline Object* RawUninitializedSentinel(Heap* heap); | 8203 static inline Object* RawUninitializedSentinel(Heap* heap); |
8199 | 8204 |
8200 static const int kForInFastCaseMarker = 0; | |
8201 static const int kForInSlowCaseMarker = 1; | |
8202 | |
8203 private: | 8205 private: |
8204 static const int kTypeChangeChecksumBits = 7; | 8206 static const int kTypeChangeChecksumBits = 7; |
8205 | 8207 |
8206 class ICTotalCountField: public BitField<int, 0, | 8208 class ICTotalCountField: public BitField<int, 0, |
8207 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8209 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
8208 class OwnTypeChangeChecksum: public BitField<int, | 8210 class OwnTypeChangeChecksum: public BitField<int, |
8209 kSmiValueSize - kTypeChangeChecksumBits, | 8211 kSmiValueSize - kTypeChangeChecksumBits, |
8210 kTypeChangeChecksumBits> {}; // NOLINT | 8212 kTypeChangeChecksumBits> {}; // NOLINT |
8211 class ICsWithTypeInfoCountField: public BitField<int, 0, | 8213 class ICsWithTypeInfoCountField: public BitField<int, 0, |
8212 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8214 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
(...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10776 } else { | 10778 } else { |
10777 value &= ~(1 << bit_position); | 10779 value &= ~(1 << bit_position); |
10778 } | 10780 } |
10779 return value; | 10781 return value; |
10780 } | 10782 } |
10781 }; | 10783 }; |
10782 | 10784 |
10783 } } // namespace v8::internal | 10785 } } // namespace v8::internal |
10784 | 10786 |
10785 #endif // V8_OBJECTS_H_ | 10787 #endif // V8_OBJECTS_H_ |
OLD | NEW |