OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_UTILS_H_ | 5 #ifndef V8_UTILS_H_ |
6 #define V8_UTILS_H_ | 6 #define V8_UTILS_H_ |
7 | 7 |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
11 #include <cmath> | 11 #include <cmath> |
12 | 12 |
13 #include "include/v8.h" | 13 #include "include/v8.h" |
14 #include "src/allocation.h" | 14 #include "src/allocation.h" |
15 #include "src/base/bits.h" | 15 #include "src/base/bits.h" |
16 #include "src/base/compiler-specific.h" | 16 #include "src/base/compiler-specific.h" |
17 #include "src/base/logging.h" | 17 #include "src/base/logging.h" |
18 #include "src/base/macros.h" | 18 #include "src/base/macros.h" |
19 #include "src/base/platform/platform.h" | 19 #include "src/base/platform/platform.h" |
20 #include "src/globals.h" | 20 #include "src/globals.h" |
21 #include "src/list.h" | 21 #include "src/list.h" |
22 #include "src/vector.h" | 22 #include "src/vector.h" |
| 23 #include "src/zone/zone.h" |
23 | 24 |
24 namespace v8 { | 25 namespace v8 { |
25 namespace internal { | 26 namespace internal { |
26 | 27 |
27 // ---------------------------------------------------------------------------- | 28 // ---------------------------------------------------------------------------- |
28 // General helper functions | 29 // General helper functions |
29 | 30 |
30 // Returns the value (0 .. 15) of a hexadecimal character c. | 31 // Returns the value (0 .. 15) of a hexadecimal character c. |
31 // If c is not a legal hexadecimal character, returns a value < 0. | 32 // If c is not a legal hexadecimal character, returns a value < 0. |
32 inline int HexValue(uc32 c) { | 33 inline int HexValue(uc32 c) { |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 while (i-- > 0) ++t; | 1680 while (i-- > 0) ++t; |
1680 return *t; | 1681 return *t; |
1681 } | 1682 } |
1682 | 1683 |
1683 private: | 1684 private: |
1684 T* head_; | 1685 T* head_; |
1685 T** tail_; | 1686 T** tail_; |
1686 DISALLOW_COPY_AND_ASSIGN(ThreadedList); | 1687 DISALLOW_COPY_AND_ASSIGN(ThreadedList); |
1687 }; | 1688 }; |
1688 | 1689 |
| 1690 // Can be used to create a threaded list of |T|. |
| 1691 template <typename T> |
| 1692 class ThreadedListZoneEntry final : public ZoneObject { |
| 1693 public: |
| 1694 explicit ThreadedListZoneEntry(T value) : value_(value), next_(nullptr) {} |
| 1695 |
| 1696 T value() { return value_; } |
| 1697 ThreadedListZoneEntry<T>** next() { return &next_; } |
| 1698 |
| 1699 private: |
| 1700 T value_; |
| 1701 ThreadedListZoneEntry<T>* next_; |
| 1702 DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry); |
| 1703 }; |
| 1704 |
1689 } // namespace internal | 1705 } // namespace internal |
1690 } // namespace v8 | 1706 } // namespace v8 |
1691 | 1707 |
1692 #endif // V8_UTILS_H_ | 1708 #endif // V8_UTILS_H_ |
OLD | NEW |