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 4846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4857 public: | 4857 public: |
4858 // Opaque data type for encapsulating code flags like kind, inline | 4858 // Opaque data type for encapsulating code flags like kind, inline |
4859 // cache state, and arguments count. | 4859 // cache state, and arguments count. |
4860 typedef uint32_t Flags; | 4860 typedef uint32_t Flags; |
4861 | 4861 |
4862 #define NON_IC_KIND_LIST(V) \ | 4862 #define NON_IC_KIND_LIST(V) \ |
4863 V(FUNCTION) \ | 4863 V(FUNCTION) \ |
4864 V(OPTIMIZED_FUNCTION) \ | 4864 V(OPTIMIZED_FUNCTION) \ |
4865 V(BYTECODE_HANDLER) \ | 4865 V(BYTECODE_HANDLER) \ |
4866 V(STUB) \ | 4866 V(STUB) \ |
| 4867 V(DEBUG_STUB) \ |
4867 V(HANDLER) \ | 4868 V(HANDLER) \ |
4868 V(BUILTIN) \ | 4869 V(BUILTIN) \ |
4869 V(REGEXP) \ | 4870 V(REGEXP) \ |
4870 V(WASM_FUNCTION) \ | 4871 V(WASM_FUNCTION) \ |
4871 V(WASM_TO_JS_FUNCTION) \ | 4872 V(WASM_TO_JS_FUNCTION) \ |
4872 V(JS_TO_WASM_FUNCTION) | 4873 V(JS_TO_WASM_FUNCTION) |
4873 | 4874 |
4874 #define IC_KIND_LIST(V) \ | 4875 #define IC_KIND_LIST(V) \ |
4875 V(LOAD_IC) \ | 4876 V(LOAD_IC) \ |
4876 V(KEYED_LOAD_IC) \ | 4877 V(KEYED_LOAD_IC) \ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4962 inline ByteArray* unchecked_relocation_info(); | 4963 inline ByteArray* unchecked_relocation_info(); |
4963 | 4964 |
4964 inline int relocation_size(); | 4965 inline int relocation_size(); |
4965 | 4966 |
4966 // [flags]: Various code flags. | 4967 // [flags]: Various code flags. |
4967 inline Flags flags(); | 4968 inline Flags flags(); |
4968 inline void set_flags(Flags flags); | 4969 inline void set_flags(Flags flags); |
4969 | 4970 |
4970 // [flags]: Access to specific code flags. | 4971 // [flags]: Access to specific code flags. |
4971 inline Kind kind(); | 4972 inline Kind kind(); |
4972 inline InlineCacheState ic_state(); // Only valid for IC stubs. | 4973 InlineCacheState ic_state(); // Only valid for IC stubs. |
4973 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. | 4974 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. |
4974 | 4975 |
4975 // Testers for IC stub kinds. | 4976 // Testers for IC stub kinds. |
4976 inline bool is_inline_cache_stub(); | 4977 inline bool is_inline_cache_stub(); |
4977 inline bool is_debug_stub(); | 4978 inline bool is_debug_stub(); |
4978 inline bool is_handler(); | 4979 inline bool is_handler(); |
4979 inline bool is_call_stub(); | 4980 inline bool is_call_stub(); |
4980 inline bool is_binary_op_stub(); | 4981 inline bool is_binary_op_stub(); |
4981 inline bool is_compare_ic_stub(); | 4982 inline bool is_compare_ic_stub(); |
4982 inline bool is_to_boolean_ic_stub(); | 4983 inline bool is_to_boolean_ic_stub(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5098 // snapshot so that it can be written in one, fast, memcpy during | 5099 // snapshot so that it can be written in one, fast, memcpy during |
5099 // deserialization. The deserializer will overwrite some pointers, rather | 5100 // deserialization. The deserializer will overwrite some pointers, rather |
5100 // like a runtime linker, but the random allocation addresses used in the | 5101 // like a runtime linker, but the random allocation addresses used in the |
5101 // mksnapshot process would still be present in the unlinked snapshot data, | 5102 // mksnapshot process would still be present in the unlinked snapshot data, |
5102 // which would make snapshot production non-reproducible. This method wipes | 5103 // which would make snapshot production non-reproducible. This method wipes |
5103 // out the to-be-overwritten header data for reproducible snapshots. | 5104 // out the to-be-overwritten header data for reproducible snapshots. |
5104 inline void WipeOutHeader(); | 5105 inline void WipeOutHeader(); |
5105 | 5106 |
5106 // Flags operations. | 5107 // Flags operations. |
5107 static inline Flags ComputeFlags( | 5108 static inline Flags ComputeFlags( |
5108 Kind kind, InlineCacheState ic_state = UNINITIALIZED, | |
5109 ExtraICState extra_ic_state = kNoExtraICState, | |
5110 CacheHolderFlag holder = kCacheOnReceiver); | |
5111 | |
5112 static inline Flags ComputeMonomorphicFlags( | |
5113 Kind kind, ExtraICState extra_ic_state = kNoExtraICState, | 5109 Kind kind, ExtraICState extra_ic_state = kNoExtraICState, |
5114 CacheHolderFlag holder = kCacheOnReceiver); | 5110 CacheHolderFlag holder = kCacheOnReceiver); |
5115 | 5111 |
5116 static inline Flags ComputeHandlerFlags( | 5112 static inline Flags ComputeHandlerFlags( |
5117 Kind handler_kind, CacheHolderFlag holder = kCacheOnReceiver); | 5113 Kind handler_kind, CacheHolderFlag holder = kCacheOnReceiver); |
5118 | 5114 |
5119 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); | |
5120 static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); | 5115 static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); |
5121 static inline Kind ExtractKindFromFlags(Flags flags); | 5116 static inline Kind ExtractKindFromFlags(Flags flags); |
5122 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); | 5117 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); |
5123 | 5118 |
5124 static inline Flags RemoveHolderFromFlags(Flags flags); | 5119 static inline Flags RemoveHolderFromFlags(Flags flags); |
5125 | 5120 |
5126 // Convert a target address into a code object. | 5121 // Convert a target address into a code object. |
5127 static inline Code* GetCodeFromTargetAddress(Address address); | 5122 static inline Code* GetCodeFromTargetAddress(Address address); |
5128 | 5123 |
5129 // Convert an entry address into an object. | 5124 // Convert an entry address into an object. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5281 static const int kFullCodeFlags = kKindSpecificFlags1Offset; | 5276 static const int kFullCodeFlags = kKindSpecificFlags1Offset; |
5282 class FullCodeFlagsHasDeoptimizationSupportField: | 5277 class FullCodeFlagsHasDeoptimizationSupportField: |
5283 public BitField<bool, 0, 1> {}; // NOLINT | 5278 public BitField<bool, 0, 1> {}; // NOLINT |
5284 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 5279 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
5285 class FullCodeFlagsHasRelocInfoForSerialization | 5280 class FullCodeFlagsHasRelocInfoForSerialization |
5286 : public BitField<bool, 2, 1> {}; | 5281 : public BitField<bool, 2, 1> {}; |
5287 // Bit 3 in this bitfield is unused. | 5282 // Bit 3 in this bitfield is unused. |
5288 class ProfilerTicksField : public BitField<int, 4, 28> {}; | 5283 class ProfilerTicksField : public BitField<int, 4, 28> {}; |
5289 | 5284 |
5290 // Flags layout. BitField<type, shift, size>. | 5285 // Flags layout. BitField<type, shift, size>. |
5291 class ICStateField : public BitField<InlineCacheState, 0, 3> {}; | 5286 class CacheHolderField : public BitField<CacheHolderFlag, 0, 2> {}; |
5292 class CacheHolderField : public BitField<CacheHolderFlag, 3, 2> {}; | 5287 class KindField : public BitField<Kind, CacheHolderField::kNext, 5> {}; |
5293 class KindField : public BitField<Kind, 5, 5> {}; | 5288 class ExtraICStateField : public BitField<ExtraICState, KindField::kNext, |
5294 class ExtraICStateField | 5289 PlatformSmiTagging::kSmiValueSize - |
5295 : public BitField<ExtraICState, 10, PlatformSmiTagging::kSmiValueSize - | 5290 KindField::kNext + 1> {}; |
5296 10 + 1> {}; // NOLINT | |
5297 | 5291 |
5298 // KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION) | 5292 // KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION) |
5299 static const int kStackSlotsFirstBit = 0; | 5293 static const int kStackSlotsFirstBit = 0; |
5300 static const int kStackSlotsBitCount = 24; | 5294 static const int kStackSlotsBitCount = 24; |
5301 static const int kMarkedForDeoptimizationBit = | 5295 static const int kMarkedForDeoptimizationBit = |
5302 kStackSlotsFirstBit + kStackSlotsBitCount; | 5296 kStackSlotsFirstBit + kStackSlotsBitCount; |
5303 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; | 5297 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; |
5304 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; | 5298 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; |
5305 | 5299 |
5306 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); | 5300 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
(...skipping 5499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10806 } | 10800 } |
10807 return value; | 10801 return value; |
10808 } | 10802 } |
10809 }; | 10803 }; |
10810 | 10804 |
10811 | 10805 |
10812 } // NOLINT, false-positive due to second-order macros. | 10806 } // NOLINT, false-positive due to second-order macros. |
10813 } // NOLINT, false-positive due to second-order macros. | 10807 } // NOLINT, false-positive due to second-order macros. |
10814 | 10808 |
10815 #endif // V8_OBJECTS_H_ | 10809 #endif // V8_OBJECTS_H_ |
OLD | NEW |