OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 | 249 |
250 void Heap::FinalizeExternalString(String* string) { | 250 void Heap::FinalizeExternalString(String* string) { |
251 ASSERT(string->IsExternalString()); | 251 ASSERT(string->IsExternalString()); |
252 v8::String::ExternalStringResourceBase** resource_addr = | 252 v8::String::ExternalStringResourceBase** resource_addr = |
253 reinterpret_cast<v8::String::ExternalStringResourceBase**>( | 253 reinterpret_cast<v8::String::ExternalStringResourceBase**>( |
254 reinterpret_cast<byte*>(string) + | 254 reinterpret_cast<byte*>(string) + |
255 ExternalString::kResourceOffset - | 255 ExternalString::kResourceOffset - |
256 kHeapObjectTag); | 256 kHeapObjectTag); |
257 | 257 |
| 258 // Clear pointer cache. |
| 259 ExternalString::cast(string)->clear_data_cache(); |
| 260 |
258 // Dispose of the C++ object if it has not already been disposed. | 261 // Dispose of the C++ object if it has not already been disposed. |
259 if (*resource_addr != NULL) { | 262 if (*resource_addr != NULL) { |
260 (*resource_addr)->Dispose(); | 263 (*resource_addr)->Dispose(); |
261 *resource_addr = NULL; | |
262 } | 264 } |
| 265 |
| 266 // Clear the resource pointer in the string. |
| 267 *resource_addr = NULL; |
263 } | 268 } |
264 | 269 |
265 | 270 |
266 MaybeObject* Heap::AllocateRawMap() { | 271 MaybeObject* Heap::AllocateRawMap() { |
267 #ifdef DEBUG | 272 #ifdef DEBUG |
268 isolate_->counters()->objs_since_last_full()->Increment(); | 273 isolate_->counters()->objs_since_last_full()->Increment(); |
269 isolate_->counters()->objs_since_last_young()->Increment(); | 274 isolate_->counters()->objs_since_last_young()->Increment(); |
270 #endif | 275 #endif |
271 MaybeObject* result = map_space_->AllocateRaw(Map::kSize); | 276 MaybeObject* result = map_space_->AllocateRaw(Map::kSize); |
272 if (result->IsFailure()) old_gen_exhausted_ = true; | 277 if (result->IsFailure()) old_gen_exhausted_ = true; |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 706 |
702 | 707 |
703 Heap* _inline_get_heap_() { | 708 Heap* _inline_get_heap_() { |
704 return HEAP; | 709 return HEAP; |
705 } | 710 } |
706 | 711 |
707 | 712 |
708 } } // namespace v8::internal | 713 } } // namespace v8::internal |
709 | 714 |
710 #endif // V8_HEAP_INL_H_ | 715 #endif // V8_HEAP_INL_H_ |
OLD | NEW |