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