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 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1534 inline bool HasExternalUnsignedByteElements(); | 1534 inline bool HasExternalUnsignedByteElements(); |
1535 inline bool HasExternalShortElements(); | 1535 inline bool HasExternalShortElements(); |
1536 inline bool HasExternalUnsignedShortElements(); | 1536 inline bool HasExternalUnsignedShortElements(); |
1537 inline bool HasExternalIntElements(); | 1537 inline bool HasExternalIntElements(); |
1538 inline bool HasExternalUnsignedIntElements(); | 1538 inline bool HasExternalUnsignedIntElements(); |
1539 inline bool HasExternalFloatElements(); | 1539 inline bool HasExternalFloatElements(); |
1540 inline bool HasExternalDoubleElements(); | 1540 inline bool HasExternalDoubleElements(); |
1541 bool HasFastArgumentsElements(); | 1541 bool HasFastArgumentsElements(); |
1542 bool HasDictionaryArgumentsElements(); | 1542 bool HasDictionaryArgumentsElements(); |
1543 inline bool AllowsSetElementsLength(); | 1543 inline bool AllowsSetElementsLength(); |
1544 inline NumberDictionary* element_dictionary(); // Gets slow elements. | 1544 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. |
1545 | 1545 |
1546 // Requires: HasFastElements(). | 1546 // Requires: HasFastElements(). |
1547 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); | 1547 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); |
1548 | 1548 |
1549 // Collects elements starting at index 0. | 1549 // Collects elements starting at index 0. |
1550 // Undefined values are placed after non-undefined values. | 1550 // Undefined values are placed after non-undefined values. |
1551 // Returns the number of non-undefined values. | 1551 // Returns the number of non-undefined values. |
1552 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 1552 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); |
1553 // As PrepareElementsForSort, but only on objects where elements is | 1553 // As PrepareElementsForSort, but only on objects where elements is |
1554 // a dictionary, and it will stay a dictionary. | 1554 // a dictionary, and it will stay a dictionary. |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1895 StrictModeFlag strict_mode); | 1895 StrictModeFlag strict_mode); |
1896 | 1896 |
1897 // Convert the object to use the canonical dictionary | 1897 // Convert the object to use the canonical dictionary |
1898 // representation. If the object is expected to have additional properties | 1898 // representation. If the object is expected to have additional properties |
1899 // added this number can be indicated to have the backing store allocated to | 1899 // added this number can be indicated to have the backing store allocated to |
1900 // an initial capacity for holding these properties. | 1900 // an initial capacity for holding these properties. |
1901 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 1901 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
1902 PropertyNormalizationMode mode, | 1902 PropertyNormalizationMode mode, |
1903 int expected_additional_properties); | 1903 int expected_additional_properties); |
1904 | 1904 |
1905 // Convert and update the elements backing store to be a NumberDictionary | |
1906 // dictionary. Returns the backing after conversion. | |
Erik Corry
2012/01/19 15:35:00
Strange removal of this comment, but no big deal.
| |
1907 MUST_USE_RESULT MaybeObject* NormalizeElements(); | 1905 MUST_USE_RESULT MaybeObject* NormalizeElements(); |
1908 | 1906 |
1909 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); | 1907 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); |
1910 | 1908 |
1911 // Transform slow named properties to fast variants. | 1909 // Transform slow named properties to fast variants. |
1912 // Returns failure if allocation failed. | 1910 // Returns failure if allocation failed. |
1913 MUST_USE_RESULT MaybeObject* TransformToFastProperties( | 1911 MUST_USE_RESULT MaybeObject* TransformToFastProperties( |
1914 int unused_property_fields); | 1912 int unused_property_fields); |
1915 | 1913 |
1916 // Access fast-case object properties at index. | 1914 // Access fast-case object properties at index. |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2214 private: | 2212 private: |
2215 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); | 2213 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); |
2216 }; | 2214 }; |
2217 | 2215 |
2218 | 2216 |
2219 // FixedDoubleArray describes fixed-sized arrays with element type double. | 2217 // FixedDoubleArray describes fixed-sized arrays with element type double. |
2220 class FixedDoubleArray: public FixedArrayBase { | 2218 class FixedDoubleArray: public FixedArrayBase { |
2221 public: | 2219 public: |
2222 inline void Initialize(FixedArray* from); | 2220 inline void Initialize(FixedArray* from); |
2223 inline void Initialize(FixedDoubleArray* from); | 2221 inline void Initialize(FixedDoubleArray* from); |
2224 inline void Initialize(NumberDictionary* from); | 2222 inline void Initialize(SeededNumberDictionary* from); |
2225 | 2223 |
2226 // Setter and getter for elements. | 2224 // Setter and getter for elements. |
2227 inline double get_scalar(int index); | 2225 inline double get_scalar(int index); |
2228 inline MaybeObject* get(int index); | 2226 inline MaybeObject* get(int index); |
2229 inline void set(int index, double value); | 2227 inline void set(int index, double value); |
2230 inline void set_the_hole(int index); | 2228 inline void set_the_hole(int index); |
2231 | 2229 |
2232 // Checking for the hole. | 2230 // Checking for the hole. |
2233 inline bool is_the_hole(int index); | 2231 inline bool is_the_hole(int index); |
2234 | 2232 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2507 // // The prefix size indicates number of elements in the beginning | 2505 // // The prefix size indicates number of elements in the beginning |
2508 // // of the backing storage. | 2506 // // of the backing storage. |
2509 // static const int kPrefixSize = ..; | 2507 // static const int kPrefixSize = ..; |
2510 // // The Element size indicates number of elements per entry. | 2508 // // The Element size indicates number of elements per entry. |
2511 // static const int kEntrySize = ..; | 2509 // static const int kEntrySize = ..; |
2512 // }; | 2510 // }; |
2513 // The prefix size indicates an amount of memory in the | 2511 // The prefix size indicates an amount of memory in the |
2514 // beginning of the backing storage that can be used for non-element | 2512 // beginning of the backing storage that can be used for non-element |
2515 // information by subclasses. | 2513 // information by subclasses. |
2516 | 2514 |
2515 template<typename Key> | |
2516 class BaseShape { | |
2517 public: | |
2518 static const bool UsesSeed = false; | |
2519 static uint32_t Hash(Key key) { return 0; } | |
2520 static uint32_t SeededHash(Key key, uint32_t seed) { | |
2521 ASSERT(UsesSeed); | |
2522 return Hash(key); | |
2523 } | |
2524 static uint32_t HashForObject(Key key, Object* object) { return 0; } | |
2525 static uint32_t SeededHashForObject(Key key, uint32_t seed, Object* object) { | |
2526 // Won't be called if UsesSeed isn't overridden by child class. | |
2527 return HashForObject(key, object); | |
2528 } | |
2529 }; | |
2530 | |
2517 template<typename Shape, typename Key> | 2531 template<typename Shape, typename Key> |
2518 class HashTable: public FixedArray { | 2532 class HashTable: public FixedArray { |
2519 public: | 2533 public: |
2534 // Wrapper methods | |
2535 inline uint32_t Hash(Key key) { | |
2536 if (Shape::UsesSeed) { | |
2537 // I'm using map()->heap() to skip is_safe_to_read_maps assertion. | |
Erik Corry
2012/01/19 15:35:00
This comment and the associated change should not
| |
2538 // That was done, because NumberDictionary is used inside GC. | |
2539 return Shape::SeededHash(key, map()->heap()->HashSeed()); | |
2540 } else { | |
2541 return Shape::Hash(key); | |
2542 } | |
2543 } | |
2544 | |
2545 inline uint32_t HashForObject(Key key, Object* object) { | |
2546 if (Shape::UsesSeed) { | |
2547 // I'm using map()->heap() to skip is_safe_to_read_maps assertion. | |
2548 // That was done, because NumberDictionary is used inside GC. | |
2549 return Shape::SeededHashForObject(key, map()->heap()->HashSeed(), object); | |
2550 } else { | |
2551 return Shape::HashForObject(key, object); | |
2552 } | |
2553 } | |
2554 | |
2520 // Returns the number of elements in the hash table. | 2555 // Returns the number of elements in the hash table. |
2521 int NumberOfElements() { | 2556 int NumberOfElements() { |
2522 return Smi::cast(get(kNumberOfElementsIndex))->value(); | 2557 return Smi::cast(get(kNumberOfElementsIndex))->value(); |
2523 } | 2558 } |
2524 | 2559 |
2525 // Returns the number of deleted elements in the hash table. | 2560 // Returns the number of deleted elements in the hash table. |
2526 int NumberOfDeletedElements() { | 2561 int NumberOfDeletedElements() { |
2527 return Smi::cast(get(kNumberOfDeletedElementsIndex))->value(); | 2562 return Smi::cast(get(kNumberOfDeletedElementsIndex))->value(); |
2528 } | 2563 } |
2529 | 2564 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2651 MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key); | 2686 MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key); |
2652 | 2687 |
2653 // Attempt to shrink hash table after removal of key. | 2688 // Attempt to shrink hash table after removal of key. |
2654 MUST_USE_RESULT MaybeObject* Shrink(Key key); | 2689 MUST_USE_RESULT MaybeObject* Shrink(Key key); |
2655 | 2690 |
2656 // Ensure enough space for n additional elements. | 2691 // Ensure enough space for n additional elements. |
2657 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); | 2692 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); |
2658 }; | 2693 }; |
2659 | 2694 |
2660 | 2695 |
2661 | |
2662 // HashTableKey is an abstract superclass for virtual key behavior. | 2696 // HashTableKey is an abstract superclass for virtual key behavior. |
2663 class HashTableKey { | 2697 class HashTableKey { |
2664 public: | 2698 public: |
2665 // Returns whether the other object matches this key. | 2699 // Returns whether the other object matches this key. |
2666 virtual bool IsMatch(Object* other) = 0; | 2700 virtual bool IsMatch(Object* other) = 0; |
2667 // Returns the hash value for this key. | 2701 // Returns the hash value for this key. |
2668 virtual uint32_t Hash() = 0; | 2702 virtual uint32_t Hash() = 0; |
2669 // Returns the hash value for object. | 2703 // Returns the hash value for object. |
2670 virtual uint32_t HashForObject(Object* key) = 0; | 2704 virtual uint32_t HashForObject(Object* key) = 0; |
2671 // Returns the key object for storing into the hash table. | 2705 // Returns the key object for storing into the hash table. |
2672 // If allocations fails a failure object is returned. | 2706 // If allocations fails a failure object is returned. |
2673 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; | 2707 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; |
2674 // Required. | 2708 // Required. |
2675 virtual ~HashTableKey() {} | 2709 virtual ~HashTableKey() {} |
2676 }; | 2710 }; |
2677 | 2711 |
2678 class SymbolTableShape { | 2712 |
2713 class SymbolTableShape : public BaseShape<HashTableKey*> { | |
2679 public: | 2714 public: |
2680 static inline bool IsMatch(HashTableKey* key, Object* value) { | 2715 static inline bool IsMatch(HashTableKey* key, Object* value) { |
2681 return key->IsMatch(value); | 2716 return key->IsMatch(value); |
2682 } | 2717 } |
2683 static inline uint32_t Hash(HashTableKey* key) { | 2718 static inline uint32_t Hash(HashTableKey* key) { |
2684 return key->Hash(); | 2719 return key->Hash(); |
2685 } | 2720 } |
2686 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 2721 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
2687 return key->HashForObject(object); | 2722 return key->HashForObject(object); |
2688 } | 2723 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2727 // Casting. | 2762 // Casting. |
2728 static inline SymbolTable* cast(Object* obj); | 2763 static inline SymbolTable* cast(Object* obj); |
2729 | 2764 |
2730 private: | 2765 private: |
2731 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); | 2766 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); |
2732 | 2767 |
2733 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); | 2768 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); |
2734 }; | 2769 }; |
2735 | 2770 |
2736 | 2771 |
2737 class MapCacheShape { | 2772 class MapCacheShape : public BaseShape<HashTableKey*> { |
2738 public: | 2773 public: |
2739 static inline bool IsMatch(HashTableKey* key, Object* value) { | 2774 static inline bool IsMatch(HashTableKey* key, Object* value) { |
2740 return key->IsMatch(value); | 2775 return key->IsMatch(value); |
2741 } | 2776 } |
2742 static inline uint32_t Hash(HashTableKey* key) { | 2777 static inline uint32_t Hash(HashTableKey* key) { |
2743 return key->Hash(); | 2778 return key->Hash(); |
2744 } | 2779 } |
2745 | 2780 |
2746 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 2781 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
2747 return key->HashForObject(object); | 2782 return key->HashForObject(object); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2883 uint32_t hash); | 2918 uint32_t hash); |
2884 | 2919 |
2885 // Generate new enumeration indices to avoid enumeration index overflow. | 2920 // Generate new enumeration indices to avoid enumeration index overflow. |
2886 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices(); | 2921 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices(); |
2887 static const int kMaxNumberKeyIndex = | 2922 static const int kMaxNumberKeyIndex = |
2888 HashTable<Shape, Key>::kPrefixStartIndex; | 2923 HashTable<Shape, Key>::kPrefixStartIndex; |
2889 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; | 2924 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; |
2890 }; | 2925 }; |
2891 | 2926 |
2892 | 2927 |
2893 class StringDictionaryShape { | 2928 class StringDictionaryShape : public BaseShape<String*> { |
2894 public: | 2929 public: |
2895 static inline bool IsMatch(String* key, Object* other); | 2930 static inline bool IsMatch(String* key, Object* other); |
2896 static inline uint32_t Hash(String* key); | 2931 static inline uint32_t Hash(String* key); |
2897 static inline uint32_t HashForObject(String* key, Object* object); | 2932 static inline uint32_t HashForObject(String* key, Object* object); |
2898 MUST_USE_RESULT static inline MaybeObject* AsObject(String* key); | 2933 MUST_USE_RESULT static inline MaybeObject* AsObject(String* key); |
2899 static const int kPrefixSize = 2; | 2934 static const int kPrefixSize = 2; |
2900 static const int kEntrySize = 3; | 2935 static const int kEntrySize = 3; |
2901 static const bool kIsEnumerable = true; | 2936 static const bool kIsEnumerable = true; |
2902 }; | 2937 }; |
2903 | 2938 |
(...skipping 12 matching lines...) Expand all Loading... | |
2916 MUST_USE_RESULT MaybeObject* TransformPropertiesToFastFor( | 2951 MUST_USE_RESULT MaybeObject* TransformPropertiesToFastFor( |
2917 JSObject* obj, | 2952 JSObject* obj, |
2918 int unused_property_fields); | 2953 int unused_property_fields); |
2919 | 2954 |
2920 // Find entry for key otherwise return kNotFound. Optimzed version of | 2955 // Find entry for key otherwise return kNotFound. Optimzed version of |
2921 // HashTable::FindEntry. | 2956 // HashTable::FindEntry. |
2922 int FindEntry(String* key); | 2957 int FindEntry(String* key); |
2923 }; | 2958 }; |
2924 | 2959 |
2925 | 2960 |
2926 class NumberDictionaryShape { | 2961 class NumberDictionaryShape : public BaseShape<uint32_t> { |
2927 public: | 2962 public: |
2928 static inline bool IsMatch(uint32_t key, Object* other); | 2963 static inline bool IsMatch(uint32_t key, Object* other); |
2929 static inline uint32_t Hash(uint32_t key); | |
2930 static inline uint32_t HashForObject(uint32_t key, Object* object); | |
2931 MUST_USE_RESULT static inline MaybeObject* AsObject(uint32_t key); | 2964 MUST_USE_RESULT static inline MaybeObject* AsObject(uint32_t key); |
2932 static const int kPrefixSize = 2; | |
2933 static const int kEntrySize = 3; | 2965 static const int kEntrySize = 3; |
2934 static const bool kIsEnumerable = false; | 2966 static const bool kIsEnumerable = false; |
2935 }; | 2967 }; |
2936 | 2968 |
2937 | 2969 |
2938 class NumberDictionary: public Dictionary<NumberDictionaryShape, uint32_t> { | 2970 class SeededNumberDictionaryShape : public NumberDictionaryShape { |
2939 public: | 2971 public: |
2940 static NumberDictionary* cast(Object* obj) { | 2972 static const bool UsesSeed = true; |
2973 static const int kPrefixSize = 2; | |
2974 | |
2975 static inline uint32_t SeededHash(uint32_t key, uint32_t seed); | |
2976 static inline uint32_t SeededHashForObject(uint32_t key, | |
2977 uint32_t seed, | |
2978 Object* object); | |
2979 }; | |
2980 | |
2981 | |
2982 class UnseededNumberDictionaryShape : public NumberDictionaryShape { | |
2983 public: | |
2984 static const int kPrefixSize = 0; | |
2985 | |
2986 static inline uint32_t Hash(uint32_t key); | |
2987 static inline uint32_t HashForObject(uint32_t key, Object* object); | |
2988 }; | |
2989 | |
2990 | |
2991 class SeededNumberDictionary | |
2992 : public Dictionary<SeededNumberDictionaryShape, uint32_t> { | |
2993 public: | |
2994 static SeededNumberDictionary* cast(Object* obj) { | |
2941 ASSERT(obj->IsDictionary()); | 2995 ASSERT(obj->IsDictionary()); |
2942 return reinterpret_cast<NumberDictionary*>(obj); | 2996 return reinterpret_cast<SeededNumberDictionary*>(obj); |
2943 } | 2997 } |
2944 | 2998 |
2945 // Type specific at put (default NONE attributes is used when adding). | 2999 // Type specific at put (default NONE attributes is used when adding). |
2946 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); | 3000 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); |
2947 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, | 3001 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, |
2948 Object* value, | 3002 Object* value, |
2949 PropertyDetails details); | 3003 PropertyDetails details); |
2950 | 3004 |
2951 // Set an existing entry or add a new one if needed. | 3005 // Set an existing entry or add a new one if needed. |
2952 MUST_USE_RESULT MaybeObject* Set(uint32_t key, | 3006 MUST_USE_RESULT MaybeObject* Set(uint32_t key, |
(...skipping 18 matching lines...) Expand all Loading... | |
2971 // Remove all entries were key is a number and (from <= key && key < to). | 3025 // Remove all entries were key is a number and (from <= key && key < to). |
2972 void RemoveNumberEntries(uint32_t from, uint32_t to); | 3026 void RemoveNumberEntries(uint32_t from, uint32_t to); |
2973 | 3027 |
2974 // Bit masks. | 3028 // Bit masks. |
2975 static const int kRequiresSlowElementsMask = 1; | 3029 static const int kRequiresSlowElementsMask = 1; |
2976 static const int kRequiresSlowElementsTagSize = 1; | 3030 static const int kRequiresSlowElementsTagSize = 1; |
2977 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1; | 3031 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1; |
2978 }; | 3032 }; |
2979 | 3033 |
2980 | 3034 |
2981 class ObjectHashTableShape { | 3035 class UnseededNumberDictionary |
3036 : public Dictionary<UnseededNumberDictionaryShape, uint32_t> { | |
3037 public: | |
3038 static UnseededNumberDictionary* cast(Object* obj) { | |
3039 ASSERT(obj->IsDictionary()); | |
3040 return reinterpret_cast<UnseededNumberDictionary*>(obj); | |
3041 } | |
3042 | |
3043 // Type specific at put (default NONE attributes is used when adding). | |
3044 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); | |
3045 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, Object* value); | |
3046 | |
3047 // Set an existing entry or add a new one if needed. | |
3048 MUST_USE_RESULT MaybeObject* Set(uint32_t key, Object* value); | |
3049 }; | |
3050 | |
3051 | |
3052 class ObjectHashTableShape : public BaseShape<Object*> { | |
2982 public: | 3053 public: |
2983 static inline bool IsMatch(JSObject* key, Object* other); | 3054 static inline bool IsMatch(JSObject* key, Object* other); |
2984 static inline uint32_t Hash(JSObject* key); | 3055 static inline uint32_t Hash(JSObject* key); |
2985 static inline uint32_t HashForObject(JSObject* key, Object* object); | 3056 static inline uint32_t HashForObject(JSObject* key, Object* object); |
2986 MUST_USE_RESULT static inline MaybeObject* AsObject(JSObject* key); | 3057 MUST_USE_RESULT static inline MaybeObject* AsObject(JSObject* key); |
2987 static const int kPrefixSize = 0; | 3058 static const int kPrefixSize = 0; |
2988 static const int kEntrySize = 2; | 3059 static const int kEntrySize = 2; |
2989 }; | 3060 }; |
2990 | 3061 |
2991 | 3062 |
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5536 // object is in the saved code field. | 5607 // object is in the saved code field. |
5537 static const int kCompilationErrorValue = -2; | 5608 static const int kCompilationErrorValue = -2; |
5538 | 5609 |
5539 // When we store the sweep generation at which we moved the code from the | 5610 // When we store the sweep generation at which we moved the code from the |
5540 // code index to the saved code index we mask it of to be in the [0:255] | 5611 // code index to the saved code index we mask it of to be in the [0:255] |
5541 // range. | 5612 // range. |
5542 static const int kCodeAgeMask = 0xff; | 5613 static const int kCodeAgeMask = 0xff; |
5543 }; | 5614 }; |
5544 | 5615 |
5545 | 5616 |
5546 class CompilationCacheShape { | 5617 class CompilationCacheShape : public BaseShape<HashTableKey*> { |
5547 public: | 5618 public: |
5548 static inline bool IsMatch(HashTableKey* key, Object* value) { | 5619 static inline bool IsMatch(HashTableKey* key, Object* value) { |
5549 return key->IsMatch(value); | 5620 return key->IsMatch(value); |
5550 } | 5621 } |
5551 | 5622 |
5552 static inline uint32_t Hash(HashTableKey* key) { | 5623 static inline uint32_t Hash(HashTableKey* key) { |
5553 return key->Hash(); | 5624 return key->Hash(); |
5554 } | 5625 } |
5555 | 5626 |
5556 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 5627 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5636 // Code cache layout of the default cache. Elements are alternating name and | 5707 // Code cache layout of the default cache. Elements are alternating name and |
5637 // code objects for non normal load/store/call IC's. | 5708 // code objects for non normal load/store/call IC's. |
5638 static const int kCodeCacheEntrySize = 2; | 5709 static const int kCodeCacheEntrySize = 2; |
5639 static const int kCodeCacheEntryNameOffset = 0; | 5710 static const int kCodeCacheEntryNameOffset = 0; |
5640 static const int kCodeCacheEntryCodeOffset = 1; | 5711 static const int kCodeCacheEntryCodeOffset = 1; |
5641 | 5712 |
5642 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); | 5713 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); |
5643 }; | 5714 }; |
5644 | 5715 |
5645 | 5716 |
5646 class CodeCacheHashTableShape { | 5717 class CodeCacheHashTableShape : public BaseShape<HashTableKey*> { |
5647 public: | 5718 public: |
5648 static inline bool IsMatch(HashTableKey* key, Object* value) { | 5719 static inline bool IsMatch(HashTableKey* key, Object* value) { |
5649 return key->IsMatch(value); | 5720 return key->IsMatch(value); |
5650 } | 5721 } |
5651 | 5722 |
5652 static inline uint32_t Hash(HashTableKey* key) { | 5723 static inline uint32_t Hash(HashTableKey* key) { |
5653 return key->Hash(); | 5724 return key->Hash(); |
5654 } | 5725 } |
5655 | 5726 |
5656 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 5727 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7498 } else { | 7569 } else { |
7499 value &= ~(1 << bit_position); | 7570 value &= ~(1 << bit_position); |
7500 } | 7571 } |
7501 return value; | 7572 return value; |
7502 } | 7573 } |
7503 }; | 7574 }; |
7504 | 7575 |
7505 } } // namespace v8::internal | 7576 } } // namespace v8::internal |
7506 | 7577 |
7507 #endif // V8_OBJECTS_H_ | 7578 #endif // V8_OBJECTS_H_ |
OLD | NEW |