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 4889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4900 STATIC_ASSERT(NUMBER_OF_KINDS <= 32); | 4900 STATIC_ASSERT(NUMBER_OF_KINDS <= 32); |
4901 | 4901 |
4902 static const char* Kind2String(Kind kind); | 4902 static const char* Kind2String(Kind kind); |
4903 | 4903 |
4904 // Types of stubs. | 4904 // Types of stubs. |
4905 enum StubType { | 4905 enum StubType { |
4906 NORMAL, | 4906 NORMAL, |
4907 FAST | 4907 FAST |
4908 }; | 4908 }; |
4909 | 4909 |
| 4910 // Types of wasm functions. |
| 4911 enum WasmFunctionType { |
| 4912 WASM_INNER_FUNCTION, |
| 4913 WASM_TO_JS, |
| 4914 JS_TO_WASM, |
| 4915 }; |
| 4916 |
4910 static const int kPrologueOffsetNotSet = -1; | 4917 static const int kPrologueOffsetNotSet = -1; |
4911 | 4918 |
4912 #ifdef ENABLE_DISASSEMBLER | 4919 #ifdef ENABLE_DISASSEMBLER |
4913 // Printing | 4920 // Printing |
4914 static const char* ICState2String(InlineCacheState state); | 4921 static const char* ICState2String(InlineCacheState state); |
4915 static const char* StubType2String(StubType type); | 4922 static const char* StubType2String(StubType type); |
4916 static void PrintExtraICState(std::ostream& os, // NOLINT | 4923 static void PrintExtraICState(std::ostream& os, // NOLINT |
4917 Kind kind, ExtraICState extra); | 4924 Kind kind, ExtraICState extra); |
4918 void Disassemble(const char* name, std::ostream& os); // NOLINT | 4925 void Disassemble(const char* name, std::ostream& os); // NOLINT |
4919 #endif // ENABLE_DISASSEMBLER | 4926 #endif // ENABLE_DISASSEMBLER |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4977 inline Flags flags(); | 4984 inline Flags flags(); |
4978 inline void set_flags(Flags flags); | 4985 inline void set_flags(Flags flags); |
4979 | 4986 |
4980 // [flags]: Access to specific code flags. | 4987 // [flags]: Access to specific code flags. |
4981 inline Kind kind(); | 4988 inline Kind kind(); |
4982 inline InlineCacheState ic_state(); // Only valid for IC stubs. | 4989 inline InlineCacheState ic_state(); // Only valid for IC stubs. |
4983 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. | 4990 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. |
4984 | 4991 |
4985 inline StubType type(); // Only valid for monomorphic IC stubs. | 4992 inline StubType type(); // Only valid for monomorphic IC stubs. |
4986 | 4993 |
| 4994 inline WasmFunctionType wasm_function_type(); // Only valid for wasm. |
| 4995 |
4987 // Testers for IC stub kinds. | 4996 // Testers for IC stub kinds. |
4988 inline bool is_inline_cache_stub(); | 4997 inline bool is_inline_cache_stub(); |
4989 inline bool is_debug_stub(); | 4998 inline bool is_debug_stub(); |
4990 inline bool is_handler(); | 4999 inline bool is_handler(); |
4991 inline bool is_load_stub(); | 5000 inline bool is_load_stub(); |
4992 inline bool is_keyed_load_stub(); | 5001 inline bool is_keyed_load_stub(); |
4993 inline bool is_store_stub(); | 5002 inline bool is_store_stub(); |
4994 inline bool is_keyed_store_stub(); | 5003 inline bool is_keyed_store_stub(); |
4995 inline bool is_call_stub(); | 5004 inline bool is_call_stub(); |
4996 inline bool is_binary_op_stub(); | 5005 inline bool is_binary_op_stub(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5133 // like a runtime linker, but the random allocation addresses used in the | 5142 // like a runtime linker, but the random allocation addresses used in the |
5134 // mksnapshot process would still be present in the unlinked snapshot data, | 5143 // mksnapshot process would still be present in the unlinked snapshot data, |
5135 // which would make snapshot production non-reproducible. This method wipes | 5144 // which would make snapshot production non-reproducible. This method wipes |
5136 // out the to-be-overwritten header data for reproducible snapshots. | 5145 // out the to-be-overwritten header data for reproducible snapshots. |
5137 inline void WipeOutHeader(); | 5146 inline void WipeOutHeader(); |
5138 | 5147 |
5139 // Flags operations. | 5148 // Flags operations. |
5140 static inline Flags ComputeFlags( | 5149 static inline Flags ComputeFlags( |
5141 Kind kind, InlineCacheState ic_state = UNINITIALIZED, | 5150 Kind kind, InlineCacheState ic_state = UNINITIALIZED, |
5142 ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, | 5151 ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, |
5143 CacheHolderFlag holder = kCacheOnReceiver); | 5152 CacheHolderFlag holder = kCacheOnReceiver, |
| 5153 WasmFunctionType = WASM_INNER_FUNCTION); |
| 5154 |
| 5155 static inline Flags ComputeWasmFlags(Kind kind, |
| 5156 WasmFunctionType = WASM_INNER_FUNCTION); |
5144 | 5157 |
5145 static inline Flags ComputeMonomorphicFlags( | 5158 static inline Flags ComputeMonomorphicFlags( |
5146 Kind kind, ExtraICState extra_ic_state = kNoExtraICState, | 5159 Kind kind, ExtraICState extra_ic_state = kNoExtraICState, |
5147 CacheHolderFlag holder = kCacheOnReceiver, StubType type = NORMAL); | 5160 CacheHolderFlag holder = kCacheOnReceiver, StubType type = NORMAL); |
5148 | 5161 |
5149 static inline Flags ComputeHandlerFlags( | 5162 static inline Flags ComputeHandlerFlags( |
5150 Kind handler_kind, StubType type = NORMAL, | 5163 Kind handler_kind, StubType type = NORMAL, |
5151 CacheHolderFlag holder = kCacheOnReceiver); | 5164 CacheHolderFlag holder = kCacheOnReceiver); |
5152 | 5165 |
5153 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); | 5166 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); |
5154 static inline StubType ExtractTypeFromFlags(Flags flags); | 5167 static inline StubType ExtractTypeFromFlags(Flags flags); |
| 5168 static inline WasmFunctionType ExtractWasmFunctionTypeFromFlags(Flags flags); |
5155 static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); | 5169 static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); |
5156 static inline Kind ExtractKindFromFlags(Flags flags); | 5170 static inline Kind ExtractKindFromFlags(Flags flags); |
5157 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); | 5171 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); |
5158 | 5172 |
5159 static inline Flags RemoveTypeFromFlags(Flags flags); | 5173 static inline Flags RemoveTypeFromFlags(Flags flags); |
5160 static inline Flags RemoveTypeAndHolderFromFlags(Flags flags); | 5174 static inline Flags RemoveTypeAndHolderFromFlags(Flags flags); |
5161 | 5175 |
5162 // Convert a target address into a code object. | 5176 // Convert a target address into a code object. |
5163 static inline Code* GetCodeFromTargetAddress(Address address); | 5177 static inline Code* GetCodeFromTargetAddress(Address address); |
5164 | 5178 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5316 class FullCodeFlagsHasRelocInfoForSerialization | 5330 class FullCodeFlagsHasRelocInfoForSerialization |
5317 : public BitField<bool, 2, 1> {}; | 5331 : public BitField<bool, 2, 1> {}; |
5318 // Bit 3 in this bitfield is unused. | 5332 // Bit 3 in this bitfield is unused. |
5319 class ProfilerTicksField : public BitField<int, 4, 28> {}; | 5333 class ProfilerTicksField : public BitField<int, 4, 28> {}; |
5320 | 5334 |
5321 // Flags layout. BitField<type, shift, size>. | 5335 // Flags layout. BitField<type, shift, size>. |
5322 class ICStateField : public BitField<InlineCacheState, 0, 3> {}; | 5336 class ICStateField : public BitField<InlineCacheState, 0, 3> {}; |
5323 class TypeField : public BitField<StubType, 3, 1> {}; | 5337 class TypeField : public BitField<StubType, 3, 1> {}; |
5324 class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {}; | 5338 class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {}; |
5325 class KindField : public BitField<Kind, 6, 5> {}; | 5339 class KindField : public BitField<Kind, 6, 5> {}; |
5326 class ExtraICStateField: public BitField<ExtraICState, 11, | 5340 class WasmFunctionTypeField : public BitField<WasmFunctionType, 11, 2> {}; |
5327 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT | 5341 class ExtraICStateField |
| 5342 : public BitField<ExtraICState, 13, PlatformSmiTagging::kSmiValueSize - |
| 5343 13 + 1> {}; // NOLINT |
5328 | 5344 |
5329 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 5345 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
5330 static const int kStackSlotsFirstBit = 0; | 5346 static const int kStackSlotsFirstBit = 0; |
5331 static const int kStackSlotsBitCount = 24; | 5347 static const int kStackSlotsBitCount = 24; |
5332 static const int kMarkedForDeoptimizationBit = | 5348 static const int kMarkedForDeoptimizationBit = |
5333 kStackSlotsFirstBit + kStackSlotsBitCount; | 5349 kStackSlotsFirstBit + kStackSlotsBitCount; |
5334 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; | 5350 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; |
5335 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; | 5351 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; |
5336 | 5352 |
5337 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); | 5353 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
(...skipping 5523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10861 } | 10877 } |
10862 return value; | 10878 return value; |
10863 } | 10879 } |
10864 }; | 10880 }; |
10865 | 10881 |
10866 | 10882 |
10867 } // NOLINT, false-positive due to second-order macros. | 10883 } // NOLINT, false-positive due to second-order macros. |
10868 } // NOLINT, false-positive due to second-order macros. | 10884 } // NOLINT, false-positive due to second-order macros. |
10869 | 10885 |
10870 #endif // V8_OBJECTS_H_ | 10886 #endif // V8_OBJECTS_H_ |
OLD | NEW |