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 5479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5490 | 5490 |
5491 template<typename StaticVisitor> | 5491 template<typename StaticVisitor> |
5492 inline void CodeIterateBody(Heap* heap); | 5492 inline void CodeIterateBody(Heap* heap); |
5493 | 5493 |
5494 DECLARE_PRINTER(Code) | 5494 DECLARE_PRINTER(Code) |
5495 DECLARE_VERIFIER(Code) | 5495 DECLARE_VERIFIER(Code) |
5496 | 5496 |
5497 void ClearInlineCaches(); | 5497 void ClearInlineCaches(); |
5498 void ClearInlineCaches(Kind kind); | 5498 void ClearInlineCaches(Kind kind); |
5499 | 5499 |
| 5500 void ClearTypeFeedbackInfo(Heap* heap); |
| 5501 |
5500 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5502 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
5501 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); | 5503 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); |
5502 | 5504 |
5503 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5505 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
5504 enum Age { | 5506 enum Age { |
5505 kNotExecutedCodeAge = -2, | 5507 kNotExecutedCodeAge = -2, |
5506 kExecutedOnceCodeAge = -1, | 5508 kExecutedOnceCodeAge = -1, |
5507 kNoAgeCodeAge = 0, | 5509 kNoAgeCodeAge = 0, |
5508 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5510 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
5509 kAfterLastCodeAge, | 5511 kAfterLastCodeAge, |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6685 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); | 6687 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); |
6686 | 6688 |
6687 Code* GetCodeFromOptimizedCodeMap(int index); | 6689 Code* GetCodeFromOptimizedCodeMap(int index); |
6688 | 6690 |
6689 // Clear optimized code map. | 6691 // Clear optimized code map. |
6690 void ClearOptimizedCodeMap(); | 6692 void ClearOptimizedCodeMap(); |
6691 | 6693 |
6692 // Removed a specific optimized code object from the optimized code map. | 6694 // Removed a specific optimized code object from the optimized code map. |
6693 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 6695 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
6694 | 6696 |
6695 void ClearTypeFeedbackInfo(Heap* heap); | |
6696 | |
6697 // Trims the optimized code map after entries have been removed. | 6697 // Trims the optimized code map after entries have been removed. |
6698 void TrimOptimizedCodeMap(int shrink_by); | 6698 void TrimOptimizedCodeMap(int shrink_by); |
6699 | 6699 |
6700 // Add a new entry to the optimized code map. | 6700 // Add a new entry to the optimized code map. |
6701 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, | 6701 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, |
6702 Code* code, | 6702 Code* code, |
6703 FixedArray* literals, | 6703 FixedArray* literals, |
6704 BailoutId osr_ast_id); | 6704 BailoutId osr_ast_id); |
6705 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 6705 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
6706 Handle<Context> native_context, | 6706 Handle<Context> native_context, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6795 // Important: inobject slack tracking is not attempted during the snapshot | 6795 // Important: inobject slack tracking is not attempted during the snapshot |
6796 // creation. | 6796 // creation. |
6797 | 6797 |
6798 static const int kGenerousAllocationCount = 8; | 6798 static const int kGenerousAllocationCount = 8; |
6799 | 6799 |
6800 // [construction_count]: Counter for constructor calls made during | 6800 // [construction_count]: Counter for constructor calls made during |
6801 // the tracking phase. | 6801 // the tracking phase. |
6802 inline int construction_count(); | 6802 inline int construction_count(); |
6803 inline void set_construction_count(int value); | 6803 inline void set_construction_count(int value); |
6804 | 6804 |
6805 // [feedback_vector] - accumulates ast node feedback from full-codegen and | |
6806 // (increasingly) from crankshafted code where sufficient feedback isn't | |
6807 // available. Currently the field is duplicated in | |
6808 // TypeFeedbackInfo::feedback_vector, but the allocation is done here. | |
6809 DECL_ACCESSORS(feedback_vector, FixedArray) | |
6810 | |
6811 // [initial_map]: initial map of the first function called as a constructor. | 6805 // [initial_map]: initial map of the first function called as a constructor. |
6812 // Saved for the duration of the tracking phase. | 6806 // Saved for the duration of the tracking phase. |
6813 // This is a weak link (GC resets it to undefined_value if no other live | 6807 // This is a weak link (GC resets it to undefined_value if no other live |
6814 // object reference this map). | 6808 // object reference this map). |
6815 DECL_ACCESSORS(initial_map, Object) | 6809 DECL_ACCESSORS(initial_map, Object) |
6816 | 6810 |
6817 // True if the initial_map is not undefined and the countdown stub is | 6811 // True if the initial_map is not undefined and the countdown stub is |
6818 // installed. | 6812 // installed. |
6819 inline bool IsInobjectSlackTrackingInProgress(); | 6813 inline bool IsInobjectSlackTrackingInProgress(); |
6820 | 6814 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7081 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; | 7075 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; |
7082 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; | 7076 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; |
7083 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 7077 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
7084 static const int kInstanceClassNameOffset = | 7078 static const int kInstanceClassNameOffset = |
7085 kConstructStubOffset + kPointerSize; | 7079 kConstructStubOffset + kPointerSize; |
7086 static const int kFunctionDataOffset = | 7080 static const int kFunctionDataOffset = |
7087 kInstanceClassNameOffset + kPointerSize; | 7081 kInstanceClassNameOffset + kPointerSize; |
7088 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 7082 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
7089 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 7083 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
7090 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 7084 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
7091 static const int kFeedbackVectorOffset = | 7085 static const int kInitialMapOffset = |
7092 kInferredNameOffset + kPointerSize; | 7086 kInferredNameOffset + kPointerSize; |
7093 static const int kInitialMapOffset = | |
7094 kFeedbackVectorOffset + kPointerSize; | |
7095 // ast_node_count is a Smi field. It could be grouped with another Smi field | 7087 // ast_node_count is a Smi field. It could be grouped with another Smi field |
7096 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. | 7088 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. |
7097 static const int kAstNodeCountOffset = | 7089 static const int kAstNodeCountOffset = |
7098 kInitialMapOffset + kPointerSize; | 7090 kInitialMapOffset + kPointerSize; |
7099 #if V8_HOST_ARCH_32_BIT | 7091 #if V8_HOST_ARCH_32_BIT |
7100 // Smi fields. | 7092 // Smi fields. |
7101 static const int kLengthOffset = | 7093 static const int kLengthOffset = |
7102 kAstNodeCountOffset + kPointerSize; | 7094 kAstNodeCountOffset + kPointerSize; |
7103 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 7095 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
7104 static const int kExpectedNofPropertiesOffset = | 7096 static const int kExpectedNofPropertiesOffset = |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8170 inline void change_ic_with_type_info_count(int count); | 8162 inline void change_ic_with_type_info_count(int count); |
8171 | 8163 |
8172 inline void initialize_storage(); | 8164 inline void initialize_storage(); |
8173 | 8165 |
8174 inline void change_own_type_change_checksum(); | 8166 inline void change_own_type_change_checksum(); |
8175 inline int own_type_change_checksum(); | 8167 inline int own_type_change_checksum(); |
8176 | 8168 |
8177 inline void set_inlined_type_change_checksum(int checksum); | 8169 inline void set_inlined_type_change_checksum(int checksum); |
8178 inline bool matches_inlined_type_change_checksum(int checksum); | 8170 inline bool matches_inlined_type_change_checksum(int checksum); |
8179 | 8171 |
| 8172 DECL_ACCESSORS(feedback_vector, FixedArray) |
| 8173 |
8180 static inline TypeFeedbackInfo* cast(Object* obj); | 8174 static inline TypeFeedbackInfo* cast(Object* obj); |
8181 | 8175 |
8182 // Dispatched behavior. | 8176 // Dispatched behavior. |
8183 DECLARE_PRINTER(TypeFeedbackInfo) | 8177 DECLARE_PRINTER(TypeFeedbackInfo) |
8184 DECLARE_VERIFIER(TypeFeedbackInfo) | 8178 DECLARE_VERIFIER(TypeFeedbackInfo) |
8185 | 8179 |
8186 static const int kStorage1Offset = HeapObject::kHeaderSize; | 8180 static const int kStorage1Offset = HeapObject::kHeaderSize; |
8187 static const int kStorage2Offset = kStorage1Offset + kPointerSize; | 8181 static const int kStorage2Offset = kStorage1Offset + kPointerSize; |
8188 static const int kSize = kStorage2Offset + kPointerSize; | 8182 static const int kFeedbackVectorOffset = |
| 8183 kStorage2Offset + kPointerSize; |
| 8184 static const int kSize = kFeedbackVectorOffset + kPointerSize; |
8189 | 8185 |
8190 // TODO(mvstanton): move these sentinel declarations to shared function info. | |
8191 // The object that indicates an uninitialized cache. | 8186 // The object that indicates an uninitialized cache. |
8192 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | 8187 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
8193 | 8188 |
8194 // The object that indicates a megamorphic state. | 8189 // The object that indicates a megamorphic state. |
8195 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | 8190 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
8196 | 8191 |
8197 // The object that indicates a monomorphic state of Array with | 8192 // The object that indicates a monomorphic state of Array with |
8198 // ElementsKind | 8193 // ElementsKind |
8199 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, | 8194 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, |
8200 ElementsKind elements_kind); | 8195 ElementsKind elements_kind); |
8201 | 8196 |
8202 // A raw version of the uninitialized sentinel that's safe to read during | 8197 // A raw version of the uninitialized sentinel that's safe to read during |
8203 // garbage collection (e.g., for patching the cache). | 8198 // garbage collection (e.g., for patching the cache). |
8204 static inline Object* RawUninitializedSentinel(Heap* heap); | 8199 static inline Object* RawUninitializedSentinel(Heap* heap); |
8205 | 8200 |
| 8201 static const int kForInFastCaseMarker = 0; |
| 8202 static const int kForInSlowCaseMarker = 1; |
| 8203 |
8206 private: | 8204 private: |
8207 static const int kTypeChangeChecksumBits = 7; | 8205 static const int kTypeChangeChecksumBits = 7; |
8208 | 8206 |
8209 class ICTotalCountField: public BitField<int, 0, | 8207 class ICTotalCountField: public BitField<int, 0, |
8210 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8208 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
8211 class OwnTypeChangeChecksum: public BitField<int, | 8209 class OwnTypeChangeChecksum: public BitField<int, |
8212 kSmiValueSize - kTypeChangeChecksumBits, | 8210 kSmiValueSize - kTypeChangeChecksumBits, |
8213 kTypeChangeChecksumBits> {}; // NOLINT | 8211 kTypeChangeChecksumBits> {}; // NOLINT |
8214 class ICsWithTypeInfoCountField: public BitField<int, 0, | 8212 class ICsWithTypeInfoCountField: public BitField<int, 0, |
8215 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8213 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
(...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10781 } else { | 10779 } else { |
10782 value &= ~(1 << bit_position); | 10780 value &= ~(1 << bit_position); |
10783 } | 10781 } |
10784 return value; | 10782 return value; |
10785 } | 10783 } |
10786 }; | 10784 }; |
10787 | 10785 |
10788 } } // namespace v8::internal | 10786 } } // namespace v8::internal |
10789 | 10787 |
10790 #endif // V8_OBJECTS_H_ | 10788 #endif // V8_OBJECTS_H_ |
OLD | NEW |