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

Unified Diff: src/objects.cc

Issue 700913003: Resolve race condition in CompilationCacheTable::Put (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 258390c4d5cb2b62ff079e31d90de3e5595b6fcb..96c92a7e71846f3ab9cebeafab273eada75191cb 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -14899,16 +14899,19 @@ Handle<CompilationCacheTable> CompilationCacheTable::Put(
Handle<SharedFunctionInfo> shared(context->closure()->shared());
StringSharedKey key(src, shared, FLAG_use_strict ? STRICT : SLOPPY,
RelocInfo::kNoPosition);
- int entry = cache->FindEntry(&key);
- if (entry != kNotFound) {
+ {
Handle<Object> k = key.AsHandle(isolate);
- cache->set(EntryToIndex(entry), *k);
- cache->set(EntryToIndex(entry) + 1, *value);
- return cache;
+ DisallowHeapAllocation no_allocation_scope;
+ int entry = cache->FindEntry(&key);
+ if (entry != kNotFound) {
+ cache->set(EntryToIndex(entry), *k);
+ cache->set(EntryToIndex(entry) + 1, *value);
+ return cache;
+ }
}
cache = EnsureCapacity(cache, 1, &key);
- entry = cache->FindInsertionEntry(key.Hash());
+ int entry = cache->FindInsertionEntry(key.Hash());
Handle<Object> k =
isolate->factory()->NewNumber(static_cast<double>(key.Hash()));
cache->set(EntryToIndex(entry), *k);
@@ -14924,16 +14927,19 @@ Handle<CompilationCacheTable> CompilationCacheTable::PutEval(
int scope_position) {
Isolate* isolate = cache->GetIsolate();
StringSharedKey key(src, outer_info, value->strict_mode(), scope_position);
- int entry = cache->FindEntry(&key);
- if (entry != kNotFound) {
+ {
Handle<Object> k = key.AsHandle(isolate);
- cache->set(EntryToIndex(entry), *k);
- cache->set(EntryToIndex(entry) + 1, *value);
- return cache;
+ DisallowHeapAllocation no_allocation_scope;
+ int entry = cache->FindEntry(&key);
+ if (entry != kNotFound) {
+ cache->set(EntryToIndex(entry), *k);
+ cache->set(EntryToIndex(entry) + 1, *value);
+ return cache;
+ }
}
cache = EnsureCapacity(cache, 1, &key);
- entry = cache->FindInsertionEntry(key.Hash());
+ int entry = cache->FindInsertionEntry(key.Hash());
Handle<Object> k =
isolate->factory()->NewNumber(static_cast<double>(key.Hash()));
cache->set(EntryToIndex(entry), *k);
« 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