Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: src/heap-inl.h

Issue 2645004: Add an API to control the disposal of external string resources... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
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 delete *resource_addr; 120
121 // Dispose of the C++ object.
122 if (external_string_dispose_callback_ != NULL) {
123 external_string_dispose_callback_(*resource_addr);
124 } else {
125 delete *resource_addr;
126 }
127
121 // Clear the resource pointer in the string. 128 // Clear the resource pointer in the string.
122 *resource_addr = NULL; 129 *resource_addr = NULL;
123 } 130 }
124 131
125 132
126 Object* Heap::AllocateRawMap() { 133 Object* Heap::AllocateRawMap() {
127 #ifdef DEBUG 134 #ifdef DEBUG
128 Counters::objs_since_last_full.Increment(); 135 Counters::objs_since_last_full.Increment();
129 Counters::objs_since_last_young.Increment(); 136 Counters::objs_since_last_young.Increment();
130 #endif 137 #endif
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 489
483 490
484 void ExternalStringTable::ShrinkNewStrings(int position) { 491 void ExternalStringTable::ShrinkNewStrings(int position) {
485 new_space_strings_.Rewind(position); 492 new_space_strings_.Rewind(position);
486 Verify(); 493 Verify();
487 } 494 }
488 495
489 } } // namespace v8::internal 496 } } // namespace v8::internal
490 497
491 #endif // V8_HEAP_INL_H_ 498 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698