OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // Update the current next field, set the value in the created | 126 // Update the current next field, set the value in the created |
127 // handle, and return the result. | 127 // handle, and return the result. |
128 ASSERT(cur < current_.limit); | 128 ASSERT(cur < current_.limit); |
129 current_.next = cur + 1; | 129 current_.next = cur + 1; |
130 | 130 |
131 T** result = reinterpret_cast<T**>(cur); | 131 T** result = reinterpret_cast<T**>(cur); |
132 *result = value; | 132 *result = value; |
133 return result; | 133 return result; |
134 } | 134 } |
135 | 135 |
| 136 // Deallocates any extensions used by the current scope. |
| 137 static void DeleteExtensions(); |
| 138 |
| 139 static Address current_extensions_address(); |
| 140 static Address current_next_address(); |
| 141 static Address current_limit_address(); |
| 142 |
136 private: | 143 private: |
137 // Prevent heap allocation or illegal handle scopes. | 144 // Prevent heap allocation or illegal handle scopes. |
138 HandleScope(const HandleScope&); | 145 HandleScope(const HandleScope&); |
139 void operator=(const HandleScope&); | 146 void operator=(const HandleScope&); |
140 void* operator new(size_t size); | 147 void* operator new(size_t size); |
141 void operator delete(void* size_t); | 148 void operator delete(void* size_t); |
142 | 149 |
143 static v8::ImplementationUtilities::HandleScopeData current_; | 150 static v8::ImplementationUtilities::HandleScopeData current_; |
144 const v8::ImplementationUtilities::HandleScopeData previous_; | 151 const v8::ImplementationUtilities::HandleScopeData previous_; |
145 | 152 |
(...skipping 13 matching lines...) Expand all Loading... |
159 } | 166 } |
160 current_ = *previous; | 167 current_ = *previous; |
161 #ifdef DEBUG | 168 #ifdef DEBUG |
162 ZapRange(current_.next, current_.limit); | 169 ZapRange(current_.next, current_.limit); |
163 #endif | 170 #endif |
164 } | 171 } |
165 | 172 |
166 // Extend the handle scope making room for more handles. | 173 // Extend the handle scope making room for more handles. |
167 static internal::Object** Extend(); | 174 static internal::Object** Extend(); |
168 | 175 |
169 // Deallocates any extensions used by the current scope. | |
170 static void DeleteExtensions(); | |
171 | |
172 // Zaps the handles in the half-open interval [start, end). | 176 // Zaps the handles in the half-open interval [start, end). |
173 static void ZapRange(internal::Object** start, internal::Object** end); | 177 static void ZapRange(internal::Object** start, internal::Object** end); |
174 | 178 |
175 friend class v8::HandleScope; | 179 friend class v8::HandleScope; |
176 friend class v8::ImplementationUtilities; | 180 friend class v8::ImplementationUtilities; |
177 }; | 181 }; |
178 | 182 |
179 | 183 |
180 // ---------------------------------------------------------------------------- | 184 // ---------------------------------------------------------------------------- |
181 // Handle operations. | 185 // Handle operations. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 private: | 354 private: |
351 bool has_been_transformed_; // Tells whether the object has been transformed. | 355 bool has_been_transformed_; // Tells whether the object has been transformed. |
352 int unused_property_fields_; // Captures the unused number of field. | 356 int unused_property_fields_; // Captures the unused number of field. |
353 Handle<JSObject> object_; // The object being optimized. | 357 Handle<JSObject> object_; // The object being optimized. |
354 }; | 358 }; |
355 | 359 |
356 | 360 |
357 } } // namespace v8::internal | 361 } } // namespace v8::internal |
358 | 362 |
359 #endif // V8_HANDLES_H_ | 363 #endif // V8_HANDLES_H_ |
OLD | NEW |