OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 inline bool IsJSValue(); | 624 inline bool IsJSValue(); |
625 inline bool IsStringWrapper(); | 625 inline bool IsStringWrapper(); |
626 inline bool IsProxy(); | 626 inline bool IsProxy(); |
627 inline bool IsBoolean(); | 627 inline bool IsBoolean(); |
628 inline bool IsJSArray(); | 628 inline bool IsJSArray(); |
629 inline bool IsJSRegExp(); | 629 inline bool IsJSRegExp(); |
630 inline bool IsHashTable(); | 630 inline bool IsHashTable(); |
631 inline bool IsDictionary(); | 631 inline bool IsDictionary(); |
632 inline bool IsSymbolTable(); | 632 inline bool IsSymbolTable(); |
633 inline bool IsJSFunctionResultCache(); | 633 inline bool IsJSFunctionResultCache(); |
634 inline bool IsNormalizedMapCache(); | |
635 inline bool IsCompilationCacheTable(); | 634 inline bool IsCompilationCacheTable(); |
636 inline bool IsCodeCacheHashTable(); | 635 inline bool IsCodeCacheHashTable(); |
637 inline bool IsMapCache(); | 636 inline bool IsMapCache(); |
638 inline bool IsPrimitive(); | 637 inline bool IsPrimitive(); |
639 inline bool IsGlobalObject(); | 638 inline bool IsGlobalObject(); |
640 inline bool IsJSGlobalObject(); | 639 inline bool IsJSGlobalObject(); |
641 inline bool IsJSBuiltinsObject(); | 640 inline bool IsJSBuiltinsObject(); |
642 inline bool IsJSGlobalProxy(); | 641 inline bool IsJSGlobalProxy(); |
643 inline bool IsUndetectableObject(); | 642 inline bool IsUndetectableObject(); |
644 inline bool IsAccessCheckNeeded(); | 643 inline bool IsAccessCheckNeeded(); |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2381 | 2380 |
2382 // Casting | 2381 // Casting |
2383 static inline JSFunctionResultCache* cast(Object* obj); | 2382 static inline JSFunctionResultCache* cast(Object* obj); |
2384 | 2383 |
2385 #ifdef DEBUG | 2384 #ifdef DEBUG |
2386 void JSFunctionResultCacheVerify(); | 2385 void JSFunctionResultCacheVerify(); |
2387 #endif | 2386 #endif |
2388 }; | 2387 }; |
2389 | 2388 |
2390 | 2389 |
2391 // The cache for maps used by normalized (dictionary mode) objects. | |
2392 // Such maps do not have property descriptors, so a typical program | |
2393 // needs very limited number of distinct normalized maps. | |
2394 class NormalizedMapCache: public FixedArray { | |
2395 public: | |
2396 static const int kEntries = 64; | |
2397 | |
2398 Object* Get(Map* fast, PropertyNormalizationMode mode); | |
2399 | |
2400 void Clear(); | |
2401 | |
2402 // Casting | |
2403 static inline NormalizedMapCache* cast(Object* obj); | |
2404 | |
2405 #ifdef DEBUG | |
2406 void NormalizedMapCacheVerify(); | |
2407 #endif | |
2408 | |
2409 private: | |
2410 static int Hash(Map* fast); | |
2411 | |
2412 static bool CheckHit(Map* slow, Map* fast, PropertyNormalizationMode mode); | |
2413 }; | |
2414 | |
2415 | |
2416 // ByteArray represents fixed sized byte arrays. Used by the outside world, | 2390 // ByteArray represents fixed sized byte arrays. Used by the outside world, |
2417 // such as PCRE, and also by the memory allocator and garbage collector to | 2391 // such as PCRE, and also by the memory allocator and garbage collector to |
2418 // fill in free blocks in the heap. | 2392 // fill in free blocks in the heap. |
2419 class ByteArray: public HeapObject { | 2393 class ByteArray: public HeapObject { |
2420 public: | 2394 public: |
2421 // [length]: length of the array. | 2395 // [length]: length of the array. |
2422 inline int length(); | 2396 inline int length(); |
2423 inline void set_length(int value); | 2397 inline void set_length(int value); |
2424 | 2398 |
2425 // Setter and getter. | 2399 // Setter and getter. |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3049 DECL_ACCESSORS(constructor, Object) | 3023 DECL_ACCESSORS(constructor, Object) |
3050 | 3024 |
3051 // [instance descriptors]: describes the object. | 3025 // [instance descriptors]: describes the object. |
3052 DECL_ACCESSORS(instance_descriptors, DescriptorArray) | 3026 DECL_ACCESSORS(instance_descriptors, DescriptorArray) |
3053 | 3027 |
3054 // [stub cache]: contains stubs compiled for this map. | 3028 // [stub cache]: contains stubs compiled for this map. |
3055 DECL_ACCESSORS(code_cache, Object) | 3029 DECL_ACCESSORS(code_cache, Object) |
3056 | 3030 |
3057 Object* CopyDropDescriptors(); | 3031 Object* CopyDropDescriptors(); |
3058 | 3032 |
3059 Object* CopyNormalized(PropertyNormalizationMode mode); | |
3060 | |
3061 // Returns a copy of the map, with all transitions dropped from the | 3033 // Returns a copy of the map, with all transitions dropped from the |
3062 // instance descriptors. | 3034 // instance descriptors. |
3063 Object* CopyDropTransitions(); | 3035 Object* CopyDropTransitions(); |
3064 | 3036 |
3065 // Returns this map if it has the fast elements bit set, otherwise | 3037 // Returns this map if it has the fast elements bit set, otherwise |
3066 // returns a copy of the map, with all transitions dropped from the | 3038 // returns a copy of the map, with all transitions dropped from the |
3067 // descriptors and the fast elements bit set. | 3039 // descriptors and the fast elements bit set. |
3068 inline Object* GetFastElementsMap(); | 3040 inline Object* GetFastElementsMap(); |
3069 | 3041 |
3070 // Returns this map if it has the fast elements bit cleared, | 3042 // Returns this map if it has the fast elements bit cleared, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 // Also, restore the original prototype on the targets of these | 3086 // Also, restore the original prototype on the targets of these |
3115 // transitions, so that we do not process this map again while | 3087 // transitions, so that we do not process this map again while |
3116 // following back pointers. | 3088 // following back pointers. |
3117 void ClearNonLiveTransitions(Object* real_prototype); | 3089 void ClearNonLiveTransitions(Object* real_prototype); |
3118 | 3090 |
3119 // Dispatched behavior. | 3091 // Dispatched behavior. |
3120 void MapIterateBody(ObjectVisitor* v); | 3092 void MapIterateBody(ObjectVisitor* v); |
3121 #ifdef DEBUG | 3093 #ifdef DEBUG |
3122 void MapPrint(); | 3094 void MapPrint(); |
3123 void MapVerify(); | 3095 void MapVerify(); |
3124 void NormalizedMapVerify(); | |
3125 #endif | 3096 #endif |
3126 | 3097 |
3127 inline Scavenger scavenger(); | 3098 inline Scavenger scavenger(); |
3128 inline void set_scavenger(Scavenger callback); | 3099 inline void set_scavenger(Scavenger callback); |
3129 | 3100 |
3130 inline void Scavenge(HeapObject** slot, HeapObject* obj) { | 3101 inline void Scavenge(HeapObject** slot, HeapObject* obj) { |
3131 scavenger()(this, slot, obj); | 3102 scavenger()(this, slot, obj); |
3132 } | 3103 } |
3133 | 3104 |
3134 static const int kMaxPreAllocatedPropertyFields = 255; | 3105 static const int kMaxPreAllocatedPropertyFields = 255; |
(...skipping 18 matching lines...) Expand all Loading... |
3153 | 3124 |
3154 // Byte offsets within kInstanceSizesOffset. | 3125 // Byte offsets within kInstanceSizesOffset. |
3155 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 3126 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |
3156 static const int kInObjectPropertiesByte = 1; | 3127 static const int kInObjectPropertiesByte = 1; |
3157 static const int kInObjectPropertiesOffset = | 3128 static const int kInObjectPropertiesOffset = |
3158 kInstanceSizesOffset + kInObjectPropertiesByte; | 3129 kInstanceSizesOffset + kInObjectPropertiesByte; |
3159 static const int kPreAllocatedPropertyFieldsByte = 2; | 3130 static const int kPreAllocatedPropertyFieldsByte = 2; |
3160 static const int kPreAllocatedPropertyFieldsOffset = | 3131 static const int kPreAllocatedPropertyFieldsOffset = |
3161 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; | 3132 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; |
3162 // The byte at position 3 is not in use at the moment. | 3133 // The byte at position 3 is not in use at the moment. |
3163 static const int kUnusedByte = 3; | |
3164 static const int kUnusedOffset = kInstanceSizesOffset + kUnusedByte; | |
3165 | 3134 |
3166 // Byte offsets within kInstanceAttributesOffset attributes. | 3135 // Byte offsets within kInstanceAttributesOffset attributes. |
3167 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; | 3136 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; |
3168 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; | 3137 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; |
3169 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; | 3138 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; |
3170 static const int kBitField2Offset = kInstanceAttributesOffset + 3; | 3139 static const int kBitField2Offset = kInstanceAttributesOffset + 3; |
3171 | 3140 |
3172 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); | 3141 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); |
3173 | 3142 |
3174 // Bit positions for bit field. | 3143 // Bit positions for bit field. |
(...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5395 } else { | 5364 } else { |
5396 value &= ~(1 << bit_position); | 5365 value &= ~(1 << bit_position); |
5397 } | 5366 } |
5398 return value; | 5367 return value; |
5399 } | 5368 } |
5400 }; | 5369 }; |
5401 | 5370 |
5402 } } // namespace v8::internal | 5371 } } // namespace v8::internal |
5403 | 5372 |
5404 #endif // V8_OBJECTS_H_ | 5373 #endif // V8_OBJECTS_H_ |
OLD | NEW |