OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 V(ACCESSOR_INFO_TYPE) \ | 308 V(ACCESSOR_INFO_TYPE) \ |
309 V(ACCESS_CHECK_INFO_TYPE) \ | 309 V(ACCESS_CHECK_INFO_TYPE) \ |
310 V(INTERCEPTOR_INFO_TYPE) \ | 310 V(INTERCEPTOR_INFO_TYPE) \ |
311 V(CALL_HANDLER_INFO_TYPE) \ | 311 V(CALL_HANDLER_INFO_TYPE) \ |
312 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 312 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
313 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 313 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
314 V(SIGNATURE_INFO_TYPE) \ | 314 V(SIGNATURE_INFO_TYPE) \ |
315 V(TYPE_SWITCH_INFO_TYPE) \ | 315 V(TYPE_SWITCH_INFO_TYPE) \ |
316 V(SCRIPT_TYPE) \ | 316 V(SCRIPT_TYPE) \ |
317 V(CODE_CACHE_TYPE) \ | 317 V(CODE_CACHE_TYPE) \ |
| 318 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
318 \ | 319 \ |
319 V(FIXED_ARRAY_TYPE) \ | 320 V(FIXED_ARRAY_TYPE) \ |
320 V(SHARED_FUNCTION_INFO_TYPE) \ | 321 V(SHARED_FUNCTION_INFO_TYPE) \ |
321 \ | 322 \ |
322 V(JS_MESSAGE_OBJECT_TYPE) \ | 323 V(JS_MESSAGE_OBJECT_TYPE) \ |
323 \ | 324 \ |
324 V(JS_VALUE_TYPE) \ | 325 V(JS_VALUE_TYPE) \ |
325 V(JS_OBJECT_TYPE) \ | 326 V(JS_OBJECT_TYPE) \ |
326 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 327 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
327 V(JS_GLOBAL_OBJECT_TYPE) \ | 328 V(JS_GLOBAL_OBJECT_TYPE) \ |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 #define STRUCT_LIST_ALL(V) \ | 418 #define STRUCT_LIST_ALL(V) \ |
418 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ | 419 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
419 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 420 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
420 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 421 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
421 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 422 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
422 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 423 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
423 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 424 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
424 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ | 425 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ |
425 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ | 426 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
426 V(SCRIPT, Script, script) \ | 427 V(SCRIPT, Script, script) \ |
427 V(CODE_CACHE, CodeCache, code_cache) | 428 V(CODE_CACHE, CodeCache, code_cache) \ |
| 429 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) |
428 | 430 |
429 #ifdef ENABLE_DEBUGGER_SUPPORT | 431 #ifdef ENABLE_DEBUGGER_SUPPORT |
430 #define STRUCT_LIST_DEBUGGER(V) \ | 432 #define STRUCT_LIST_DEBUGGER(V) \ |
431 V(DEBUG_INFO, DebugInfo, debug_info) \ | 433 V(DEBUG_INFO, DebugInfo, debug_info) \ |
432 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) | 434 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) |
433 #else | 435 #else |
434 #define STRUCT_LIST_DEBUGGER(V) | 436 #define STRUCT_LIST_DEBUGGER(V) |
435 #endif | 437 #endif |
436 | 438 |
437 #define STRUCT_LIST(V) \ | 439 #define STRUCT_LIST(V) \ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 ACCESSOR_INFO_TYPE, | 537 ACCESSOR_INFO_TYPE, |
536 ACCESS_CHECK_INFO_TYPE, | 538 ACCESS_CHECK_INFO_TYPE, |
537 INTERCEPTOR_INFO_TYPE, | 539 INTERCEPTOR_INFO_TYPE, |
538 CALL_HANDLER_INFO_TYPE, | 540 CALL_HANDLER_INFO_TYPE, |
539 FUNCTION_TEMPLATE_INFO_TYPE, | 541 FUNCTION_TEMPLATE_INFO_TYPE, |
540 OBJECT_TEMPLATE_INFO_TYPE, | 542 OBJECT_TEMPLATE_INFO_TYPE, |
541 SIGNATURE_INFO_TYPE, | 543 SIGNATURE_INFO_TYPE, |
542 TYPE_SWITCH_INFO_TYPE, | 544 TYPE_SWITCH_INFO_TYPE, |
543 SCRIPT_TYPE, | 545 SCRIPT_TYPE, |
544 CODE_CACHE_TYPE, | 546 CODE_CACHE_TYPE, |
| 547 POLYMORPHIC_CODE_CACHE_TYPE, |
545 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT | 548 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
546 // is defined. However as include/v8.h contain some of the instance type | 549 // is defined. However as include/v8.h contain some of the instance type |
547 // constants always having them avoids them getting different numbers | 550 // constants always having them avoids them getting different numbers |
548 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. | 551 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. |
549 DEBUG_INFO_TYPE, | 552 DEBUG_INFO_TYPE, |
550 BREAK_POINT_INFO_TYPE, | 553 BREAK_POINT_INFO_TYPE, |
551 | 554 |
552 FIXED_ARRAY_TYPE, | 555 FIXED_ARRAY_TYPE, |
553 SHARED_FUNCTION_INFO_TYPE, | 556 SHARED_FUNCTION_INFO_TYPE, |
554 | 557 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 V(JSArray) \ | 734 V(JSArray) \ |
732 V(JSProxy) \ | 735 V(JSProxy) \ |
733 V(JSRegExp) \ | 736 V(JSRegExp) \ |
734 V(HashTable) \ | 737 V(HashTable) \ |
735 V(Dictionary) \ | 738 V(Dictionary) \ |
736 V(SymbolTable) \ | 739 V(SymbolTable) \ |
737 V(JSFunctionResultCache) \ | 740 V(JSFunctionResultCache) \ |
738 V(NormalizedMapCache) \ | 741 V(NormalizedMapCache) \ |
739 V(CompilationCacheTable) \ | 742 V(CompilationCacheTable) \ |
740 V(CodeCacheHashTable) \ | 743 V(CodeCacheHashTable) \ |
| 744 V(PolymorphicCodeCacheHashTable) \ |
741 V(MapCache) \ | 745 V(MapCache) \ |
742 V(Primitive) \ | 746 V(Primitive) \ |
743 V(GlobalObject) \ | 747 V(GlobalObject) \ |
744 V(JSGlobalObject) \ | 748 V(JSGlobalObject) \ |
745 V(JSBuiltinsObject) \ | 749 V(JSBuiltinsObject) \ |
746 V(JSGlobalProxy) \ | 750 V(JSGlobalProxy) \ |
747 V(UndetectableObject) \ | 751 V(UndetectableObject) \ |
748 V(AccessCheckNeeded) \ | 752 V(AccessCheckNeeded) \ |
749 V(JSGlobalPropertyCell) \ | 753 V(JSGlobalPropertyCell) \ |
750 | 754 |
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2783 PropertyNormalizationMode mode); | 2787 PropertyNormalizationMode mode); |
2784 | 2788 |
2785 void Clear(); | 2789 void Clear(); |
2786 | 2790 |
2787 // Casting | 2791 // Casting |
2788 static inline NormalizedMapCache* cast(Object* obj); | 2792 static inline NormalizedMapCache* cast(Object* obj); |
2789 | 2793 |
2790 #ifdef DEBUG | 2794 #ifdef DEBUG |
2791 void NormalizedMapCacheVerify(); | 2795 void NormalizedMapCacheVerify(); |
2792 #endif | 2796 #endif |
2793 | |
2794 private: | |
2795 static int Hash(Map* fast); | |
2796 | |
2797 static bool CheckHit(Map* slow, Map* fast, PropertyNormalizationMode mode); | |
2798 }; | 2797 }; |
2799 | 2798 |
2800 | 2799 |
2801 // ByteArray represents fixed sized byte arrays. Used by the outside world, | 2800 // ByteArray represents fixed sized byte arrays. Used by the outside world, |
2802 // such as PCRE, and also by the memory allocator and garbage collector to | 2801 // such as PCRE, and also by the memory allocator and garbage collector to |
2803 // fill in free blocks in the heap. | 2802 // fill in free blocks in the heap. |
2804 class ByteArray: public HeapObject { | 2803 class ByteArray: public HeapObject { |
2805 public: | 2804 public: |
2806 // [length]: length of the array. | 2805 // [length]: length of the array. |
2807 inline int length(); | 2806 inline int length(); |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3891 // target's prototype pointer point back to this map. | 3890 // target's prototype pointer point back to this map. |
3892 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). | 3891 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). |
3893 void CreateBackPointers(); | 3892 void CreateBackPointers(); |
3894 | 3893 |
3895 // Set all map transitions from this map to dead maps to null. | 3894 // Set all map transitions from this map to dead maps to null. |
3896 // Also, restore the original prototype on the targets of these | 3895 // Also, restore the original prototype on the targets of these |
3897 // transitions, so that we do not process this map again while | 3896 // transitions, so that we do not process this map again while |
3898 // following back pointers. | 3897 // following back pointers. |
3899 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); | 3898 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); |
3900 | 3899 |
| 3900 // Computes a hash value for this map, to be used in HashTables and such. |
| 3901 int Hash(); |
| 3902 |
| 3903 // Compares this map to another to see if they describe equivalent objects. |
| 3904 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if |
| 3905 // it had exactly zero inobject properties. |
| 3906 // The "shared" flags of both this map and |other| are ignored. |
| 3907 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode); |
| 3908 |
| 3909 // Returns true if this map and |other| describe equivalent objects. |
| 3910 // The "shared" flags of both this map and |other| are ignored. |
| 3911 bool EquivalentTo(Map* other) { |
| 3912 return EquivalentToForNormalization(other, KEEP_INOBJECT_PROPERTIES); |
| 3913 } |
| 3914 |
3901 // Dispatched behavior. | 3915 // Dispatched behavior. |
3902 #ifdef OBJECT_PRINT | 3916 #ifdef OBJECT_PRINT |
3903 inline void MapPrint() { | 3917 inline void MapPrint() { |
3904 MapPrint(stdout); | 3918 MapPrint(stdout); |
3905 } | 3919 } |
3906 void MapPrint(FILE* out); | 3920 void MapPrint(FILE* out); |
3907 #endif | 3921 #endif |
3908 #ifdef DEBUG | 3922 #ifdef DEBUG |
3909 void MapVerify(); | 3923 void MapVerify(); |
3910 void SharedMapVerify(); | 3924 void SharedMapVerify(); |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5292 static inline CodeCacheHashTable* cast(Object* obj); | 5306 static inline CodeCacheHashTable* cast(Object* obj); |
5293 | 5307 |
5294 // Initial size of the fixed array backing the hash table. | 5308 // Initial size of the fixed array backing the hash table. |
5295 static const int kInitialSize = 64; | 5309 static const int kInitialSize = 64; |
5296 | 5310 |
5297 private: | 5311 private: |
5298 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); | 5312 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); |
5299 }; | 5313 }; |
5300 | 5314 |
5301 | 5315 |
| 5316 class PolymorphicCodeCache: public Struct { |
| 5317 public: |
| 5318 DECL_ACCESSORS(cache, Object) |
| 5319 |
| 5320 MUST_USE_RESULT MaybeObject* Update(MapList* maps, |
| 5321 Code::Flags flags, |
| 5322 Code* code); |
| 5323 Object* Lookup(MapList* maps, Code::Flags flags); |
| 5324 |
| 5325 static inline PolymorphicCodeCache* cast(Object* obj); |
| 5326 |
| 5327 #ifdef OBJECT_PRINT |
| 5328 inline void PolymorphicCodeCachePrint() { |
| 5329 PolymorphicCodeCachePrint(stdout); |
| 5330 } |
| 5331 void PolymorphicCodeCachePrint(FILE* out); |
| 5332 #endif |
| 5333 #ifdef DEBUG |
| 5334 void PolymorphicCodeCacheVerify(); |
| 5335 #endif |
| 5336 |
| 5337 static const int kCacheOffset = HeapObject::kHeaderSize; |
| 5338 static const int kSize = kCacheOffset + kPointerSize; |
| 5339 |
| 5340 private: |
| 5341 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); |
| 5342 }; |
| 5343 |
| 5344 |
| 5345 class PolymorphicCodeCacheHashTable |
| 5346 : public HashTable<CodeCacheHashTableShape, HashTableKey*> { |
| 5347 public: |
| 5348 Object* Lookup(MapList* maps, int code_kind); |
| 5349 MUST_USE_RESULT MaybeObject* Put(MapList* maps, int code_kind, Code* code); |
| 5350 |
| 5351 static inline PolymorphicCodeCacheHashTable* cast(Object* obj); |
| 5352 |
| 5353 static const int kInitialSize = 64; |
| 5354 private: |
| 5355 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); |
| 5356 }; |
| 5357 |
| 5358 |
5302 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; | 5359 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; |
5303 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; | 5360 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; |
5304 | 5361 |
5305 | 5362 |
5306 class StringHasher { | 5363 class StringHasher { |
5307 public: | 5364 public: |
5308 explicit inline StringHasher(int length); | 5365 explicit inline StringHasher(int length); |
5309 | 5366 |
5310 // Returns true if the hash of this string can be computed without | 5367 // Returns true if the hash of this string can be computed without |
5311 // looking at the contents. | 5368 // looking at the contents. |
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6833 } else { | 6890 } else { |
6834 value &= ~(1 << bit_position); | 6891 value &= ~(1 << bit_position); |
6835 } | 6892 } |
6836 return value; | 6893 return value; |
6837 } | 6894 } |
6838 }; | 6895 }; |
6839 | 6896 |
6840 } } // namespace v8::internal | 6897 } } // namespace v8::internal |
6841 | 6898 |
6842 #endif // V8_OBJECTS_H_ | 6899 #endif // V8_OBJECTS_H_ |
OLD | NEW |