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