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

Unified Diff: src/heap/heap.cc

Issue 1149563011: Verify a bit more about external strings (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 37eb00485f7ae463aadeb41b3a5d3a6b4143a70b..95a8f59200890a8d3b03707f346ddc4172ce8d27 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -526,6 +526,31 @@ void Heap::RepairFreeListsAfterDeserialization() {
}
+void Heap::FinalizeExternalString(String* string) {
+ DCHECK(string->IsExternalString());
+ v8::String::ExternalStringResourceBase** resource_addr =
+ reinterpret_cast<v8::String::ExternalStringResourceBase**>(
+ reinterpret_cast<byte*>(string) + ExternalString::kResourceOffset -
+ kHeapObjectTag);
+
+ // Dispose of the C++ object if it has not already been disposed.
+ if (*resource_addr != NULL) {
+#ifdef V8_ENABLE_CHECKS
+ {
+ HandleScope scope(string->GetIsolate());
+ i::Handle<i::String> str_obj(string);
+ v8::Utils::ToLocal(str_obj)->VerifyExternalStringResourceBase(
+ *resource_addr, StringShape(string).IsExternalOneByte()
+ ? v8::String::ONE_BYTE_ENCODING
+ : v8::String::TWO_BYTE_ENCODING);
+ }
+#endif
+ (*resource_addr)->Dispose();
+ *resource_addr = NULL;
+ }
+}
+
+
void Heap::ProcessPretenuringFeedback() {
if (FLAG_allocation_site_pretenuring) {
int tenure_decisions = 0;
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698