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 5715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5726 | 5726 |
5727 template<typename StaticVisitor> | 5727 template<typename StaticVisitor> |
5728 inline void CodeIterateBody(Heap* heap); | 5728 inline void CodeIterateBody(Heap* heap); |
5729 | 5729 |
5730 DECLARE_PRINTER(Code) | 5730 DECLARE_PRINTER(Code) |
5731 DECLARE_VERIFIER(Code) | 5731 DECLARE_VERIFIER(Code) |
5732 | 5732 |
5733 void ClearInlineCaches(); | 5733 void ClearInlineCaches(); |
5734 void ClearInlineCaches(Kind kind); | 5734 void ClearInlineCaches(Kind kind); |
5735 | 5735 |
5736 void ClearTypeFeedbackInfo(Heap* heap); | |
5737 | |
5738 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5736 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
5739 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); | 5737 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); |
5740 | 5738 |
5741 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5739 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
5742 enum Age { | 5740 enum Age { |
5743 kNotExecutedCodeAge = -2, | 5741 kNotExecutedCodeAge = -2, |
5744 kExecutedOnceCodeAge = -1, | 5742 kExecutedOnceCodeAge = -1, |
5745 kNoAgeCodeAge = 0, | 5743 kNoAgeCodeAge = 0, |
5746 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5744 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
5747 kAfterLastCodeAge, | 5745 kAfterLastCodeAge, |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6991 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); | 6989 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); |
6992 | 6990 |
6993 Code* GetCodeFromOptimizedCodeMap(int index); | 6991 Code* GetCodeFromOptimizedCodeMap(int index); |
6994 | 6992 |
6995 // Clear optimized code map. | 6993 // Clear optimized code map. |
6996 void ClearOptimizedCodeMap(); | 6994 void ClearOptimizedCodeMap(); |
6997 | 6995 |
6998 // Removed a specific optimized code object from the optimized code map. | 6996 // Removed a specific optimized code object from the optimized code map. |
6999 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 6997 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
7000 | 6998 |
| 6999 void ClearTypeFeedbackInfo(Heap* heap); |
| 7000 |
7001 // Trims the optimized code map after entries have been removed. | 7001 // Trims the optimized code map after entries have been removed. |
7002 void TrimOptimizedCodeMap(int shrink_by); | 7002 void TrimOptimizedCodeMap(int shrink_by); |
7003 | 7003 |
7004 // Add a new entry to the optimized code map. | 7004 // Add a new entry to the optimized code map. |
7005 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 7005 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
7006 Handle<Context> native_context, | 7006 Handle<Context> native_context, |
7007 Handle<Code> code, | 7007 Handle<Code> code, |
7008 Handle<FixedArray> literals, | 7008 Handle<FixedArray> literals, |
7009 BailoutId osr_ast_id); | 7009 BailoutId osr_ast_id); |
7010 | 7010 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7095 // Important: inobject slack tracking is not attempted during the snapshot | 7095 // Important: inobject slack tracking is not attempted during the snapshot |
7096 // creation. | 7096 // creation. |
7097 | 7097 |
7098 static const int kGenerousAllocationCount = 8; | 7098 static const int kGenerousAllocationCount = 8; |
7099 | 7099 |
7100 // [construction_count]: Counter for constructor calls made during | 7100 // [construction_count]: Counter for constructor calls made during |
7101 // the tracking phase. | 7101 // the tracking phase. |
7102 inline int construction_count(); | 7102 inline int construction_count(); |
7103 inline void set_construction_count(int value); | 7103 inline void set_construction_count(int value); |
7104 | 7104 |
| 7105 // [feedback_vector] - accumulates ast node feedback from full-codegen and |
| 7106 // (increasingly) from crankshafted code where sufficient feedback isn't |
| 7107 // available. Currently the field is duplicated in |
| 7108 // TypeFeedbackInfo::feedback_vector, but the allocation is done here. |
| 7109 DECL_ACCESSORS(feedback_vector, FixedArray) |
| 7110 |
7105 // [initial_map]: initial map of the first function called as a constructor. | 7111 // [initial_map]: initial map of the first function called as a constructor. |
7106 // Saved for the duration of the tracking phase. | 7112 // Saved for the duration of the tracking phase. |
7107 // This is a weak link (GC resets it to undefined_value if no other live | 7113 // This is a weak link (GC resets it to undefined_value if no other live |
7108 // object reference this map). | 7114 // object reference this map). |
7109 DECL_ACCESSORS(initial_map, Object) | 7115 DECL_ACCESSORS(initial_map, Object) |
7110 | 7116 |
7111 // True if the initial_map is not undefined and the countdown stub is | 7117 // True if the initial_map is not undefined and the countdown stub is |
7112 // installed. | 7118 // installed. |
7113 inline bool IsInobjectSlackTrackingInProgress(); | 7119 inline bool IsInobjectSlackTrackingInProgress(); |
7114 | 7120 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7376 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; | 7382 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; |
7377 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; | 7383 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; |
7378 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 7384 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
7379 static const int kInstanceClassNameOffset = | 7385 static const int kInstanceClassNameOffset = |
7380 kConstructStubOffset + kPointerSize; | 7386 kConstructStubOffset + kPointerSize; |
7381 static const int kFunctionDataOffset = | 7387 static const int kFunctionDataOffset = |
7382 kInstanceClassNameOffset + kPointerSize; | 7388 kInstanceClassNameOffset + kPointerSize; |
7383 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 7389 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
7384 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 7390 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
7385 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 7391 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 7392 static const int kFeedbackVectorOffset = |
| 7393 kInferredNameOffset + kPointerSize; |
7386 static const int kInitialMapOffset = | 7394 static const int kInitialMapOffset = |
7387 kInferredNameOffset + kPointerSize; | 7395 kFeedbackVectorOffset + kPointerSize; |
7388 #if V8_HOST_ARCH_32_BIT | 7396 #if V8_HOST_ARCH_32_BIT |
7389 // Smi fields. | 7397 // Smi fields. |
7390 static const int kLengthOffset = | 7398 static const int kLengthOffset = |
7391 kInitialMapOffset + kPointerSize; | 7399 kInitialMapOffset + kPointerSize; |
7392 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 7400 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
7393 static const int kExpectedNofPropertiesOffset = | 7401 static const int kExpectedNofPropertiesOffset = |
7394 kFormalParameterCountOffset + kPointerSize; | 7402 kFormalParameterCountOffset + kPointerSize; |
7395 static const int kNumLiteralsOffset = | 7403 static const int kNumLiteralsOffset = |
7396 kExpectedNofPropertiesOffset + kPointerSize; | 7404 kExpectedNofPropertiesOffset + kPointerSize; |
7397 static const int kStartPositionAndTypeOffset = | 7405 static const int kStartPositionAndTypeOffset = |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8457 inline void change_ic_with_type_info_count(int count); | 8465 inline void change_ic_with_type_info_count(int count); |
8458 | 8466 |
8459 inline void initialize_storage(); | 8467 inline void initialize_storage(); |
8460 | 8468 |
8461 inline void change_own_type_change_checksum(); | 8469 inline void change_own_type_change_checksum(); |
8462 inline int own_type_change_checksum(); | 8470 inline int own_type_change_checksum(); |
8463 | 8471 |
8464 inline void set_inlined_type_change_checksum(int checksum); | 8472 inline void set_inlined_type_change_checksum(int checksum); |
8465 inline bool matches_inlined_type_change_checksum(int checksum); | 8473 inline bool matches_inlined_type_change_checksum(int checksum); |
8466 | 8474 |
8467 DECL_ACCESSORS(feedback_vector, FixedArray) | |
8468 | 8475 |
8469 static inline TypeFeedbackInfo* cast(Object* obj); | 8476 static inline TypeFeedbackInfo* cast(Object* obj); |
8470 | 8477 |
8471 // Dispatched behavior. | 8478 // Dispatched behavior. |
8472 DECLARE_PRINTER(TypeFeedbackInfo) | 8479 DECLARE_PRINTER(TypeFeedbackInfo) |
8473 DECLARE_VERIFIER(TypeFeedbackInfo) | 8480 DECLARE_VERIFIER(TypeFeedbackInfo) |
8474 | 8481 |
8475 static const int kStorage1Offset = HeapObject::kHeaderSize; | 8482 static const int kStorage1Offset = HeapObject::kHeaderSize; |
8476 static const int kStorage2Offset = kStorage1Offset + kPointerSize; | 8483 static const int kStorage2Offset = kStorage1Offset + kPointerSize; |
8477 static const int kFeedbackVectorOffset = | 8484 static const int kSize = kStorage2Offset + kPointerSize; |
8478 kStorage2Offset + kPointerSize; | |
8479 static const int kSize = kFeedbackVectorOffset + kPointerSize; | |
8480 | 8485 |
| 8486 // TODO(mvstanton): move these sentinel declarations to shared function info. |
8481 // The object that indicates an uninitialized cache. | 8487 // The object that indicates an uninitialized cache. |
8482 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | 8488 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
8483 | 8489 |
8484 // The object that indicates a megamorphic state. | 8490 // The object that indicates a megamorphic state. |
8485 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | 8491 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
8486 | 8492 |
8487 // The object that indicates a monomorphic state of Array with | 8493 // The object that indicates a monomorphic state of Array with |
8488 // ElementsKind | 8494 // ElementsKind |
8489 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, | 8495 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, |
8490 ElementsKind elements_kind); | 8496 ElementsKind elements_kind); |
8491 | 8497 |
8492 // A raw version of the uninitialized sentinel that's safe to read during | 8498 // A raw version of the uninitialized sentinel that's safe to read during |
8493 // garbage collection (e.g., for patching the cache). | 8499 // garbage collection (e.g., for patching the cache). |
8494 static inline Object* RawUninitializedSentinel(Heap* heap); | 8500 static inline Object* RawUninitializedSentinel(Heap* heap); |
8495 | 8501 |
8496 static const int kForInFastCaseMarker = 0; | |
8497 static const int kForInSlowCaseMarker = 1; | |
8498 | |
8499 private: | 8502 private: |
8500 static const int kTypeChangeChecksumBits = 7; | 8503 static const int kTypeChangeChecksumBits = 7; |
8501 | 8504 |
8502 class ICTotalCountField: public BitField<int, 0, | 8505 class ICTotalCountField: public BitField<int, 0, |
8503 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8506 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
8504 class OwnTypeChangeChecksum: public BitField<int, | 8507 class OwnTypeChangeChecksum: public BitField<int, |
8505 kSmiValueSize - kTypeChangeChecksumBits, | 8508 kSmiValueSize - kTypeChangeChecksumBits, |
8506 kTypeChangeChecksumBits> {}; // NOLINT | 8509 kTypeChangeChecksumBits> {}; // NOLINT |
8507 class ICsWithTypeInfoCountField: public BitField<int, 0, | 8510 class ICsWithTypeInfoCountField: public BitField<int, 0, |
8508 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8511 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
(...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11248 } else { | 11251 } else { |
11249 value &= ~(1 << bit_position); | 11252 value &= ~(1 << bit_position); |
11250 } | 11253 } |
11251 return value; | 11254 return value; |
11252 } | 11255 } |
11253 }; | 11256 }; |
11254 | 11257 |
11255 } } // namespace v8::internal | 11258 } } // namespace v8::internal |
11256 | 11259 |
11257 #endif // V8_OBJECTS_H_ | 11260 #endif // V8_OBJECTS_H_ |
OLD | NEW |