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

Unified Diff: src/identity-map.cc

Issue 1419563004: Simplify IdentityMap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/identity-map.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/identity-map.cc
diff --git a/src/identity-map.cc b/src/identity-map.cc
index 9d8fe9c5843ceb26096aedb778fa1e54bc26911f..40c453268fd71eb6ebb5dde3e0fa0f349959b046 100644
--- a/src/identity-map.cc
+++ b/src/identity-map.cc
@@ -15,23 +15,18 @@ static const int kInitialIdentityMapSize = 4;
static const int kResizeFactor = 4;
IdentityMapBase::~IdentityMapBase() {
- if (keys_) {
- Heap::OptionalRelocationLock lock(heap_, concurrent_);
- heap_->UnregisterStrongRoots(keys_);
- }
+ if (keys_) heap_->UnregisterStrongRoots(keys_);
}
-IdentityMapBase::RawEntry IdentityMapBase::Lookup(Handle<Object> key) {
- AllowHandleDereference for_lookup;
- int index = LookupIndex(*key);
+IdentityMapBase::RawEntry IdentityMapBase::Lookup(Object* key) {
+ int index = LookupIndex(key);
return index >= 0 ? &values_[index] : nullptr;
}
-IdentityMapBase::RawEntry IdentityMapBase::Insert(Handle<Object> key) {
- AllowHandleDereference for_lookup;
- int index = InsertIndex(*key);
+IdentityMapBase::RawEntry IdentityMapBase::Insert(Object* key) {
+ int index = InsertIndex(key);
DCHECK_GE(index, 0);
return &values_[index];
}
@@ -84,8 +79,7 @@ int IdentityMapBase::InsertIndex(Object* address) {
// as the identity, returning:
// found => a pointer to the storage location for the value
// not found => a pointer to a new storage location for the value
-IdentityMapBase::RawEntry IdentityMapBase::GetEntry(Handle<Object> key) {
- Heap::OptionalRelocationLock lock(heap_, concurrent_);
+IdentityMapBase::RawEntry IdentityMapBase::GetEntry(Object* key) {
RawEntry result;
if (size_ == 0) {
// Allocate the initial storage for keys and values.
@@ -118,10 +112,9 @@ IdentityMapBase::RawEntry IdentityMapBase::GetEntry(Handle<Object> key) {
// as the identity, returning:
// found => a pointer to the storage location for the value
// not found => {nullptr}
-IdentityMapBase::RawEntry IdentityMapBase::FindEntry(Handle<Object> key) {
+IdentityMapBase::RawEntry IdentityMapBase::FindEntry(Object* key) {
if (size_ == 0) return nullptr;
- Heap::OptionalRelocationLock lock(heap_, concurrent_);
RawEntry result = Lookup(key);
if (result == nullptr && gc_counter_ != heap_->gc_count()) {
Rehash(); // Rehash is expensive, so only do it in case of a miss.
« no previous file with comments | « src/identity-map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698