OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 : memory_(NULL), | 91 : memory_(NULL), |
92 memory_size_(0), | 92 memory_size_(0), |
93 limit_(reinterpret_cast<Address>(kMemoryTop)) {} | 93 limit_(reinterpret_cast<Address>(kMemoryTop)) {} |
94 // If memory_size_ > 0 then memory_ must be non-NULL. | 94 // If memory_size_ > 0 then memory_ must be non-NULL. |
95 Address memory_; | 95 Address memory_; |
96 size_t memory_size_; | 96 size_t memory_size_; |
97 Address limit_; | 97 Address limit_; |
98 void Free(); | 98 void Free(); |
99 }; | 99 }; |
100 | 100 |
| 101 // Address of allocated memory. |
| 102 static Address memory_address() { |
| 103 return reinterpret_cast<Address>(&thread_local_.memory_); |
| 104 } |
| 105 |
| 106 // Address of size of allocated memory. |
| 107 static Address memory_size_address() { |
| 108 return reinterpret_cast<Address>(&thread_local_.memory_size_); |
| 109 } |
| 110 |
101 // Resets the buffer if it has grown beyond the default/minimum size. | 111 // Resets the buffer if it has grown beyond the default/minimum size. |
102 // After this, the buffer is either the default size, or it is empty, so | 112 // After this, the buffer is either the default size, or it is empty, so |
103 // you have to call EnsureCapacity before using it again. | 113 // you have to call EnsureCapacity before using it again. |
104 static void Reset(); | 114 static void Reset(); |
105 | 115 |
106 static ThreadLocal thread_local_; | 116 static ThreadLocal thread_local_; |
| 117 |
| 118 friend class ExternalReference; |
107 }; | 119 }; |
108 | 120 |
109 }} // namespace v8::internal | 121 }} // namespace v8::internal |
110 | 122 |
111 #endif // V8_REGEXP_STACK_H_ | 123 #endif // V8_REGEXP_STACK_H_ |
OLD | NEW |