| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 value_ = TypeField::encode(type) | 160 value_ = TypeField::encode(type) |
| 161 | AttributesField::encode(attributes) | 161 | AttributesField::encode(attributes) |
| 162 | StorageField::encode(static_cast<int>(array_type)); | 162 | StorageField::encode(static_cast<int>(array_type)); |
| 163 | 163 |
| 164 ASSERT(type == this->type()); | 164 ASSERT(type == this->type()); |
| 165 ASSERT(attributes == this->attributes()); | 165 ASSERT(attributes == this->attributes()); |
| 166 ASSERT(array_type == this->array_type()); | 166 ASSERT(array_type == this->array_type()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Conversion for storing details as Object*. | 169 // Conversion for storing details as Object*. |
| 170 inline PropertyDetails(Smi* smi); | 170 explicit inline PropertyDetails(Smi* smi); |
| 171 inline Smi* AsSmi(); | 171 inline Smi* AsSmi(); |
| 172 | 172 |
| 173 PropertyType type() { return TypeField::decode(value_); } | 173 PropertyType type() { return TypeField::decode(value_); } |
| 174 | 174 |
| 175 bool IsTransition() { | 175 bool IsTransition() { |
| 176 PropertyType t = type(); | 176 PropertyType t = type(); |
| 177 ASSERT(t != INTERCEPTOR); | 177 ASSERT(t != INTERCEPTOR); |
| 178 return t == MAP_TRANSITION || t == CONSTANT_TRANSITION || | 178 return t == MAP_TRANSITION || t == CONSTANT_TRANSITION || |
| 179 t == EXTERNAL_ARRAY_TRANSITION; | 179 t == EXTERNAL_ARRAY_TRANSITION; |
| 180 } | 180 } |
| (...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 Print(stdout); | 2569 Print(stdout); |
| 2570 } | 2570 } |
| 2571 void Print(FILE* out); | 2571 void Print(FILE* out); |
| 2572 #endif | 2572 #endif |
| 2573 // Returns the key (slow). | 2573 // Returns the key (slow). |
| 2574 Object* SlowReverseLookup(Object* value); | 2574 Object* SlowReverseLookup(Object* value); |
| 2575 | 2575 |
| 2576 // Sets the entry to (key, value) pair. | 2576 // Sets the entry to (key, value) pair. |
| 2577 inline void SetEntry(int entry, | 2577 inline void SetEntry(int entry, |
| 2578 Object* key, | 2578 Object* key, |
| 2579 Object* value); |
| 2580 inline void SetEntry(int entry, |
| 2581 Object* key, |
| 2579 Object* value, | 2582 Object* value, |
| 2580 PropertyDetails details); | 2583 PropertyDetails details); |
| 2581 | 2584 |
| 2582 MUST_USE_RESULT MaybeObject* Add(Key key, | 2585 MUST_USE_RESULT MaybeObject* Add(Key key, |
| 2583 Object* value, | 2586 Object* value, |
| 2584 PropertyDetails details); | 2587 PropertyDetails details); |
| 2585 | 2588 |
| 2586 protected: | 2589 protected: |
| 2587 // Generic at put operation. | 2590 // Generic at put operation. |
| 2588 MUST_USE_RESULT MaybeObject* AtPut(Key key, Object* value); | 2591 MUST_USE_RESULT MaybeObject* AtPut(Key key, Object* value); |
| 2589 | 2592 |
| 2590 // Add entry to dictionary. | 2593 // Add entry to dictionary. |
| 2591 MUST_USE_RESULT MaybeObject* AddEntry(Key key, | 2594 MUST_USE_RESULT MaybeObject* AddEntry(Key key, |
| (...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5151 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); | 5154 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); |
| 5152 }; | 5155 }; |
| 5153 | 5156 |
| 5154 | 5157 |
| 5155 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; | 5158 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; |
| 5156 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; | 5159 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; |
| 5157 | 5160 |
| 5158 | 5161 |
| 5159 class StringHasher { | 5162 class StringHasher { |
| 5160 public: | 5163 public: |
| 5161 inline StringHasher(int length); | 5164 explicit inline StringHasher(int length); |
| 5162 | 5165 |
| 5163 // Returns true if the hash of this string can be computed without | 5166 // Returns true if the hash of this string can be computed without |
| 5164 // looking at the contents. | 5167 // looking at the contents. |
| 5165 inline bool has_trivial_hash(); | 5168 inline bool has_trivial_hash(); |
| 5166 | 5169 |
| 5167 // Add a character to the hash and update the array index calculation. | 5170 // Add a character to the hash and update the array index calculation. |
| 5168 inline void AddCharacter(uc32 c); | 5171 inline void AddCharacter(uc32 c); |
| 5169 | 5172 |
| 5170 // Adds a character to the hash but does not update the array index | 5173 // Adds a character to the hash but does not update the array index |
| 5171 // calculation. This can only be called when it has been verified | 5174 // calculation. This can only be called when it has been verified |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5898 // | 5901 // |
| 5899 // StringInputBuffer is able to traverse any string regardless of how | 5902 // StringInputBuffer is able to traverse any string regardless of how |
| 5900 // deeply nested a sequence of ConsStrings it is made of. However, | 5903 // deeply nested a sequence of ConsStrings it is made of. However, |
| 5901 // performance will be better if deep strings are flattened before they | 5904 // performance will be better if deep strings are flattened before they |
| 5902 // are traversed. Since flattening requires memory allocation this is | 5905 // are traversed. Since flattening requires memory allocation this is |
| 5903 // not always desirable, however (esp. in debugging situations). | 5906 // not always desirable, however (esp. in debugging situations). |
| 5904 class StringInputBuffer: public unibrow::InputBuffer<String, String*, 1024> { | 5907 class StringInputBuffer: public unibrow::InputBuffer<String, String*, 1024> { |
| 5905 public: | 5908 public: |
| 5906 virtual void Seek(unsigned pos); | 5909 virtual void Seek(unsigned pos); |
| 5907 inline StringInputBuffer(): unibrow::InputBuffer<String, String*, 1024>() {} | 5910 inline StringInputBuffer(): unibrow::InputBuffer<String, String*, 1024>() {} |
| 5908 inline StringInputBuffer(String* backing): | 5911 explicit inline StringInputBuffer(String* backing): |
| 5909 unibrow::InputBuffer<String, String*, 1024>(backing) {} | 5912 unibrow::InputBuffer<String, String*, 1024>(backing) {} |
| 5910 }; | 5913 }; |
| 5911 | 5914 |
| 5912 | 5915 |
| 5913 class SafeStringInputBuffer | 5916 class SafeStringInputBuffer |
| 5914 : public unibrow::InputBuffer<String, String**, 256> { | 5917 : public unibrow::InputBuffer<String, String**, 256> { |
| 5915 public: | 5918 public: |
| 5916 virtual void Seek(unsigned pos); | 5919 virtual void Seek(unsigned pos); |
| 5917 inline SafeStringInputBuffer() | 5920 inline SafeStringInputBuffer() |
| 5918 : unibrow::InputBuffer<String, String**, 256>() {} | 5921 : unibrow::InputBuffer<String, String**, 256>() {} |
| 5919 inline SafeStringInputBuffer(String** backing) | 5922 explicit inline SafeStringInputBuffer(String** backing) |
| 5920 : unibrow::InputBuffer<String, String**, 256>(backing) {} | 5923 : unibrow::InputBuffer<String, String**, 256>(backing) {} |
| 5921 }; | 5924 }; |
| 5922 | 5925 |
| 5923 | 5926 |
| 5924 template <typename T> | 5927 template <typename T> |
| 5925 class VectorIterator { | 5928 class VectorIterator { |
| 5926 public: | 5929 public: |
| 5927 VectorIterator(T* d, int l) : data_(Vector<const T>(d, l)), index_(0) { } | 5930 VectorIterator(T* d, int l) : data_(Vector<const T>(d, l)), index_(0) { } |
| 5928 explicit VectorIterator(Vector<const T> data) : data_(data), index_(0) { } | 5931 explicit VectorIterator(Vector<const T> data) : data_(data), index_(0) { } |
| 5929 T GetNext() { return data_[index_++]; } | 5932 T GetNext() { return data_[index_++]; } |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6653 } else { | 6656 } else { |
| 6654 value &= ~(1 << bit_position); | 6657 value &= ~(1 << bit_position); |
| 6655 } | 6658 } |
| 6656 return value; | 6659 return value; |
| 6657 } | 6660 } |
| 6658 }; | 6661 }; |
| 6659 | 6662 |
| 6660 } } // namespace v8::internal | 6663 } } // namespace v8::internal |
| 6661 | 6664 |
| 6662 #endif // V8_OBJECTS_H_ | 6665 #endif // V8_OBJECTS_H_ |
| OLD | NEW |