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

Unified Diff: src/compilation-cache.cc

Issue 2788663002: Bugfix - a DCHECK could allocate, invalidating a raw pointer. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compilation-cache.cc
diff --git a/src/compilation-cache.cc b/src/compilation-cache.cc
index 8b2e51e76a75c8b7d7c13e7a9ba65b0590c40615..11e8e78f5cc71dc16d76537b947fe5b9dd59983a 100644
--- a/src/compilation-cache.cc
+++ b/src/compilation-cache.cc
@@ -170,11 +170,19 @@ InfoVectorPair CompilationCacheScript::Lookup(
// to see if we actually found a cached script. If so, we return a
// handle created in the caller's handle scope.
if (result.has_shared()) {
+#ifdef DEBUG
+ // Since HasOrigin can allocate, we need to protect the SharedFunctionInfo
+ // and the FeedbackVector with handles during the call.
Handle<SharedFunctionInfo> shared(result.shared(), isolate());
- // TODO(mvstanton): Make sure HasOrigin can't allocate, or it will
- // mess up our InfoVectorPair.
+ Handle<Cell> vector_handle;
+ if (result.has_vector()) {
+ vector_handle = Handle<Cell>(result.vector(), isolate());
+ }
DCHECK(
HasOrigin(shared, name, line_offset, column_offset, resource_options));
+ result =
+ InfoVectorPair(*shared, result.has_vector() ? *vector_handle : nullptr);
+#endif
isolate()->counters()->compilation_cache_hits()->Increment();
} else {
isolate()->counters()->compilation_cache_misses()->Increment();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698