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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 V(JSObject) \ | 1031 V(JSObject) \ |
1032 V(JSContextExtensionObject) \ | 1032 V(JSContextExtensionObject) \ |
1033 V(JSGeneratorObject) \ | 1033 V(JSGeneratorObject) \ |
1034 V(JSModule) \ | 1034 V(JSModule) \ |
1035 V(Map) \ | 1035 V(Map) \ |
1036 V(DescriptorArray) \ | 1036 V(DescriptorArray) \ |
1037 V(TransitionArray) \ | 1037 V(TransitionArray) \ |
1038 V(DeoptimizationInputData) \ | 1038 V(DeoptimizationInputData) \ |
1039 V(DeoptimizationOutputData) \ | 1039 V(DeoptimizationOutputData) \ |
1040 V(DependentCode) \ | 1040 V(DependentCode) \ |
1041 V(TypeFeedbackCells) \ | |
1042 V(FixedArray) \ | 1041 V(FixedArray) \ |
1043 V(FixedDoubleArray) \ | 1042 V(FixedDoubleArray) \ |
1044 V(ConstantPoolArray) \ | 1043 V(ConstantPoolArray) \ |
1045 V(Context) \ | 1044 V(Context) \ |
1046 V(NativeContext) \ | 1045 V(NativeContext) \ |
1047 V(ScopeInfo) \ | 1046 V(ScopeInfo) \ |
1048 V(JSFunction) \ | 1047 V(JSFunction) \ |
1049 V(Code) \ | 1048 V(Code) \ |
1050 V(Oddball) \ | 1049 V(Oddball) \ |
1051 V(SharedFunctionInfo) \ | 1050 V(SharedFunctionInfo) \ |
(...skipping 4008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5060 | 5059 |
5061 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) | 5060 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
5062 void DeoptimizationOutputDataPrint(FILE* out); | 5061 void DeoptimizationOutputDataPrint(FILE* out); |
5063 #endif | 5062 #endif |
5064 }; | 5063 }; |
5065 | 5064 |
5066 | 5065 |
5067 // Forward declaration. | 5066 // Forward declaration. |
5068 class Cell; | 5067 class Cell; |
5069 class PropertyCell; | 5068 class PropertyCell; |
5070 | |
5071 // TypeFeedbackCells is a fixed array used to hold the association between | |
5072 // cache cells and AST ids for code generated by the full compiler. | |
5073 // The format of the these objects is | |
5074 // [i * 2]: Global property cell of ith cache cell. | |
5075 // [i * 2 + 1]: Ast ID for ith cache cell. | |
5076 class TypeFeedbackCells: public FixedArray { | |
5077 public: | |
5078 int CellCount() { return length() / 2; } | |
5079 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } | |
5080 | |
5081 // Accessors for AST ids associated with cache values. | |
5082 inline TypeFeedbackId AstId(int index); | |
5083 inline void SetAstId(int index, TypeFeedbackId id); | |
5084 | |
5085 // Accessors for global property cells holding the cache values. | |
5086 inline Cell* GetCell(int index); | |
5087 inline void SetCell(int index, Cell* cell); | |
5088 | |
5089 // The object that indicates an uninitialized cache. | |
5090 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | |
5091 | |
5092 // The object that indicates a megamorphic state. | |
5093 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | |
5094 | |
5095 // The object that indicates a monomorphic state of Array with | |
5096 // ElementsKind | |
5097 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, | |
5098 ElementsKind elements_kind); | |
5099 | |
5100 // A raw version of the uninitialized sentinel that's safe to read during | |
5101 // garbage collection (e.g., for patching the cache). | |
5102 static inline Object* RawUninitializedSentinel(Heap* heap); | |
5103 | |
5104 // Casting. | |
5105 static inline TypeFeedbackCells* cast(Object* obj); | |
5106 | |
5107 static const int kForInFastCaseMarker = 0; | |
5108 static const int kForInSlowCaseMarker = 1; | |
5109 }; | |
5110 | |
5111 | |
5112 // Forward declaration. | |
5113 class SafepointEntry; | 5069 class SafepointEntry; |
5114 class TypeFeedbackInfo; | 5070 class TypeFeedbackInfo; |
5115 | 5071 |
5116 // Code describes objects with on-the-fly generated machine code. | 5072 // Code describes objects with on-the-fly generated machine code. |
5117 class Code: public HeapObject { | 5073 class Code: public HeapObject { |
5118 public: | 5074 public: |
5119 // Opaque data type for encapsulating code flags like kind, inline | 5075 // Opaque data type for encapsulating code flags like kind, inline |
5120 // cache state, and arguments count. | 5076 // cache state, and arguments count. |
5121 typedef uint32_t Flags; | 5077 typedef uint32_t Flags; |
5122 | 5078 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5472 | 5428 |
5473 template<typename StaticVisitor> | 5429 template<typename StaticVisitor> |
5474 inline void CodeIterateBody(Heap* heap); | 5430 inline void CodeIterateBody(Heap* heap); |
5475 | 5431 |
5476 DECLARE_PRINTER(Code) | 5432 DECLARE_PRINTER(Code) |
5477 DECLARE_VERIFIER(Code) | 5433 DECLARE_VERIFIER(Code) |
5478 | 5434 |
5479 void ClearInlineCaches(); | 5435 void ClearInlineCaches(); |
5480 void ClearInlineCaches(Kind kind); | 5436 void ClearInlineCaches(Kind kind); |
5481 | 5437 |
5482 void ClearTypeFeedbackCells(Heap* heap); | 5438 void ClearTypeFeedbackInfo(Heap* heap); |
5483 | 5439 |
5484 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5440 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
5485 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); | 5441 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); |
5486 | 5442 |
5487 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5443 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
5488 enum Age { | 5444 enum Age { |
5489 kNotExecutedCodeAge = -2, | 5445 kNotExecutedCodeAge = -2, |
5490 kExecutedOnceCodeAge = -1, | 5446 kExecutedOnceCodeAge = -1, |
5491 kNoAgeCodeAge = 0, | 5447 kNoAgeCodeAge = 0, |
5492 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5448 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
(...skipping 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8185 inline void change_ic_with_type_info_count(int count); | 8141 inline void change_ic_with_type_info_count(int count); |
8186 | 8142 |
8187 inline void initialize_storage(); | 8143 inline void initialize_storage(); |
8188 | 8144 |
8189 inline void change_own_type_change_checksum(); | 8145 inline void change_own_type_change_checksum(); |
8190 inline int own_type_change_checksum(); | 8146 inline int own_type_change_checksum(); |
8191 | 8147 |
8192 inline void set_inlined_type_change_checksum(int checksum); | 8148 inline void set_inlined_type_change_checksum(int checksum); |
8193 inline bool matches_inlined_type_change_checksum(int checksum); | 8149 inline bool matches_inlined_type_change_checksum(int checksum); |
8194 | 8150 |
8195 DECL_ACCESSORS(type_feedback_cells, TypeFeedbackCells) | 8151 DECL_ACCESSORS(feedback_vector, FixedArray) |
8196 | 8152 |
8197 static inline TypeFeedbackInfo* cast(Object* obj); | 8153 static inline TypeFeedbackInfo* cast(Object* obj); |
8198 | 8154 |
8199 // Dispatched behavior. | 8155 // Dispatched behavior. |
8200 DECLARE_PRINTER(TypeFeedbackInfo) | 8156 DECLARE_PRINTER(TypeFeedbackInfo) |
8201 DECLARE_VERIFIER(TypeFeedbackInfo) | 8157 DECLARE_VERIFIER(TypeFeedbackInfo) |
8202 | 8158 |
8203 static const int kStorage1Offset = HeapObject::kHeaderSize; | 8159 static const int kStorage1Offset = HeapObject::kHeaderSize; |
8204 static const int kStorage2Offset = kStorage1Offset + kPointerSize; | 8160 static const int kStorage2Offset = kStorage1Offset + kPointerSize; |
8205 static const int kTypeFeedbackCellsOffset = kStorage2Offset + kPointerSize; | 8161 static const int kFeedbackVectorOffset = |
8206 static const int kSize = kTypeFeedbackCellsOffset + kPointerSize; | 8162 kStorage2Offset + kPointerSize; |
| 8163 static const int kSize = kFeedbackVectorOffset + kPointerSize; |
| 8164 |
| 8165 // The object that indicates an uninitialized cache. |
| 8166 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
| 8167 |
| 8168 // The object that indicates a megamorphic state. |
| 8169 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
| 8170 |
| 8171 // The object that indicates a monomorphic state of Array with |
| 8172 // ElementsKind |
| 8173 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, |
| 8174 ElementsKind elements_kind); |
| 8175 |
| 8176 // A raw version of the uninitialized sentinel that's safe to read during |
| 8177 // garbage collection (e.g., for patching the cache). |
| 8178 static inline Object* RawUninitializedSentinel(Heap* heap); |
| 8179 |
| 8180 static const int kForInFastCaseMarker = 0; |
| 8181 static const int kForInSlowCaseMarker = 1; |
8207 | 8182 |
8208 private: | 8183 private: |
8209 static const int kTypeChangeChecksumBits = 7; | 8184 static const int kTypeChangeChecksumBits = 7; |
8210 | 8185 |
8211 class ICTotalCountField: public BitField<int, 0, | 8186 class ICTotalCountField: public BitField<int, 0, |
8212 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8187 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
8213 class OwnTypeChangeChecksum: public BitField<int, | 8188 class OwnTypeChangeChecksum: public BitField<int, |
8214 kSmiValueSize - kTypeChangeChecksumBits, | 8189 kSmiValueSize - kTypeChangeChecksumBits, |
8215 kTypeChangeChecksumBits> {}; // NOLINT | 8190 kTypeChangeChecksumBits> {}; // NOLINT |
8216 class ICsWithTypeInfoCountField: public BitField<int, 0, | 8191 class ICsWithTypeInfoCountField: public BitField<int, 0, |
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10767 } else { | 10742 } else { |
10768 value &= ~(1 << bit_position); | 10743 value &= ~(1 << bit_position); |
10769 } | 10744 } |
10770 return value; | 10745 return value; |
10771 } | 10746 } |
10772 }; | 10747 }; |
10773 | 10748 |
10774 } } // namespace v8::internal | 10749 } } // namespace v8::internal |
10775 | 10750 |
10776 #endif // V8_OBJECTS_H_ | 10751 #endif // V8_OBJECTS_H_ |
OLD | NEW |