| OLD | NEW |
| 1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_UNICODE_INL_H_ | 5 #ifndef V8_UNICODE_INL_H_ |
| 6 #define V8_UNICODE_INL_H_ | 6 #define V8_UNICODE_INL_H_ |
| 7 | 7 |
| 8 #include "src/unicode.h" | 8 #include "src/unicode.h" |
| 9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
| 10 #include "src/utils.h" | 10 #include "src/utils.h" |
| 11 | 11 |
| 12 namespace unibrow { | 12 namespace unibrow { |
| 13 | 13 |
| 14 template <class T, int s> bool Predicate<T, s>::get(uchar code_point) { | 14 template <class T, int s> bool Predicate<T, s>::get(uchar code_point) { |
| 15 CacheEntry entry = entries_[code_point & kMask]; | 15 CacheEntry entry = entries_[code_point & kMask]; |
| 16 if (entry.code_point_ == code_point) return entry.value_; | 16 if (entry.code_point() == code_point) return entry.value(); |
| 17 return CalculateValue(code_point); | 17 return CalculateValue(code_point); |
| 18 } | 18 } |
| 19 | 19 |
| 20 template <class T, int s> bool Predicate<T, s>::CalculateValue( | 20 template <class T, int s> bool Predicate<T, s>::CalculateValue( |
| 21 uchar code_point) { | 21 uchar code_point) { |
| 22 bool result = T::Is(code_point); | 22 bool result = T::Is(code_point); |
| 23 entries_[code_point & kMask] = CacheEntry(code_point, result); | 23 entries_[code_point & kMask] = CacheEntry(code_point, result); |
| 24 return result; | 24 return result; |
| 25 } | 25 } |
| 26 | 26 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 return 3; | 134 return 3; |
| 135 } else { | 135 } else { |
| 136 return 4; | 136 return 4; |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace unibrow | 140 } // namespace unibrow |
| 141 | 141 |
| 142 #endif // V8_UNICODE_INL_H_ | 142 #endif // V8_UNICODE_INL_H_ |
| OLD | NEW |