OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 5111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5122 | 5122 |
5123 // Convert an entry address into an object. | 5123 // Convert an entry address into an object. |
5124 static inline Object* GetObjectFromEntryAddress(Address location_of_address); | 5124 static inline Object* GetObjectFromEntryAddress(Address location_of_address); |
5125 | 5125 |
5126 // Returns the address of the first instruction. | 5126 // Returns the address of the first instruction. |
5127 inline byte* instruction_start(); | 5127 inline byte* instruction_start(); |
5128 | 5128 |
5129 // Returns the address right after the last instruction. | 5129 // Returns the address right after the last instruction. |
5130 inline byte* instruction_end(); | 5130 inline byte* instruction_end(); |
5131 | 5131 |
5132 // Returns the size of the instructions, padding, and relocation information. | 5132 // Returns the size of the instructions, padding, relocation and unwinding |
| 5133 // information. |
5133 inline int body_size(); | 5134 inline int body_size(); |
5134 | 5135 |
5135 // Returns the size of code and its metadata. This includes the size of code | 5136 // Returns the size of code and its metadata. This includes the size of code |
5136 // relocation information, deoptimization data and handler table. | 5137 // relocation information, deoptimization data and handler table. |
5137 inline int SizeIncludingMetadata(); | 5138 inline int SizeIncludingMetadata(); |
5138 | 5139 |
5139 // Returns the address of the first relocation info (read backwards!). | 5140 // Returns the address of the first relocation info (read backwards!). |
5140 inline byte* relocation_start(); | 5141 inline byte* relocation_start(); |
5141 | 5142 |
| 5143 // [has_unwinding_info]: Whether this code object has unwinding information. |
| 5144 // If it doesn't, unwinding_information_start() will point to invalid data. |
| 5145 // |
| 5146 // The body of all code objects has the following layout. |
| 5147 // |
| 5148 // +--------------------------+ <-- instruction_start() |
| 5149 // | instructions | |
| 5150 // | ... | |
| 5151 // +--------------------------+ |
| 5152 // | relocation info | |
| 5153 // | ... | |
| 5154 // +--------------------------+ <-- instruction_end() |
| 5155 // |
| 5156 // If has_unwinding_info() is false, instruction_end() points to the first |
| 5157 // memory location after the end of the code object. Otherwise, the body |
| 5158 // continues as follows: |
| 5159 // |
| 5160 // +--------------------------+ |
| 5161 // | padding to the next | |
| 5162 // | 8-byte aligned address | |
| 5163 // +--------------------------+ <-- instruction_end() |
| 5164 // | [unwinding_info_size] | |
| 5165 // | as uint64_t | |
| 5166 // +--------------------------+ <-- unwinding_info_start() |
| 5167 // | unwinding info | |
| 5168 // | ... | |
| 5169 // +--------------------------+ <-- unwinding_info_end() |
| 5170 // |
| 5171 // and unwinding_info_end() points to the first memory location after the end |
| 5172 // of the code object. |
| 5173 // |
| 5174 DECL_BOOLEAN_ACCESSORS(has_unwinding_info) |
| 5175 |
| 5176 // [unwinding_info_size]: Size of the unwinding information. |
| 5177 inline int unwinding_info_size() const; |
| 5178 inline void set_unwinding_info_size(int value); |
| 5179 |
| 5180 // Returns the address of the unwinding information, if any. |
| 5181 inline byte* unwinding_info_start(); |
| 5182 |
| 5183 // Returns the address right after the end of the unwinding information. |
| 5184 inline byte* unwinding_info_end(); |
| 5185 |
5142 // Code entry point. | 5186 // Code entry point. |
5143 inline byte* entry(); | 5187 inline byte* entry(); |
5144 | 5188 |
5145 // Returns true if pc is inside this object's instructions. | 5189 // Returns true if pc is inside this object's instructions. |
5146 inline bool contains(byte* pc); | 5190 inline bool contains(byte* pc); |
5147 | 5191 |
5148 // Relocate the code by delta bytes. Called to signal that this code | 5192 // Relocate the code by delta bytes. Called to signal that this code |
5149 // object has been moved by delta bytes. | 5193 // object has been moved by delta bytes. |
5150 void Relocate(intptr_t delta); | 5194 void Relocate(intptr_t delta); |
5151 | 5195 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5262 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; | 5306 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; |
5263 static const int kBuiltinIndexOffset = | 5307 static const int kBuiltinIndexOffset = |
5264 kConstantPoolOffset + kConstantPoolSize; | 5308 kConstantPoolOffset + kConstantPoolSize; |
5265 static const int kHeaderPaddingStart = kBuiltinIndexOffset + kIntSize; | 5309 static const int kHeaderPaddingStart = kBuiltinIndexOffset + kIntSize; |
5266 | 5310 |
5267 // Add padding to align the instruction start following right after | 5311 // Add padding to align the instruction start following right after |
5268 // the Code object header. | 5312 // the Code object header. |
5269 static const int kHeaderSize = | 5313 static const int kHeaderSize = |
5270 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 5314 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
5271 | 5315 |
| 5316 inline int GetUnwindingInfoSizeOffset() const; |
| 5317 |
5272 class BodyDescriptor; | 5318 class BodyDescriptor; |
5273 | 5319 |
5274 // Byte offsets within kKindSpecificFlags1Offset. | 5320 // Byte offsets within kKindSpecificFlags1Offset. |
5275 static const int kFullCodeFlags = kKindSpecificFlags1Offset; | 5321 static const int kFullCodeFlags = kKindSpecificFlags1Offset; |
5276 class FullCodeFlagsHasDeoptimizationSupportField: | 5322 class FullCodeFlagsHasDeoptimizationSupportField: |
5277 public BitField<bool, 0, 1> {}; // NOLINT | 5323 public BitField<bool, 0, 1> {}; // NOLINT |
5278 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 5324 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
5279 class FullCodeFlagsHasRelocInfoForSerialization | 5325 class FullCodeFlagsHasRelocInfoForSerialization |
5280 : public BitField<bool, 2, 1> {}; | 5326 : public BitField<bool, 2, 1> {}; |
5281 // Bit 3 in this bitfield is unused. | 5327 // Bit 3 in this bitfield is unused. |
5282 class ProfilerTicksField : public BitField<int, 4, 28> {}; | 5328 class ProfilerTicksField : public BitField<int, 4, 28> {}; |
5283 | 5329 |
5284 // Flags layout. BitField<type, shift, size>. | 5330 // Flags layout. BitField<type, shift, size>. |
5285 class ICStateField : public BitField<InlineCacheState, 0, 3> {}; | 5331 class ICStateField : public BitField<InlineCacheState, 0, 3> {}; |
5286 class CacheHolderField | 5332 class CacheHolderField |
5287 : public BitField<CacheHolderFlag, ICStateField::kNext, 2> {}; | 5333 : public BitField<CacheHolderFlag, ICStateField::kNext, 2> {}; |
5288 class KindField : public BitField<Kind, CacheHolderField::kNext, 5> {}; | 5334 class KindField : public BitField<Kind, CacheHolderField::kNext, 5> {}; |
5289 STATIC_ASSERT(NUMBER_OF_KINDS <= KindField::kMax); | 5335 STATIC_ASSERT(NUMBER_OF_KINDS <= KindField::kMax); |
5290 class ExtraICStateField : public BitField<ExtraICState, KindField::kNext, | 5336 class HasUnwindingInfoField : public BitField<bool, KindField::kNext, 1> {}; |
5291 PlatformSmiTagging::kSmiValueSize - | 5337 class ExtraICStateField |
5292 KindField::kNext + 1> {}; | 5338 : public BitField<ExtraICState, HasUnwindingInfoField::kNext, |
| 5339 PlatformSmiTagging::kSmiValueSize - |
| 5340 HasUnwindingInfoField::kNext + 1> {}; |
5293 | 5341 |
5294 // KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION) | 5342 // KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION) |
5295 static const int kStackSlotsFirstBit = 0; | 5343 static const int kStackSlotsFirstBit = 0; |
5296 static const int kStackSlotsBitCount = 24; | 5344 static const int kStackSlotsBitCount = 24; |
5297 static const int kMarkedForDeoptimizationBit = | 5345 static const int kMarkedForDeoptimizationBit = |
5298 kStackSlotsFirstBit + kStackSlotsBitCount; | 5346 kStackSlotsFirstBit + kStackSlotsBitCount; |
5299 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; | 5347 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; |
5300 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; | 5348 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; |
5301 | 5349 |
5302 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); | 5350 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
(...skipping 5512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10815 } | 10863 } |
10816 return value; | 10864 return value; |
10817 } | 10865 } |
10818 }; | 10866 }; |
10819 | 10867 |
10820 | 10868 |
10821 } // NOLINT, false-positive due to second-order macros. | 10869 } // NOLINT, false-positive due to second-order macros. |
10822 } // NOLINT, false-positive due to second-order macros. | 10870 } // NOLINT, false-positive due to second-order macros. |
10823 | 10871 |
10824 #endif // V8_OBJECTS_H_ | 10872 #endif // V8_OBJECTS_H_ |
OLD | NEW |