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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 V(kDoPushArgumentNotImplementedForDoubleType, \ | 1141 V(kDoPushArgumentNotImplementedForDoubleType, \ |
1143 "DoPushArgument not implemented for double type") \ | 1142 "DoPushArgument not implemented for double type") \ |
1144 V(kEmitLoadRegisterUnsupportedDoubleImmediate, \ | 1143 V(kEmitLoadRegisterUnsupportedDoubleImmediate, \ |
1145 "EmitLoadRegister: Unsupported double immediate") \ | 1144 "EmitLoadRegister: Unsupported double immediate") \ |
1146 V(kEval, "eval") \ | 1145 V(kEval, "eval") \ |
1147 V(kExpected0AsASmiSentinel, "Expected 0 as a Smi sentinel") \ | 1146 V(kExpected0AsASmiSentinel, "Expected 0 as a Smi sentinel") \ |
1148 V(kExpectedAlignmentMarker, "expected alignment marker") \ | 1147 V(kExpectedAlignmentMarker, "expected alignment marker") \ |
1149 V(kExpectedAllocationSite, "expected allocation site") \ | 1148 V(kExpectedAllocationSite, "expected allocation site") \ |
1150 V(kExpectedPropertyCellInRegisterA2, \ | 1149 V(kExpectedPropertyCellInRegisterA2, \ |
1151 "Expected property cell in register a2") \ | 1150 "Expected property cell in register a2") \ |
1152 V(kExpectedPropertyCellInRegisterEbx, \ | 1151 V(kExpectedFixedArrayInRegisterEbx, \ |
1153 "Expected property cell in register ebx") \ | 1152 "Expected fixed array in register ebx") \ |
1154 V(kExpectedPropertyCellInRegisterRbx, \ | 1153 V(kExpectedFixedArrayInRegisterR2, \ |
1155 "Expected property cell in register rbx") \ | 1154 "Expected fixed array in register r2") \ |
| 1155 V(kExpectedFixedArrayInRegisterRbx, \ |
| 1156 "Expected fixed array in register rbx") \ |
1156 V(kExpectingAlignmentForCopyBytes, \ | 1157 V(kExpectingAlignmentForCopyBytes, \ |
1157 "Expecting alignment for CopyBytes") \ | 1158 "Expecting alignment for CopyBytes") \ |
1158 V(kExportDeclaration, "Export declaration") \ | 1159 V(kExportDeclaration, "Export declaration") \ |
1159 V(kExternalStringExpectedButNotFound, \ | 1160 V(kExternalStringExpectedButNotFound, \ |
1160 "External string expected, but not found") \ | 1161 "External string expected, but not found") \ |
1161 V(kFailedBailedOutLastTime, "Failed/bailed out last time") \ | 1162 V(kFailedBailedOutLastTime, "Failed/bailed out last time") \ |
1162 V(kForInStatementIsNotFastCase, "ForInStatement is not fast case") \ | 1163 V(kForInStatementIsNotFastCase, "ForInStatement is not fast case") \ |
1163 V(kForInStatementOptimizationIsDisabled, \ | 1164 V(kForInStatementOptimizationIsDisabled, \ |
1164 "ForInStatement optimization is disabled") \ | 1165 "ForInStatement optimization is disabled") \ |
1165 V(kForInStatementWithNonLocalEachVariable, \ | 1166 V(kForInStatementWithNonLocalEachVariable, \ |
(...skipping 3894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5060 | 5061 |
5061 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) | 5062 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
5062 void DeoptimizationOutputDataPrint(FILE* out); | 5063 void DeoptimizationOutputDataPrint(FILE* out); |
5063 #endif | 5064 #endif |
5064 }; | 5065 }; |
5065 | 5066 |
5066 | 5067 |
5067 // Forward declaration. | 5068 // Forward declaration. |
5068 class Cell; | 5069 class Cell; |
5069 class PropertyCell; | 5070 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; | 5071 class SafepointEntry; |
5114 class TypeFeedbackInfo; | 5072 class TypeFeedbackInfo; |
5115 | 5073 |
5116 // Code describes objects with on-the-fly generated machine code. | 5074 // Code describes objects with on-the-fly generated machine code. |
5117 class Code: public HeapObject { | 5075 class Code: public HeapObject { |
5118 public: | 5076 public: |
5119 // Opaque data type for encapsulating code flags like kind, inline | 5077 // Opaque data type for encapsulating code flags like kind, inline |
5120 // cache state, and arguments count. | 5078 // cache state, and arguments count. |
5121 typedef uint32_t Flags; | 5079 typedef uint32_t Flags; |
5122 | 5080 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5472 | 5430 |
5473 template<typename StaticVisitor> | 5431 template<typename StaticVisitor> |
5474 inline void CodeIterateBody(Heap* heap); | 5432 inline void CodeIterateBody(Heap* heap); |
5475 | 5433 |
5476 DECLARE_PRINTER(Code) | 5434 DECLARE_PRINTER(Code) |
5477 DECLARE_VERIFIER(Code) | 5435 DECLARE_VERIFIER(Code) |
5478 | 5436 |
5479 void ClearInlineCaches(); | 5437 void ClearInlineCaches(); |
5480 void ClearInlineCaches(Kind kind); | 5438 void ClearInlineCaches(Kind kind); |
5481 | 5439 |
5482 void ClearTypeFeedbackCells(Heap* heap); | 5440 void ClearTypeFeedbackInfo(Heap* heap); |
5483 | 5441 |
5484 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5442 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
5485 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); | 5443 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); |
5486 | 5444 |
5487 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5445 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
5488 enum Age { | 5446 enum Age { |
5489 kNotExecutedCodeAge = -2, | 5447 kNotExecutedCodeAge = -2, |
5490 kExecutedOnceCodeAge = -1, | 5448 kExecutedOnceCodeAge = -1, |
5491 kNoAgeCodeAge = 0, | 5449 kNoAgeCodeAge = 0, |
5492 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5450 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); | 8143 inline void change_ic_with_type_info_count(int count); |
8186 | 8144 |
8187 inline void initialize_storage(); | 8145 inline void initialize_storage(); |
8188 | 8146 |
8189 inline void change_own_type_change_checksum(); | 8147 inline void change_own_type_change_checksum(); |
8190 inline int own_type_change_checksum(); | 8148 inline int own_type_change_checksum(); |
8191 | 8149 |
8192 inline void set_inlined_type_change_checksum(int checksum); | 8150 inline void set_inlined_type_change_checksum(int checksum); |
8193 inline bool matches_inlined_type_change_checksum(int checksum); | 8151 inline bool matches_inlined_type_change_checksum(int checksum); |
8194 | 8152 |
8195 DECL_ACCESSORS(type_feedback_cells, TypeFeedbackCells) | 8153 DECL_ACCESSORS(feedback_vector, FixedArray) |
8196 | 8154 |
8197 static inline TypeFeedbackInfo* cast(Object* obj); | 8155 static inline TypeFeedbackInfo* cast(Object* obj); |
8198 | 8156 |
8199 // Dispatched behavior. | 8157 // Dispatched behavior. |
8200 DECLARE_PRINTER(TypeFeedbackInfo) | 8158 DECLARE_PRINTER(TypeFeedbackInfo) |
8201 DECLARE_VERIFIER(TypeFeedbackInfo) | 8159 DECLARE_VERIFIER(TypeFeedbackInfo) |
8202 | 8160 |
8203 static const int kStorage1Offset = HeapObject::kHeaderSize; | 8161 static const int kStorage1Offset = HeapObject::kHeaderSize; |
8204 static const int kStorage2Offset = kStorage1Offset + kPointerSize; | 8162 static const int kStorage2Offset = kStorage1Offset + kPointerSize; |
8205 static const int kTypeFeedbackCellsOffset = kStorage2Offset + kPointerSize; | 8163 static const int kFeedbackVectorOffset = |
8206 static const int kSize = kTypeFeedbackCellsOffset + kPointerSize; | 8164 kStorage2Offset + kPointerSize; |
| 8165 static const int kSize = kFeedbackVectorOffset + kPointerSize; |
| 8166 |
| 8167 // The object that indicates an uninitialized cache. |
| 8168 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
| 8169 |
| 8170 // The object that indicates a megamorphic state. |
| 8171 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
| 8172 |
| 8173 // The object that indicates a monomorphic state of Array with |
| 8174 // ElementsKind |
| 8175 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, |
| 8176 ElementsKind elements_kind); |
| 8177 |
| 8178 // A raw version of the uninitialized sentinel that's safe to read during |
| 8179 // garbage collection (e.g., for patching the cache). |
| 8180 static inline Object* RawUninitializedSentinel(Heap* heap); |
| 8181 |
| 8182 static const int kForInFastCaseMarker = 0; |
| 8183 static const int kForInSlowCaseMarker = 1; |
8207 | 8184 |
8208 private: | 8185 private: |
8209 static const int kTypeChangeChecksumBits = 7; | 8186 static const int kTypeChangeChecksumBits = 7; |
8210 | 8187 |
8211 class ICTotalCountField: public BitField<int, 0, | 8188 class ICTotalCountField: public BitField<int, 0, |
8212 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8189 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
8213 class OwnTypeChangeChecksum: public BitField<int, | 8190 class OwnTypeChangeChecksum: public BitField<int, |
8214 kSmiValueSize - kTypeChangeChecksumBits, | 8191 kSmiValueSize - kTypeChangeChecksumBits, |
8215 kTypeChangeChecksumBits> {}; // NOLINT | 8192 kTypeChangeChecksumBits> {}; // NOLINT |
8216 class ICsWithTypeInfoCountField: public BitField<int, 0, | 8193 class ICsWithTypeInfoCountField: public BitField<int, 0, |
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10767 } else { | 10744 } else { |
10768 value &= ~(1 << bit_position); | 10745 value &= ~(1 << bit_position); |
10769 } | 10746 } |
10770 return value; | 10747 return value; |
10771 } | 10748 } |
10772 }; | 10749 }; |
10773 | 10750 |
10774 } } // namespace v8::internal | 10751 } } // namespace v8::internal |
10775 | 10752 |
10776 #endif // V8_OBJECTS_H_ | 10753 #endif // V8_OBJECTS_H_ |
OLD | NEW |