| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 current->next = cur + 1; | 142 current->next = cur + 1; |
| 143 | 143 |
| 144 T** result = reinterpret_cast<T**>(cur); | 144 T** result = reinterpret_cast<T**>(cur); |
| 145 *result = value; | 145 *result = value; |
| 146 return result; | 146 return result; |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 #ifdef DEBUG | 150 #ifdef DEBUG |
| 151 inline NoHandleAllocation::NoHandleAllocation() { | 151 inline NoHandleAllocation::NoHandleAllocation() { |
| 152 Isolate* isolate = Isolate::Current(); |
| 152 v8::ImplementationUtilities::HandleScopeData* current = | 153 v8::ImplementationUtilities::HandleScopeData* current = |
| 153 Isolate::Current()->handle_scope_data(); | 154 isolate->handle_scope_data(); |
| 155 |
| 156 ASSERT(!isolate->optimizing_compiler_thread()->IsOptimizerThread()); |
| 154 | 157 |
| 155 // Shrink the current handle scope to make it impossible to do | 158 // Shrink the current handle scope to make it impossible to do |
| 156 // handle allocations without an explicit handle scope. | 159 // handle allocations without an explicit handle scope. |
| 157 current->limit = current->next; | 160 current->limit = current->next; |
| 158 | 161 |
| 159 level_ = current->level; | 162 level_ = current->level; |
| 160 current->level = 0; | 163 current->level = 0; |
| 161 } | 164 } |
| 162 | 165 |
| 163 | 166 |
| 164 inline NoHandleAllocation::~NoHandleAllocation() { | 167 inline NoHandleAllocation::~NoHandleAllocation() { |
| 165 // Restore state in current handle scope to re-enable handle | 168 // Restore state in current handle scope to re-enable handle |
| 166 // allocations. | 169 // allocations. |
| 167 v8::ImplementationUtilities::HandleScopeData* data = | 170 v8::ImplementationUtilities::HandleScopeData* data = |
| 168 Isolate::Current()->handle_scope_data(); | 171 Isolate::Current()->handle_scope_data(); |
| 169 ASSERT_EQ(0, data->level); | 172 ASSERT_EQ(0, data->level); |
| 170 data->level = level_; | 173 data->level = level_; |
| 171 } | 174 } |
| 172 #endif | 175 #endif |
| 173 | 176 |
| 174 | 177 |
| 175 } } // namespace v8::internal | 178 } } // namespace v8::internal |
| 176 | 179 |
| 177 #endif // V8_HANDLES_INL_H_ | 180 #endif // V8_HANDLES_INL_H_ |
| OLD | NEW |