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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 | 112 |
113 void Heap::FinalizeExternalString(String* string) { | 113 void Heap::FinalizeExternalString(String* string) { |
114 ASSERT(string->IsExternalString()); | 114 ASSERT(string->IsExternalString()); |
115 v8::String::ExternalStringResourceBase** resource_addr = | 115 v8::String::ExternalStringResourceBase** resource_addr = |
116 reinterpret_cast<v8::String::ExternalStringResourceBase**>( | 116 reinterpret_cast<v8::String::ExternalStringResourceBase**>( |
117 reinterpret_cast<byte*>(string) + | 117 reinterpret_cast<byte*>(string) + |
118 ExternalString::kResourceOffset - | 118 ExternalString::kResourceOffset - |
119 kHeapObjectTag); | 119 kHeapObjectTag); |
120 | 120 |
121 // Dispose of the C++ object. | 121 // Dispose of the C++ object if it has not already been disposed. |
122 if (external_string_dispose_callback_ != NULL) { | 122 if (*resource_addr != NULL) { |
123 external_string_dispose_callback_(*resource_addr); | 123 (*resource_addr)->Dispose(); |
124 } else { | |
125 delete *resource_addr; | |
126 } | 124 } |
127 | 125 |
128 // Clear the resource pointer in the string. | 126 // Clear the resource pointer in the string. |
129 *resource_addr = NULL; | 127 *resource_addr = NULL; |
130 } | 128 } |
131 | 129 |
132 | 130 |
133 Object* Heap::AllocateRawMap() { | 131 Object* Heap::AllocateRawMap() { |
134 #ifdef DEBUG | 132 #ifdef DEBUG |
135 Counters::objs_since_last_full.Increment(); | 133 Counters::objs_since_last_full.Increment(); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 487 |
490 | 488 |
491 void ExternalStringTable::ShrinkNewStrings(int position) { | 489 void ExternalStringTable::ShrinkNewStrings(int position) { |
492 new_space_strings_.Rewind(position); | 490 new_space_strings_.Rewind(position); |
493 Verify(); | 491 Verify(); |
494 } | 492 } |
495 | 493 |
496 } } // namespace v8::internal | 494 } } // namespace v8::internal |
497 | 495 |
498 #endif // V8_HEAP_INL_H_ | 496 #endif // V8_HEAP_INL_H_ |
OLD | NEW |