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(); |