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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 | 179 |
180 #ifdef DEBUG | 180 #ifdef DEBUG |
181 inline SealHandleScope::SealHandleScope(Isolate* isolate) : isolate_(isolate) { | 181 inline SealHandleScope::SealHandleScope(Isolate* isolate) : isolate_(isolate) { |
182 // Make sure the current thread is allowed to create handles to begin with. | 182 // Make sure the current thread is allowed to create handles to begin with. |
183 CHECK(AllowHandleAllocation::IsAllowed()); | 183 CHECK(AllowHandleAllocation::IsAllowed()); |
184 v8::ImplementationUtilities::HandleScopeData* current = | 184 v8::ImplementationUtilities::HandleScopeData* current = |
185 isolate_->handle_scope_data(); | 185 isolate_->handle_scope_data(); |
186 // Shrink the current handle scope to make it impossible to do | 186 // Shrink the current handle scope to make it impossible to do |
187 // handle allocations without an explicit handle scope. | 187 // handle allocations without an explicit handle scope. |
| 188 limit_ = current->limit; |
188 current->limit = current->next; | 189 current->limit = current->next; |
189 | |
190 level_ = current->level; | 190 level_ = current->level; |
191 current->level = 0; | 191 current->level = 0; |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 inline SealHandleScope::~SealHandleScope() { | 195 inline SealHandleScope::~SealHandleScope() { |
196 // Restore state in current handle scope to re-enable handle | 196 // Restore state in current handle scope to re-enable handle |
197 // allocations. | 197 // allocations. |
198 v8::ImplementationUtilities::HandleScopeData* data = | 198 v8::ImplementationUtilities::HandleScopeData* current = |
199 isolate_->handle_scope_data(); | 199 isolate_->handle_scope_data(); |
200 ASSERT_EQ(0, data->level); | 200 ASSERT_EQ(0, current->level); |
201 data->level = level_; | 201 current->level = level_; |
| 202 ASSERT_EQ(current->next, current->limit); |
| 203 current->limit = limit_; |
202 } | 204 } |
203 | 205 |
204 #endif | 206 #endif |
205 | 207 |
206 } } // namespace v8::internal | 208 } } // namespace v8::internal |
207 | 209 |
208 #endif // V8_HANDLES_INL_H_ | 210 #endif // V8_HANDLES_INL_H_ |
OLD | NEW |