OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
(...skipping 5646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5657 Map* FindFirstMap(); | 5657 Map* FindFirstMap(); |
5658 void FindAllMaps(MapHandleList* maps); | 5658 void FindAllMaps(MapHandleList* maps); |
5659 | 5659 |
5660 // Find the first handler in an IC stub. | 5660 // Find the first handler in an IC stub. |
5661 Code* FindFirstHandler(); | 5661 Code* FindFirstHandler(); |
5662 | 5662 |
5663 // Find |length| handlers and put them into |code_list|. Returns false if not | 5663 // Find |length| handlers and put them into |code_list|. Returns false if not |
5664 // enough handlers can be found. | 5664 // enough handlers can be found. |
5665 bool FindHandlers(CodeHandleList* code_list, int length = -1); | 5665 bool FindHandlers(CodeHandleList* code_list, int length = -1); |
5666 | 5666 |
| 5667 // Find the handler for |map|. |
| 5668 MaybeHandle<Code> FindHandlerForMap(Map* map); |
| 5669 |
5667 // Find the first name in an IC stub. | 5670 // Find the first name in an IC stub. |
5668 Name* FindFirstName(); | 5671 Name* FindFirstName(); |
5669 | 5672 |
5670 class FindAndReplacePattern; | 5673 class FindAndReplacePattern; |
5671 // For each (map-to-find, object-to-replace) pair in the pattern, this | 5674 // For each (map-to-find, object-to-replace) pair in the pattern, this |
5672 // function replaces the corresponding placeholder in the code with the | 5675 // function replaces the corresponding placeholder in the code with the |
5673 // object-to-replace. The function assumes that pairs in the pattern come in | 5676 // object-to-replace. The function assumes that pairs in the pattern come in |
5674 // the same order as the placeholders in the code. | 5677 // the same order as the placeholders in the code. |
5675 void FindAndReplace(const FindAndReplacePattern& pattern); | 5678 void FindAndReplace(const FindAndReplacePattern& pattern); |
5676 | 5679 |
5677 // The entire code object including its header is copied verbatim to the | 5680 // The entire code object including its header is copied verbatim to the |
5678 // snapshot so that it can be written in one, fast, memcpy during | 5681 // snapshot so that it can be written in one, fast, memcpy during |
5679 // deserialization. The deserializer will overwrite some pointers, rather | 5682 // deserialization. The deserializer will overwrite some pointers, rather |
5680 // like a runtime linker, but the random allocation addresses used in the | 5683 // like a runtime linker, but the random allocation addresses used in the |
5681 // mksnapshot process would still be present in the unlinked snapshot data, | 5684 // mksnapshot process would still be present in the unlinked snapshot data, |
5682 // which would make snapshot production non-reproducible. This method wipes | 5685 // which would make snapshot production non-reproducible. This method wipes |
5683 // out the to-be-overwritten header data for reproducible snapshots. | 5686 // out the to-be-overwritten header data for reproducible snapshots. |
5684 inline void WipeOutHeader(); | 5687 inline void WipeOutHeader(); |
5685 | 5688 |
5686 // Flags operations. | 5689 // Flags operations. |
5687 static inline Flags ComputeFlags( | 5690 static inline Flags ComputeFlags( |
5688 Kind kind, | 5691 Kind kind, InlineCacheState ic_state = UNINITIALIZED, |
5689 InlineCacheState ic_state = UNINITIALIZED, | 5692 ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, |
5690 ExtraICState extra_ic_state = kNoExtraICState, | 5693 CacheHolderFlag holder = kCacheOnReceiver); |
5691 StubType type = NORMAL, | |
5692 InlineCacheHolderFlag holder = OWN_MAP); | |
5693 | 5694 |
5694 static inline Flags ComputeMonomorphicFlags( | 5695 static inline Flags ComputeMonomorphicFlags( |
5695 Kind kind, | 5696 Kind kind, ExtraICState extra_ic_state = kNoExtraICState, |
5696 ExtraICState extra_ic_state = kNoExtraICState, | 5697 CacheHolderFlag holder = kCacheOnReceiver, StubType type = NORMAL); |
5697 InlineCacheHolderFlag holder = OWN_MAP, | |
5698 StubType type = NORMAL); | |
5699 | 5698 |
5700 static inline Flags ComputeHandlerFlags( | 5699 static inline Flags ComputeHandlerFlags( |
5701 Kind handler_kind, | 5700 Kind handler_kind, StubType type = NORMAL, |
5702 StubType type = NORMAL, | 5701 CacheHolderFlag holder = kCacheOnReceiver); |
5703 InlineCacheHolderFlag holder = OWN_MAP); | |
5704 | 5702 |
5705 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); | 5703 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); |
5706 static inline StubType ExtractTypeFromFlags(Flags flags); | 5704 static inline StubType ExtractTypeFromFlags(Flags flags); |
| 5705 static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); |
5707 static inline Kind ExtractKindFromFlags(Flags flags); | 5706 static inline Kind ExtractKindFromFlags(Flags flags); |
5708 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); | |
5709 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); | 5707 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); |
5710 | 5708 |
5711 static inline Flags RemoveTypeFromFlags(Flags flags); | 5709 static inline Flags RemoveTypeFromFlags(Flags flags); |
| 5710 static inline Flags RemoveTypeAndHolderFromFlags(Flags flags); |
5712 | 5711 |
5713 // Convert a target address into a code object. | 5712 // Convert a target address into a code object. |
5714 static inline Code* GetCodeFromTargetAddress(Address address); | 5713 static inline Code* GetCodeFromTargetAddress(Address address); |
5715 | 5714 |
5716 // Convert an entry address into an object. | 5715 // Convert an entry address into an object. |
5717 static inline Object* GetObjectFromEntryAddress(Address location_of_address); | 5716 static inline Object* GetObjectFromEntryAddress(Address location_of_address); |
5718 | 5717 |
5719 // Returns the address of the first instruction. | 5718 // Returns the address of the first instruction. |
5720 inline byte* instruction_start(); | 5719 inline byte* instruction_start(); |
5721 | 5720 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5867 class FullCodeFlagsHasDeoptimizationSupportField: | 5866 class FullCodeFlagsHasDeoptimizationSupportField: |
5868 public BitField<bool, 0, 1> {}; // NOLINT | 5867 public BitField<bool, 0, 1> {}; // NOLINT |
5869 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 5868 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
5870 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 5869 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |
5871 | 5870 |
5872 static const int kProfilerTicksOffset = kFullCodeFlags + 1; | 5871 static const int kProfilerTicksOffset = kFullCodeFlags + 1; |
5873 | 5872 |
5874 // Flags layout. BitField<type, shift, size>. | 5873 // Flags layout. BitField<type, shift, size>. |
5875 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; | 5874 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; |
5876 class TypeField: public BitField<StubType, 3, 1> {}; | 5875 class TypeField: public BitField<StubType, 3, 1> {}; |
5877 class CacheHolderField: public BitField<InlineCacheHolderFlag, 5, 1> {}; | 5876 class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {}; |
5878 class KindField: public BitField<Kind, 6, 4> {}; | 5877 class KindField: public BitField<Kind, 6, 4> {}; |
5879 // TODO(bmeurer): Bit 10 is available for free use. :-) | 5878 // TODO(bmeurer): Bit 10 is available for free use. :-) |
5880 class ExtraICStateField: public BitField<ExtraICState, 11, | 5879 class ExtraICStateField: public BitField<ExtraICState, 11, |
5881 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT | 5880 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT |
5882 | 5881 |
5883 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 5882 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
5884 static const int kStackSlotsFirstBit = 0; | 5883 static const int kStackSlotsFirstBit = 0; |
5885 static const int kStackSlotsBitCount = 24; | 5884 static const int kStackSlotsBitCount = 24; |
5886 static const int kHasFunctionCacheFirstBit = | 5885 static const int kHasFunctionCacheFirstBit = |
5887 kStackSlotsFirstBit + kStackSlotsBitCount; | 5886 kStackSlotsFirstBit + kStackSlotsBitCount; |
(...skipping 5352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11240 } else { | 11239 } else { |
11241 value &= ~(1 << bit_position); | 11240 value &= ~(1 << bit_position); |
11242 } | 11241 } |
11243 return value; | 11242 return value; |
11244 } | 11243 } |
11245 }; | 11244 }; |
11246 | 11245 |
11247 } } // namespace v8::internal | 11246 } } // namespace v8::internal |
11248 | 11247 |
11249 #endif // V8_OBJECTS_H_ | 11248 #endif // V8_OBJECTS_H_ |
OLD | NEW |