From 3f461303bd43026fa1c6400d1be1edf73fe94d7f Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Mon, 30 Sep 2013 16:42:19 +0000 Subject: [PATCH] Disable externalization of sliced/cons strings in old pointer space. This is a temporary workaround for the fact that a good deal of the code that triggers access checks, which in turn externalize strings, is not yet handlified and therefore not GC safe. R=yangguo@chromium.org Review URL: https://codereview.chromium.org/25146008 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17023 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api.cc b/src/api.cc index f5daba4..105a386 100644 --- a/src/api.cc +++ b/src/api.cc @@ -5610,6 +5610,12 @@ bool v8::String::CanMakeExternal() { if (!internal::FLAG_clever_optimizations) return false; i::Handle obj = Utils::OpenHandle(this); i::Isolate* isolate = obj->GetIsolate(); + + // TODO(yangguo): Externalizing sliced/cons strings allocates. + // This rule can be removed when all code that can + // trigger an access check is handlified and therefore GC safe. + if (isolate->heap()->old_pointer_space()->Contains(*obj)) return false; + if (isolate->string_tracker()->IsFreshUnusedString(obj)) return false; int size = obj->Size(); // Byte size of the original string. if (size < i::ExternalString::kShortSize) return false; -- 2.7.4