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 // 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 | 5 |
6 #ifndef V8_HANDLES_INL_H_ | 6 #ifndef V8_HANDLES_INL_H_ |
7 #define V8_HANDLES_INL_H_ | 7 #define V8_HANDLES_INL_H_ |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/handles.h" | 10 #include "src/handles.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 prev_limit_ = current->limit; | 131 prev_limit_ = current->limit; |
132 current->level++; | 132 current->level++; |
133 return result; | 133 return result; |
134 } | 134 } |
135 | 135 |
136 | 136 |
137 template <typename T> | 137 template <typename T> |
138 T** HandleScope::CreateHandle(Isolate* isolate, T* value) { | 138 T** HandleScope::CreateHandle(Isolate* isolate, T* value) { |
139 DCHECK(AllowHandleAllocation::IsAllowed()); | 139 DCHECK(AllowHandleAllocation::IsAllowed()); |
140 HandleScopeData* current = isolate->handle_scope_data(); | 140 HandleScopeData* current = isolate->handle_scope_data(); |
| 141 DCHECK(current->level > 0); |
141 | 142 |
142 internal::Object** cur = current->next; | 143 internal::Object** cur = current->next; |
143 if (cur == current->limit) cur = Extend(isolate); | 144 if (cur == current->limit) cur = Extend(isolate); |
144 // Update the current next field, set the value in the created | 145 // Update the current next field, set the value in the created |
145 // handle, and return the result. | 146 // handle, and return the result. |
146 DCHECK(cur < current->limit); | 147 DCHECK(cur < current->limit); |
147 current->next = cur + 1; | 148 current->next = cur + 1; |
148 | 149 |
149 T** result = reinterpret_cast<T**>(cur); | 150 T** result = reinterpret_cast<T**>(cur); |
150 *result = value; | 151 *result = value; |
(...skipping 23 matching lines...) Expand all Loading... |
174 current->level = level_; | 175 current->level = level_; |
175 DCHECK_EQ(current->next, current->limit); | 176 DCHECK_EQ(current->next, current->limit); |
176 current->limit = limit_; | 177 current->limit = limit_; |
177 } | 178 } |
178 | 179 |
179 #endif | 180 #endif |
180 | 181 |
181 } } // namespace v8::internal | 182 } } // namespace v8::internal |
182 | 183 |
183 #endif // V8_HANDLES_INL_H_ | 184 #endif // V8_HANDLES_INL_H_ |
OLD | NEW |