OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 5138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5149 int length_; | 5149 int length_; |
5150 uint32_t raw_running_hash_; | 5150 uint32_t raw_running_hash_; |
5151 uint32_t array_index_; | 5151 uint32_t array_index_; |
5152 bool is_array_index_; | 5152 bool is_array_index_; |
5153 bool is_first_char_; | 5153 bool is_first_char_; |
5154 bool is_valid_; | 5154 bool is_valid_; |
5155 friend class TwoCharHashTableKey; | 5155 friend class TwoCharHashTableKey; |
5156 }; | 5156 }; |
5157 | 5157 |
5158 | 5158 |
| 5159 // Calculates string hash. |
| 5160 template <typename schar> |
| 5161 inline uint32_t HashSequentialString(const schar* chars, int length); |
| 5162 |
| 5163 |
5159 // The characteristics of a string are stored in its map. Retrieving these | 5164 // The characteristics of a string are stored in its map. Retrieving these |
5160 // few bits of information is moderately expensive, involving two memory | 5165 // few bits of information is moderately expensive, involving two memory |
5161 // loads where the second is dependent on the first. To improve efficiency | 5166 // loads where the second is dependent on the first. To improve efficiency |
5162 // the shape of the string is given its own class so that it can be retrieved | 5167 // the shape of the string is given its own class so that it can be retrieved |
5163 // once and used for several string operations. A StringShape is small enough | 5168 // once and used for several string operations. A StringShape is small enough |
5164 // to be passed by value and is immutable, but be aware that flattening a | 5169 // to be passed by value and is immutable, but be aware that flattening a |
5165 // string can potentially alter its shape. Also be aware that a GC caused by | 5170 // string can potentially alter its shape. Also be aware that a GC caused by |
5166 // something else can alter the shape of a string due to ConsString | 5171 // something else can alter the shape of a string due to ConsString |
5167 // shortcutting. Keeping these restrictions in mind has proven to be error- | 5172 // shortcutting. Keeping these restrictions in mind has proven to be error- |
5168 // prone and so we no longer put StringShapes in variables unless there is a | 5173 // prone and so we no longer put StringShapes in variables unless there is a |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6530 | 6535 |
6531 // Visits a contiguous arrays of external references (references to the C++ | 6536 // Visits a contiguous arrays of external references (references to the C++ |
6532 // heap) in the half-open range [start, end). Any or all of the values | 6537 // heap) in the half-open range [start, end). Any or all of the values |
6533 // may be modified on return. | 6538 // may be modified on return. |
6534 virtual void VisitExternalReferences(Address* start, Address* end) {} | 6539 virtual void VisitExternalReferences(Address* start, Address* end) {} |
6535 | 6540 |
6536 inline void VisitExternalReference(Address* p) { | 6541 inline void VisitExternalReference(Address* p) { |
6537 VisitExternalReferences(p, p + 1); | 6542 VisitExternalReferences(p, p + 1); |
6538 } | 6543 } |
6539 | 6544 |
| 6545 // Visits a handle that has an embedder-assigned class ID. |
| 6546 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {} |
| 6547 |
6540 #ifdef DEBUG | 6548 #ifdef DEBUG |
6541 // Intended for serialization/deserialization checking: insert, or | 6549 // Intended for serialization/deserialization checking: insert, or |
6542 // check for the presence of, a tag at this position in the stream. | 6550 // check for the presence of, a tag at this position in the stream. |
6543 virtual void Synchronize(const char* tag) {} | 6551 virtual void Synchronize(const char* tag) {} |
6544 #else | 6552 #else |
6545 inline void Synchronize(const char* tag) {} | 6553 inline void Synchronize(const char* tag) {} |
6546 #endif | 6554 #endif |
6547 }; | 6555 }; |
6548 | 6556 |
6549 | 6557 |
(...skipping 28 matching lines...) Expand all Loading... |
6578 } else { | 6586 } else { |
6579 value &= ~(1 << bit_position); | 6587 value &= ~(1 << bit_position); |
6580 } | 6588 } |
6581 return value; | 6589 return value; |
6582 } | 6590 } |
6583 }; | 6591 }; |
6584 | 6592 |
6585 } } // namespace v8::internal | 6593 } } // namespace v8::internal |
6586 | 6594 |
6587 #endif // V8_OBJECTS_H_ | 6595 #endif // V8_OBJECTS_H_ |
OLD | NEW |