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. |mode| affects how |other| is looked at. | |
Mads Ager (chromium)
2011/06/01 08:45:53
Could you update the comment to state which effect
Jakob Kummerow
2011/06/01 10:15:27
OK. I agree that "Equals" isn't a good name. Here
Mads Ager (chromium)
2011/06/01 10:36:54
They are not really ignored. If you are about to c
Jakob Kummerow
2011/06/01 12:03:09
Done.
| |
3904 // The "shared" flags of both |this| and |other| are ignored. | |
3905 bool Equals(Map* other, PropertyNormalizationMode mode); | |
3906 | |
3901 // Dispatched behavior. | 3907 // Dispatched behavior. |
3902 #ifdef OBJECT_PRINT | 3908 #ifdef OBJECT_PRINT |
3903 inline void MapPrint() { | 3909 inline void MapPrint() { |
3904 MapPrint(stdout); | 3910 MapPrint(stdout); |
3905 } | 3911 } |
3906 void MapPrint(FILE* out); | 3912 void MapPrint(FILE* out); |
3907 #endif | 3913 #endif |
3908 #ifdef DEBUG | 3914 #ifdef DEBUG |
3909 void MapVerify(); | 3915 void MapVerify(); |
3910 void SharedMapVerify(); | 3916 void SharedMapVerify(); |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5292 static inline CodeCacheHashTable* cast(Object* obj); | 5298 static inline CodeCacheHashTable* cast(Object* obj); |
5293 | 5299 |
5294 // Initial size of the fixed array backing the hash table. | 5300 // Initial size of the fixed array backing the hash table. |
5295 static const int kInitialSize = 64; | 5301 static const int kInitialSize = 64; |
5296 | 5302 |
5297 private: | 5303 private: |
5298 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); | 5304 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); |
5299 }; | 5305 }; |
5300 | 5306 |
5301 | 5307 |
5308 class PolymorphicCodeCache: public Struct { | |
5309 public: | |
5310 DECL_ACCESSORS(cache, Object) | |
5311 | |
5312 MUST_USE_RESULT MaybeObject* Update(MapList* maps, | |
5313 Code::Flags flags, | |
5314 Code* code); | |
5315 Object* Lookup(MapList* maps, Code::Flags flags); | |
5316 | |
5317 static inline PolymorphicCodeCache* cast(Object* obj); | |
5318 | |
5319 #ifdef OBJECT_PRINT | |
5320 inline void PolymorphicCodeCachePrint() { | |
5321 PolymorphicCodeCachePrint(stdout); | |
5322 } | |
5323 void PolymorphicCodeCachePrint(FILE* out); | |
5324 #endif | |
5325 #ifdef DEBUG | |
5326 void PolymorphicCodeCacheVerify(); | |
5327 #endif | |
5328 | |
5329 static const int kCacheOffset = HeapObject::kHeaderSize; | |
5330 static const int kSize = kCacheOffset + kPointerSize; | |
5331 | |
5332 private: | |
5333 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); | |
5334 }; | |
5335 | |
5336 | |
5337 class PolymorphicCodeCacheHashTable | |
5338 : public HashTable<CodeCacheHashTableShape, HashTableKey*> { | |
5339 public: | |
5340 Object* Lookup(MapList* maps, int code_kind); | |
5341 MUST_USE_RESULT MaybeObject* Put(MapList* maps, int code_kind, Code* code); | |
5342 | |
5343 static inline PolymorphicCodeCacheHashTable* cast(Object* obj); | |
5344 | |
5345 static const int kInitialSize = 64; | |
5346 private: | |
5347 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); | |
5348 }; | |
5349 | |
5350 | |
5302 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; | 5351 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; |
5303 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; | 5352 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; |
5304 | 5353 |
5305 | 5354 |
5306 class StringHasher { | 5355 class StringHasher { |
5307 public: | 5356 public: |
5308 explicit inline StringHasher(int length); | 5357 explicit inline StringHasher(int length); |
5309 | 5358 |
5310 // Returns true if the hash of this string can be computed without | 5359 // Returns true if the hash of this string can be computed without |
5311 // looking at the contents. | 5360 // looking at the contents. |
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6833 } else { | 6882 } else { |
6834 value &= ~(1 << bit_position); | 6883 value &= ~(1 << bit_position); |
6835 } | 6884 } |
6836 return value; | 6885 return value; |
6837 } | 6886 } |
6838 }; | 6887 }; |
6839 | 6888 |
6840 } } // namespace v8::internal | 6889 } } // namespace v8::internal |
6841 | 6890 |
6842 #endif // V8_OBJECTS_H_ | 6891 #endif // V8_OBJECTS_H_ |
OLD | NEW |