OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 v8::Persistent<v8::Object> object = ToApi<v8::Object>(handle()); | 162 v8::Persistent<v8::Object> object = ToApi<v8::Object>(handle()); |
163 { | 163 { |
164 // Forbid reuse of destroyed nodes as they might be already deallocated. | 164 // Forbid reuse of destroyed nodes as they might be already deallocated. |
165 // It's fine though to reuse nodes that were destroyed in weak callback | 165 // It's fine though to reuse nodes that were destroyed in weak callback |
166 // as those cannot be deallocated until we are back from the callback. | 166 // as those cannot be deallocated until we are back from the callback. |
167 set_first_free(NULL); | 167 set_first_free(NULL); |
168 if (first_deallocated()) { | 168 if (first_deallocated()) { |
169 first_deallocated()->set_next(head()); | 169 first_deallocated()->set_next(head()); |
170 } | 170 } |
| 171 // Check that we are not passing a finalized external string to |
| 172 // the callback. |
| 173 ASSERT(!object_->IsExternalAsciiString() || |
| 174 ExternalAsciiString::cast(object_)->resource() != NULL); |
| 175 ASSERT(!object_->IsExternalTwoByteString() || |
| 176 ExternalTwoByteString::cast(object_)->resource() != NULL); |
171 // Leaving V8. | 177 // Leaving V8. |
172 VMState state(EXTERNAL); | 178 VMState state(EXTERNAL); |
173 func(object, par); | 179 func(object, par); |
174 } | 180 } |
175 return true; | 181 return true; |
176 } | 182 } |
177 | 183 |
178 // Place the handle address first to avoid offset computation. | 184 // Place the handle address first to avoid offset computation. |
179 Object* object_; // Storage for object pointer. | 185 Object* object_; // Storage for object pointer. |
180 | 186 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 506 |
501 | 507 |
502 void GlobalHandles::RemoveObjectGroups() { | 508 void GlobalHandles::RemoveObjectGroups() { |
503 List<ObjectGroup*>* object_groups = ObjectGroups(); | 509 List<ObjectGroup*>* object_groups = ObjectGroups(); |
504 for (int i = 0; i< object_groups->length(); i++) { | 510 for (int i = 0; i< object_groups->length(); i++) { |
505 delete object_groups->at(i); | 511 delete object_groups->at(i); |
506 } | 512 } |
507 object_groups->Clear(); | 513 object_groups->Clear(); |
508 } | 514 } |
509 | 515 |
510 | |
511 } } // namespace v8::internal | 516 } } // namespace v8::internal |
OLD | NEW |