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