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