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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 V(ACCESS_CHECK_INFO_TYPE) \ | 391 V(ACCESS_CHECK_INFO_TYPE) \ |
392 V(INTERCEPTOR_INFO_TYPE) \ | 392 V(INTERCEPTOR_INFO_TYPE) \ |
393 V(CALL_HANDLER_INFO_TYPE) \ | 393 V(CALL_HANDLER_INFO_TYPE) \ |
394 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 394 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
395 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 395 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
396 V(SIGNATURE_INFO_TYPE) \ | 396 V(SIGNATURE_INFO_TYPE) \ |
397 V(TYPE_SWITCH_INFO_TYPE) \ | 397 V(TYPE_SWITCH_INFO_TYPE) \ |
398 V(ALLOCATION_MEMENTO_TYPE) \ | 398 V(ALLOCATION_MEMENTO_TYPE) \ |
399 V(ALLOCATION_SITE_TYPE) \ | 399 V(ALLOCATION_SITE_TYPE) \ |
400 V(SCRIPT_TYPE) \ | 400 V(SCRIPT_TYPE) \ |
401 V(CODE_CACHE_TYPE) \ | |
402 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | |
403 V(TYPE_FEEDBACK_INFO_TYPE) \ | 401 V(TYPE_FEEDBACK_INFO_TYPE) \ |
404 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 402 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
405 V(BOX_TYPE) \ | 403 V(BOX_TYPE) \ |
406 V(PROTOTYPE_INFO_TYPE) \ | 404 V(PROTOTYPE_INFO_TYPE) \ |
407 V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE) \ | 405 V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE) \ |
408 \ | 406 \ |
409 V(FIXED_ARRAY_TYPE) \ | 407 V(FIXED_ARRAY_TYPE) \ |
410 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 408 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
411 V(SHARED_FUNCTION_INFO_TYPE) \ | 409 V(SHARED_FUNCTION_INFO_TYPE) \ |
412 V(WEAK_CELL_TYPE) \ | 410 V(WEAK_CELL_TYPE) \ |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ | 505 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
508 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 506 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
509 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 507 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
510 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 508 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
511 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 509 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
512 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 510 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
513 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 511 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
514 V(SCRIPT, Script, script) \ | 512 V(SCRIPT, Script, script) \ |
515 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 513 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
516 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 514 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
517 V(CODE_CACHE, CodeCache, code_cache) \ | |
518 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ | |
519 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 515 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
520 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ | 516 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
521 V(DEBUG_INFO, DebugInfo, debug_info) \ | 517 V(DEBUG_INFO, DebugInfo, debug_info) \ |
522 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ | 518 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ |
523 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ | 519 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ |
524 V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION, \ | 520 V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION, \ |
525 SloppyBlockWithEvalContextExtension, \ | 521 SloppyBlockWithEvalContextExtension, \ |
526 sloppy_block_with_eval_context_extension) | 522 sloppy_block_with_eval_context_extension) |
527 | 523 |
528 // We use the full 8 bits of the instance_type field to encode heap object | 524 // We use the full 8 bits of the instance_type field to encode heap object |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 ACCESS_CHECK_INFO_TYPE, | 674 ACCESS_CHECK_INFO_TYPE, |
679 INTERCEPTOR_INFO_TYPE, | 675 INTERCEPTOR_INFO_TYPE, |
680 CALL_HANDLER_INFO_TYPE, | 676 CALL_HANDLER_INFO_TYPE, |
681 FUNCTION_TEMPLATE_INFO_TYPE, | 677 FUNCTION_TEMPLATE_INFO_TYPE, |
682 OBJECT_TEMPLATE_INFO_TYPE, | 678 OBJECT_TEMPLATE_INFO_TYPE, |
683 SIGNATURE_INFO_TYPE, | 679 SIGNATURE_INFO_TYPE, |
684 TYPE_SWITCH_INFO_TYPE, | 680 TYPE_SWITCH_INFO_TYPE, |
685 ALLOCATION_SITE_TYPE, | 681 ALLOCATION_SITE_TYPE, |
686 ALLOCATION_MEMENTO_TYPE, | 682 ALLOCATION_MEMENTO_TYPE, |
687 SCRIPT_TYPE, | 683 SCRIPT_TYPE, |
688 CODE_CACHE_TYPE, | |
689 POLYMORPHIC_CODE_CACHE_TYPE, | |
690 TYPE_FEEDBACK_INFO_TYPE, | 684 TYPE_FEEDBACK_INFO_TYPE, |
691 ALIASED_ARGUMENTS_ENTRY_TYPE, | 685 ALIASED_ARGUMENTS_ENTRY_TYPE, |
692 BOX_TYPE, | 686 BOX_TYPE, |
693 DEBUG_INFO_TYPE, | 687 DEBUG_INFO_TYPE, |
694 BREAK_POINT_INFO_TYPE, | 688 BREAK_POINT_INFO_TYPE, |
695 FIXED_ARRAY_TYPE, | 689 FIXED_ARRAY_TYPE, |
696 SHARED_FUNCTION_INFO_TYPE, | 690 SHARED_FUNCTION_INFO_TYPE, |
697 CELL_TYPE, | 691 CELL_TYPE, |
698 WEAK_CELL_TYPE, | 692 WEAK_CELL_TYPE, |
699 TRANSITION_ARRAY_TYPE, | 693 TRANSITION_ARRAY_TYPE, |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 V(JSWeakMap) \ | 968 V(JSWeakMap) \ |
975 V(JSWeakSet) \ | 969 V(JSWeakSet) \ |
976 V(JSRegExp) \ | 970 V(JSRegExp) \ |
977 V(HashTable) \ | 971 V(HashTable) \ |
978 V(Dictionary) \ | 972 V(Dictionary) \ |
979 V(StringTable) \ | 973 V(StringTable) \ |
980 V(StringSet) \ | 974 V(StringSet) \ |
981 V(NormalizedMapCache) \ | 975 V(NormalizedMapCache) \ |
982 V(CompilationCacheTable) \ | 976 V(CompilationCacheTable) \ |
983 V(CodeCacheHashTable) \ | 977 V(CodeCacheHashTable) \ |
984 V(PolymorphicCodeCacheHashTable) \ | |
985 V(MapCache) \ | 978 V(MapCache) \ |
986 V(JSGlobalObject) \ | 979 V(JSGlobalObject) \ |
987 V(JSGlobalProxy) \ | 980 V(JSGlobalProxy) \ |
988 V(Undetectable) \ | 981 V(Undetectable) \ |
989 V(AccessCheckNeeded) \ | 982 V(AccessCheckNeeded) \ |
990 V(Callable) \ | 983 V(Callable) \ |
991 V(Function) \ | 984 V(Function) \ |
992 V(Constructor) \ | 985 V(Constructor) \ |
993 V(TemplateInfo) \ | 986 V(TemplateInfo) \ |
994 V(Filler) \ | 987 V(Filler) \ |
(...skipping 3939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4934 #undef DEFINE_CODE_KIND_ENUM | 4927 #undef DEFINE_CODE_KIND_ENUM |
4935 NUMBER_OF_KINDS | 4928 NUMBER_OF_KINDS |
4936 }; | 4929 }; |
4937 | 4930 |
4938 // No more than 32 kinds. The value is currently encoded in five bits in | 4931 // No more than 32 kinds. The value is currently encoded in five bits in |
4939 // Flags. | 4932 // Flags. |
4940 STATIC_ASSERT(NUMBER_OF_KINDS <= 32); | 4933 STATIC_ASSERT(NUMBER_OF_KINDS <= 32); |
4941 | 4934 |
4942 static const char* Kind2String(Kind kind); | 4935 static const char* Kind2String(Kind kind); |
4943 | 4936 |
4944 // Types of stubs. | |
4945 enum StubType { | |
4946 NORMAL, | |
4947 FAST | |
4948 }; | |
4949 | |
4950 static const int kPrologueOffsetNotSet = -1; | 4937 static const int kPrologueOffsetNotSet = -1; |
4951 | 4938 |
4952 #ifdef ENABLE_DISASSEMBLER | 4939 #ifdef ENABLE_DISASSEMBLER |
4953 // Printing | 4940 // Printing |
4954 static const char* ICState2String(InlineCacheState state); | 4941 static const char* ICState2String(InlineCacheState state); |
4955 static const char* StubType2String(StubType type); | |
4956 static void PrintExtraICState(std::ostream& os, // NOLINT | 4942 static void PrintExtraICState(std::ostream& os, // NOLINT |
4957 Kind kind, ExtraICState extra); | 4943 Kind kind, ExtraICState extra); |
4958 void Disassemble(const char* name, std::ostream& os); // NOLINT | 4944 void Disassemble(const char* name, std::ostream& os); // NOLINT |
4959 #endif // ENABLE_DISASSEMBLER | 4945 #endif // ENABLE_DISASSEMBLER |
4960 | 4946 |
4961 // [instruction_size]: Size of the native instructions | 4947 // [instruction_size]: Size of the native instructions |
4962 inline int instruction_size() const; | 4948 inline int instruction_size() const; |
4963 inline void set_instruction_size(int value); | 4949 inline void set_instruction_size(int value); |
4964 | 4950 |
4965 // [relocation_info]: Code relocation information | 4951 // [relocation_info]: Code relocation information |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5015 | 5001 |
5016 // [flags]: Various code flags. | 5002 // [flags]: Various code flags. |
5017 inline Flags flags(); | 5003 inline Flags flags(); |
5018 inline void set_flags(Flags flags); | 5004 inline void set_flags(Flags flags); |
5019 | 5005 |
5020 // [flags]: Access to specific code flags. | 5006 // [flags]: Access to specific code flags. |
5021 inline Kind kind(); | 5007 inline Kind kind(); |
5022 inline InlineCacheState ic_state(); // Only valid for IC stubs. | 5008 inline InlineCacheState ic_state(); // Only valid for IC stubs. |
5023 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. | 5009 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. |
5024 | 5010 |
5025 inline StubType type(); // Only valid for monomorphic IC stubs. | |
5026 | |
5027 // Testers for IC stub kinds. | 5011 // Testers for IC stub kinds. |
5028 inline bool is_inline_cache_stub(); | 5012 inline bool is_inline_cache_stub(); |
5029 inline bool is_debug_stub(); | 5013 inline bool is_debug_stub(); |
5030 inline bool is_handler(); | 5014 inline bool is_handler(); |
5031 inline bool is_load_stub(); | 5015 inline bool is_load_stub(); |
5032 inline bool is_keyed_load_stub(); | 5016 inline bool is_keyed_load_stub(); |
5033 inline bool is_store_stub(); | 5017 inline bool is_store_stub(); |
5034 inline bool is_keyed_store_stub(); | 5018 inline bool is_keyed_store_stub(); |
5035 inline bool is_call_stub(); | 5019 inline bool is_call_stub(); |
5036 inline bool is_binary_op_stub(); | 5020 inline bool is_binary_op_stub(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5172 // deserialization. The deserializer will overwrite some pointers, rather | 5156 // deserialization. The deserializer will overwrite some pointers, rather |
5173 // like a runtime linker, but the random allocation addresses used in the | 5157 // like a runtime linker, but the random allocation addresses used in the |
5174 // mksnapshot process would still be present in the unlinked snapshot data, | 5158 // mksnapshot process would still be present in the unlinked snapshot data, |
5175 // which would make snapshot production non-reproducible. This method wipes | 5159 // which would make snapshot production non-reproducible. This method wipes |
5176 // out the to-be-overwritten header data for reproducible snapshots. | 5160 // out the to-be-overwritten header data for reproducible snapshots. |
5177 inline void WipeOutHeader(); | 5161 inline void WipeOutHeader(); |
5178 | 5162 |
5179 // Flags operations. | 5163 // Flags operations. |
5180 static inline Flags ComputeFlags( | 5164 static inline Flags ComputeFlags( |
5181 Kind kind, InlineCacheState ic_state = UNINITIALIZED, | 5165 Kind kind, InlineCacheState ic_state = UNINITIALIZED, |
5182 ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, | 5166 ExtraICState extra_ic_state = kNoExtraICState, |
5183 CacheHolderFlag holder = kCacheOnReceiver); | 5167 CacheHolderFlag holder = kCacheOnReceiver); |
5184 | 5168 |
5185 static inline Flags ComputeMonomorphicFlags( | 5169 static inline Flags ComputeMonomorphicFlags( |
5186 Kind kind, ExtraICState extra_ic_state = kNoExtraICState, | 5170 Kind kind, ExtraICState extra_ic_state = kNoExtraICState, |
5187 CacheHolderFlag holder = kCacheOnReceiver, StubType type = NORMAL); | 5171 CacheHolderFlag holder = kCacheOnReceiver); |
5188 | 5172 |
5189 static inline Flags ComputeHandlerFlags( | 5173 static inline Flags ComputeHandlerFlags( |
5190 Kind handler_kind, StubType type = NORMAL, | 5174 Kind handler_kind, CacheHolderFlag holder = kCacheOnReceiver); |
5191 CacheHolderFlag holder = kCacheOnReceiver); | |
5192 | 5175 |
5193 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); | 5176 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); |
5194 static inline StubType ExtractTypeFromFlags(Flags flags); | |
5195 static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); | 5177 static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); |
5196 static inline Kind ExtractKindFromFlags(Flags flags); | 5178 static inline Kind ExtractKindFromFlags(Flags flags); |
5197 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); | 5179 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); |
5198 | 5180 |
5199 static inline Flags RemoveTypeFromFlags(Flags flags); | 5181 static inline Flags RemoveHolderFromFlags(Flags flags); |
5200 static inline Flags RemoveTypeAndHolderFromFlags(Flags flags); | |
5201 | 5182 |
5202 // Convert a target address into a code object. | 5183 // Convert a target address into a code object. |
5203 static inline Code* GetCodeFromTargetAddress(Address address); | 5184 static inline Code* GetCodeFromTargetAddress(Address address); |
5204 | 5185 |
5205 // Convert an entry address into an object. | 5186 // Convert an entry address into an object. |
5206 static inline Object* GetObjectFromEntryAddress(Address location_of_address); | 5187 static inline Object* GetObjectFromEntryAddress(Address location_of_address); |
5207 | 5188 |
5208 // Returns the address of the first instruction. | 5189 // Returns the address of the first instruction. |
5209 inline byte* instruction_start(); | 5190 inline byte* instruction_start(); |
5210 | 5191 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5355 class FullCodeFlagsHasDeoptimizationSupportField: | 5336 class FullCodeFlagsHasDeoptimizationSupportField: |
5356 public BitField<bool, 0, 1> {}; // NOLINT | 5337 public BitField<bool, 0, 1> {}; // NOLINT |
5357 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 5338 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
5358 class FullCodeFlagsHasRelocInfoForSerialization | 5339 class FullCodeFlagsHasRelocInfoForSerialization |
5359 : public BitField<bool, 2, 1> {}; | 5340 : public BitField<bool, 2, 1> {}; |
5360 // Bit 3 in this bitfield is unused. | 5341 // Bit 3 in this bitfield is unused. |
5361 class ProfilerTicksField : public BitField<int, 4, 28> {}; | 5342 class ProfilerTicksField : public BitField<int, 4, 28> {}; |
5362 | 5343 |
5363 // Flags layout. BitField<type, shift, size>. | 5344 // Flags layout. BitField<type, shift, size>. |
5364 class ICStateField : public BitField<InlineCacheState, 0, 3> {}; | 5345 class ICStateField : public BitField<InlineCacheState, 0, 3> {}; |
5365 class TypeField : public BitField<StubType, 3, 1> {}; | 5346 class CacheHolderField : public BitField<CacheHolderFlag, 3, 2> {}; |
5366 class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {}; | 5347 class KindField : public BitField<Kind, 5, 5> {}; |
5367 class KindField : public BitField<Kind, 6, 5> {}; | |
5368 class ExtraICStateField | 5348 class ExtraICStateField |
5369 : public BitField<ExtraICState, 11, PlatformSmiTagging::kSmiValueSize - | 5349 : public BitField<ExtraICState, 10, PlatformSmiTagging::kSmiValueSize - |
5370 11 + 1> {}; // NOLINT | 5350 10 + 1> {}; // NOLINT |
5371 | 5351 |
5372 // KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION) | 5352 // KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION) |
5373 static const int kStackSlotsFirstBit = 0; | 5353 static const int kStackSlotsFirstBit = 0; |
5374 static const int kStackSlotsBitCount = 24; | 5354 static const int kStackSlotsBitCount = 24; |
5375 static const int kMarkedForDeoptimizationBit = | 5355 static const int kMarkedForDeoptimizationBit = |
5376 kStackSlotsFirstBit + kStackSlotsBitCount; | 5356 kStackSlotsFirstBit + kStackSlotsBitCount; |
5377 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; | 5357 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; |
5378 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; | 5358 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; |
5379 | 5359 |
5380 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); | 5360 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
(...skipping 29 matching lines...) Expand all Loading... |
5410 class BackEdgeTableOffsetField: public BitField<int, | 5390 class BackEdgeTableOffsetField: public BitField<int, |
5411 kIsCrankshaftedBit + 1, 27> {}; // NOLINT | 5391 kIsCrankshaftedBit + 1, 27> {}; // NOLINT |
5412 class AllowOSRAtLoopNestingLevelField: public BitField<int, | 5392 class AllowOSRAtLoopNestingLevelField: public BitField<int, |
5413 kIsCrankshaftedBit + 1 + 27, 4> {}; // NOLINT | 5393 kIsCrankshaftedBit + 1 + 27, 4> {}; // NOLINT |
5414 STATIC_ASSERT(AllowOSRAtLoopNestingLevelField::kMax >= kMaxLoopNestingMarker); | 5394 STATIC_ASSERT(AllowOSRAtLoopNestingLevelField::kMax >= kMaxLoopNestingMarker); |
5415 | 5395 |
5416 static const int kArgumentsBits = 16; | 5396 static const int kArgumentsBits = 16; |
5417 static const int kMaxArguments = (1 << kArgumentsBits) - 1; | 5397 static const int kMaxArguments = (1 << kArgumentsBits) - 1; |
5418 | 5398 |
5419 // This constant should be encodable in an ARM instruction. | 5399 // This constant should be encodable in an ARM instruction. |
5420 static const int kFlagsNotUsedInLookup = | 5400 static const int kFlagsNotUsedInLookup = CacheHolderField::kMask; |
5421 TypeField::kMask | CacheHolderField::kMask; | |
5422 | 5401 |
5423 private: | 5402 private: |
5424 friend class RelocIterator; | 5403 friend class RelocIterator; |
5425 friend class Deoptimizer; // For FindCodeAgeSequence. | 5404 friend class Deoptimizer; // For FindCodeAgeSequence. |
5426 | 5405 |
5427 void ClearInlineCaches(Kind* kind); | 5406 void ClearInlineCaches(Kind* kind); |
5428 | 5407 |
5429 // Code aging | 5408 // Code aging |
5430 byte* FindCodeAgeSequence(); | 5409 byte* FindCodeAgeSequence(); |
5431 static void GetCodeAgeAndParity(Code* code, Age* age, | 5410 static void GetCodeAgeAndParity(Code* code, Age* age, |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6071 | 6050 |
6072 // Extend the descriptor array of the map with the list of descriptors. | 6051 // Extend the descriptor array of the map with the list of descriptors. |
6073 // In case of duplicates, the latest descriptor is used. | 6052 // In case of duplicates, the latest descriptor is used. |
6074 static void AppendCallbackDescriptors(Handle<Map> map, | 6053 static void AppendCallbackDescriptors(Handle<Map> map, |
6075 Handle<Object> descriptors); | 6054 Handle<Object> descriptors); |
6076 | 6055 |
6077 static inline int SlackForArraySize(int old_size, int size_limit); | 6056 static inline int SlackForArraySize(int old_size, int size_limit); |
6078 | 6057 |
6079 static void EnsureDescriptorSlack(Handle<Map> map, int slack); | 6058 static void EnsureDescriptorSlack(Handle<Map> map, int slack); |
6080 | 6059 |
6081 // Returns the found code or undefined if absent. | 6060 Code* LookupInCodeCache(Name* name, Code::Flags code); |
6082 Object* FindInCodeCache(Name* name, Code::Flags flags); | |
6083 | |
6084 // Returns the non-negative index of the code object if it is in the | |
6085 // cache and -1 otherwise. | |
6086 int IndexInCodeCache(Object* name, Code* code); | |
6087 | |
6088 // Removes a code object from the code cache at the given index. | |
6089 void RemoveFromCodeCache(Name* name, Code* code, int index); | |
6090 | 6061 |
6091 // Computes a hash value for this map, to be used in HashTables and such. | 6062 // Computes a hash value for this map, to be used in HashTables and such. |
6092 int Hash(); | 6063 int Hash(); |
6093 | 6064 |
6094 // Returns the map that this map transitions to if its elements_kind | 6065 // Returns the map that this map transitions to if its elements_kind |
6095 // is changed to |elements_kind|, or NULL if no such map is cached yet. | 6066 // is changed to |elements_kind|, or NULL if no such map is cached yet. |
6096 // |safe_to_add_transitions| is set to false if adding transitions is not | 6067 // |safe_to_add_transitions| is set to false if adding transitions is not |
6097 // allowed. | 6068 // allowed. |
6098 Map* LookupElementsTransitionMap(ElementsKind elements_kind); | 6069 Map* LookupElementsTransitionMap(ElementsKind elements_kind); |
6099 | 6070 |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8122 void Age(); | 8093 void Age(); |
8123 static const int kHashGenerations = 10; | 8094 static const int kHashGenerations = 10; |
8124 | 8095 |
8125 DECLARE_CAST(CompilationCacheTable) | 8096 DECLARE_CAST(CompilationCacheTable) |
8126 | 8097 |
8127 private: | 8098 private: |
8128 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); | 8099 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); |
8129 }; | 8100 }; |
8130 | 8101 |
8131 | 8102 |
8132 class CodeCache: public Struct { | |
8133 public: | |
8134 DECL_ACCESSORS(default_cache, FixedArray) | |
8135 DECL_ACCESSORS(normal_type_cache, Object) | |
8136 | |
8137 // Add the code object to the cache. | |
8138 static void Update( | |
8139 Handle<CodeCache> cache, Handle<Name> name, Handle<Code> code); | |
8140 | |
8141 // Lookup code object in the cache. Returns code object if found and undefined | |
8142 // if not. | |
8143 Object* Lookup(Name* name, Code::Flags flags); | |
8144 | |
8145 // Get the internal index of a code object in the cache. Returns -1 if the | |
8146 // code object is not in that cache. This index can be used to later call | |
8147 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and | |
8148 // RemoveByIndex. | |
8149 int GetIndex(Object* name, Code* code); | |
8150 | |
8151 // Remove an object from the cache with the provided internal index. | |
8152 void RemoveByIndex(Object* name, Code* code, int index); | |
8153 | |
8154 DECLARE_CAST(CodeCache) | |
8155 | |
8156 // Dispatched behavior. | |
8157 DECLARE_PRINTER(CodeCache) | |
8158 DECLARE_VERIFIER(CodeCache) | |
8159 | |
8160 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; | |
8161 static const int kNormalTypeCacheOffset = | |
8162 kDefaultCacheOffset + kPointerSize; | |
8163 static const int kSize = kNormalTypeCacheOffset + kPointerSize; | |
8164 | |
8165 private: | |
8166 static void UpdateDefaultCache( | |
8167 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code); | |
8168 static void UpdateNormalTypeCache( | |
8169 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code); | |
8170 Object* LookupDefaultCache(Name* name, Code::Flags flags); | |
8171 Object* LookupNormalTypeCache(Name* name, Code::Flags flags); | |
8172 | |
8173 // Code cache layout of the default cache. Elements are alternating name and | |
8174 // code objects for non normal load/store/call IC's. | |
8175 static const int kCodeCacheEntrySize = 2; | |
8176 static const int kCodeCacheEntryNameOffset = 0; | |
8177 static const int kCodeCacheEntryCodeOffset = 1; | |
8178 | |
8179 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); | |
8180 }; | |
8181 | |
8182 | |
8183 class CodeCacheHashTableShape : public BaseShape<HashTableKey*> { | 8103 class CodeCacheHashTableShape : public BaseShape<HashTableKey*> { |
8184 public: | 8104 public: |
8185 static inline bool IsMatch(HashTableKey* key, Object* value) { | 8105 static inline bool IsMatch(HashTableKey* key, Object* value) { |
8186 return key->IsMatch(value); | 8106 return key->IsMatch(value); |
8187 } | 8107 } |
8188 | 8108 |
8189 static inline uint32_t Hash(HashTableKey* key) { | 8109 static inline uint32_t Hash(HashTableKey* key) { |
8190 return key->Hash(); | 8110 return key->Hash(); |
8191 } | 8111 } |
8192 | 8112 |
8193 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 8113 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
8194 return key->HashForObject(object); | 8114 return key->HashForObject(object); |
8195 } | 8115 } |
8196 | 8116 |
8197 static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key); | 8117 static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key); |
8198 | 8118 |
8199 static const int kPrefixSize = 0; | 8119 static const int kPrefixSize = 0; |
8200 static const int kEntrySize = 2; | 8120 // The both the key (name + flags) and value (code object) can be derived from |
| 8121 // the fixed array that stores both the name and code. |
| 8122 // TODO(verwaest): Don't allocate a fixed array but inline name and code. |
| 8123 // Rewrite IsMatch to get table + index as input rather than just the raw key. |
| 8124 static const int kEntrySize = 1; |
8201 }; | 8125 }; |
8202 | 8126 |
8203 | 8127 |
8204 class CodeCacheHashTable: public HashTable<CodeCacheHashTable, | 8128 class CodeCacheHashTable: public HashTable<CodeCacheHashTable, |
8205 CodeCacheHashTableShape, | 8129 CodeCacheHashTableShape, |
8206 HashTableKey*> { | 8130 HashTableKey*> { |
8207 public: | 8131 public: |
8208 Object* Lookup(Name* name, Code::Flags flags); | |
8209 static Handle<CodeCacheHashTable> Put( | 8132 static Handle<CodeCacheHashTable> Put( |
8210 Handle<CodeCacheHashTable> table, | 8133 Handle<CodeCacheHashTable> table, |
8211 Handle<Name> name, | 8134 Handle<Name> name, |
8212 Handle<Code> code); | 8135 Handle<Code> code); |
8213 | 8136 |
8214 int GetIndex(Name* name, Code::Flags flags); | 8137 Code* Lookup(Name* name, Code::Flags flags); |
8215 void RemoveByIndex(int index); | |
8216 | 8138 |
8217 DECLARE_CAST(CodeCacheHashTable) | 8139 DECLARE_CAST(CodeCacheHashTable) |
8218 | 8140 |
8219 // Initial size of the fixed array backing the hash table. | 8141 // Initial size of the fixed array backing the hash table. |
8220 static const int kInitialSize = 64; | 8142 static const int kInitialSize = 16; |
8221 | 8143 |
8222 private: | 8144 private: |
8223 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); | 8145 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); |
8224 }; | 8146 }; |
8225 | 8147 |
8226 | 8148 |
8227 class PolymorphicCodeCache: public Struct { | |
8228 public: | |
8229 DECL_ACCESSORS(cache, Object) | |
8230 | |
8231 static void Update(Handle<PolymorphicCodeCache> cache, | |
8232 MapHandleList* maps, | |
8233 Code::Flags flags, | |
8234 Handle<Code> code); | |
8235 | |
8236 | |
8237 // Returns an undefined value if the entry is not found. | |
8238 Handle<Object> Lookup(MapHandleList* maps, Code::Flags flags); | |
8239 | |
8240 DECLARE_CAST(PolymorphicCodeCache) | |
8241 | |
8242 // Dispatched behavior. | |
8243 DECLARE_PRINTER(PolymorphicCodeCache) | |
8244 DECLARE_VERIFIER(PolymorphicCodeCache) | |
8245 | |
8246 static const int kCacheOffset = HeapObject::kHeaderSize; | |
8247 static const int kSize = kCacheOffset + kPointerSize; | |
8248 | |
8249 private: | |
8250 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); | |
8251 }; | |
8252 | |
8253 | |
8254 class PolymorphicCodeCacheHashTable | |
8255 : public HashTable<PolymorphicCodeCacheHashTable, | |
8256 CodeCacheHashTableShape, | |
8257 HashTableKey*> { | |
8258 public: | |
8259 Object* Lookup(MapHandleList* maps, int code_kind); | |
8260 | |
8261 static Handle<PolymorphicCodeCacheHashTable> Put( | |
8262 Handle<PolymorphicCodeCacheHashTable> hash_table, | |
8263 MapHandleList* maps, | |
8264 int code_kind, | |
8265 Handle<Code> code); | |
8266 | |
8267 DECLARE_CAST(PolymorphicCodeCacheHashTable) | |
8268 | |
8269 static const int kInitialSize = 64; | |
8270 private: | |
8271 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); | |
8272 }; | |
8273 | |
8274 | |
8275 class TypeFeedbackInfo: public Struct { | 8149 class TypeFeedbackInfo: public Struct { |
8276 public: | 8150 public: |
8277 inline int ic_total_count(); | 8151 inline int ic_total_count(); |
8278 inline void set_ic_total_count(int count); | 8152 inline void set_ic_total_count(int count); |
8279 | 8153 |
8280 inline int ic_with_type_info_count(); | 8154 inline int ic_with_type_info_count(); |
8281 inline void change_ic_with_type_info_count(int delta); | 8155 inline void change_ic_with_type_info_count(int delta); |
8282 | 8156 |
8283 inline int ic_generic_count(); | 8157 inline int ic_generic_count(); |
8284 inline void change_ic_generic_count(int delta); | 8158 inline void change_ic_generic_count(int delta); |
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10918 } | 10792 } |
10919 return value; | 10793 return value; |
10920 } | 10794 } |
10921 }; | 10795 }; |
10922 | 10796 |
10923 | 10797 |
10924 } // NOLINT, false-positive due to second-order macros. | 10798 } // NOLINT, false-positive due to second-order macros. |
10925 } // NOLINT, false-positive due to second-order macros. | 10799 } // NOLINT, false-positive due to second-order macros. |
10926 | 10800 |
10927 #endif // V8_OBJECTS_H_ | 10801 #endif // V8_OBJECTS_H_ |
OLD | NEW |