Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects.h

Issue 137403009: Adding a type vector to replace type cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed feedback. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 5063
5063 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 5064 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
5064 void DeoptimizationOutputDataPrint(FILE* out); 5065 void DeoptimizationOutputDataPrint(FILE* out);
5065 #endif 5066 #endif
5066 }; 5067 };
5067 5068
5068 5069
5069 // Forward declaration. 5070 // Forward declaration.
5070 class Cell; 5071 class Cell;
5071 class PropertyCell; 5072 class PropertyCell;
5072
5073 // TypeFeedbackCells is a fixed array used to hold the association between
5074 // cache cells and AST ids for code generated by the full compiler.
5075 // The format of the these objects is
5076 // [i * 2]: Global property cell of ith cache cell.
5077 // [i * 2 + 1]: Ast ID for ith cache cell.
5078 class TypeFeedbackCells: public FixedArray {
5079 public:
5080 int CellCount() { return length() / 2; }
5081 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; }
5082
5083 // Accessors for AST ids associated with cache values.
5084 inline TypeFeedbackId AstId(int index);
5085 inline void SetAstId(int index, TypeFeedbackId id);
5086
5087 // Accessors for global property cells holding the cache values.
5088 inline Cell* GetCell(int index);
5089 inline void SetCell(int index, Cell* cell);
5090
5091 // The object that indicates an uninitialized cache.
5092 static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
5093
5094 // The object that indicates a megamorphic state.
5095 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
5096
5097 // The object that indicates a monomorphic state of Array with
5098 // ElementsKind
5099 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate,
5100 ElementsKind elements_kind);
5101
5102 // A raw version of the uninitialized sentinel that's safe to read during
5103 // garbage collection (e.g., for patching the cache).
5104 static inline Object* RawUninitializedSentinel(Heap* heap);
5105
5106 // Casting.
5107 static inline TypeFeedbackCells* cast(Object* obj);
5108
5109 static const int kForInFastCaseMarker = 0;
5110 static const int kForInSlowCaseMarker = 1;
5111 };
5112
5113
5114 // Forward declaration.
5115 class SafepointEntry; 5073 class SafepointEntry;
5116 class TypeFeedbackInfo; 5074 class TypeFeedbackInfo;
5117 5075
5118 // Code describes objects with on-the-fly generated machine code. 5076 // Code describes objects with on-the-fly generated machine code.
5119 class Code: public HeapObject { 5077 class Code: public HeapObject {
5120 public: 5078 public:
5121 // Opaque data type for encapsulating code flags like kind, inline 5079 // Opaque data type for encapsulating code flags like kind, inline
5122 // cache state, and arguments count. 5080 // cache state, and arguments count.
5123 typedef uint32_t Flags; 5081 typedef uint32_t Flags;
5124 5082
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
5465 5423
5466 template<typename StaticVisitor> 5424 template<typename StaticVisitor>
5467 inline void CodeIterateBody(Heap* heap); 5425 inline void CodeIterateBody(Heap* heap);
5468 5426
5469 DECLARE_PRINTER(Code) 5427 DECLARE_PRINTER(Code)
5470 DECLARE_VERIFIER(Code) 5428 DECLARE_VERIFIER(Code)
5471 5429
5472 void ClearInlineCaches(); 5430 void ClearInlineCaches();
5473 void ClearInlineCaches(Kind kind); 5431 void ClearInlineCaches(Kind kind);
5474 5432
5475 void ClearTypeFeedbackCells(Heap* heap); 5433 void ClearTypeFeedbackInfo(Heap* heap);
5476 5434
5477 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); 5435 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset);
5478 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); 5436 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id);
5479 5437
5480 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, 5438 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
5481 enum Age { 5439 enum Age {
5482 kNotExecutedCodeAge = -2, 5440 kNotExecutedCodeAge = -2,
5483 kExecutedOnceCodeAge = -1, 5441 kExecutedOnceCodeAge = -1,
5484 kNoAgeCodeAge = 0, 5442 kNoAgeCodeAge = 0,
5485 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) 5443 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM)
(...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
8179 inline void change_ic_with_type_info_count(int count); 8137 inline void change_ic_with_type_info_count(int count);
8180 8138
8181 inline void initialize_storage(); 8139 inline void initialize_storage();
8182 8140
8183 inline void change_own_type_change_checksum(); 8141 inline void change_own_type_change_checksum();
8184 inline int own_type_change_checksum(); 8142 inline int own_type_change_checksum();
8185 8143
8186 inline void set_inlined_type_change_checksum(int checksum); 8144 inline void set_inlined_type_change_checksum(int checksum);
8187 inline bool matches_inlined_type_change_checksum(int checksum); 8145 inline bool matches_inlined_type_change_checksum(int checksum);
8188 8146
8189 DECL_ACCESSORS(type_feedback_cells, TypeFeedbackCells) 8147 DECL_ACCESSORS(feedback_vector, FixedArray)
8190 8148
8191 static inline TypeFeedbackInfo* cast(Object* obj); 8149 static inline TypeFeedbackInfo* cast(Object* obj);
8192 8150
8193 // Dispatched behavior. 8151 // Dispatched behavior.
8194 DECLARE_PRINTER(TypeFeedbackInfo) 8152 DECLARE_PRINTER(TypeFeedbackInfo)
8195 DECLARE_VERIFIER(TypeFeedbackInfo) 8153 DECLARE_VERIFIER(TypeFeedbackInfo)
8196 8154
8197 static const int kStorage1Offset = HeapObject::kHeaderSize; 8155 static const int kStorage1Offset = HeapObject::kHeaderSize;
8198 static const int kStorage2Offset = kStorage1Offset + kPointerSize; 8156 static const int kStorage2Offset = kStorage1Offset + kPointerSize;
8199 static const int kTypeFeedbackCellsOffset = kStorage2Offset + kPointerSize; 8157 static const int kFeedbackVectorOffset =
8200 static const int kSize = kTypeFeedbackCellsOffset + kPointerSize; 8158 kStorage2Offset + kPointerSize;
8159 static const int kSize = kFeedbackVectorOffset + kPointerSize;
8160
8161 // The object that indicates an uninitialized cache.
8162 static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
8163
8164 // The object that indicates a megamorphic state.
8165 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
8166
8167 // The object that indicates a monomorphic state of Array with
8168 // ElementsKind
8169 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate,
8170 ElementsKind elements_kind);
8171
8172 // A raw version of the uninitialized sentinel that's safe to read during
8173 // garbage collection (e.g., for patching the cache).
8174 static inline Object* RawUninitializedSentinel(Heap* heap);
8175
8176 static const int kForInFastCaseMarker = 0;
8177 static const int kForInSlowCaseMarker = 1;
8201 8178
8202 private: 8179 private:
8203 static const int kTypeChangeChecksumBits = 7; 8180 static const int kTypeChangeChecksumBits = 7;
8204 8181
8205 class ICTotalCountField: public BitField<int, 0, 8182 class ICTotalCountField: public BitField<int, 0,
8206 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT 8183 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT
8207 class OwnTypeChangeChecksum: public BitField<int, 8184 class OwnTypeChangeChecksum: public BitField<int,
8208 kSmiValueSize - kTypeChangeChecksumBits, 8185 kSmiValueSize - kTypeChangeChecksumBits,
8209 kTypeChangeChecksumBits> {}; // NOLINT 8186 kTypeChangeChecksumBits> {}; // NOLINT
8210 class ICsWithTypeInfoCountField: public BitField<int, 0, 8187 class ICsWithTypeInfoCountField: public BitField<int, 0,
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
10761 } else { 10738 } else {
10762 value &= ~(1 << bit_position); 10739 value &= ~(1 << bit_position);
10763 } 10740 }
10764 return value; 10741 return value;
10765 } 10742 }
10766 }; 10743 };
10767 10744
10768 } } // namespace v8::internal 10745 } } // namespace v8::internal
10769 10746
10770 #endif // V8_OBJECTS_H_ 10747 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698