[dict] Use new ObjectPtr design
Bug: v8:6443, v8:7569 Change-Id: I1bcd3458c2d548d36bf2961a2faf41919c433a91 Reviewed-on: https://chromium-review.googlesource.com/c/1382829 Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#58378}
This commit is contained in:
parent
4bd1215c95
commit
b6dfeb0d8a
@ -991,8 +991,8 @@ Handle<HeapObject> OrderedNameDictionaryHandler::Add(Isolate* isolate,
|
||||
isolate, Handle<OrderedNameDictionary>::cast(table), key, value, details);
|
||||
}
|
||||
|
||||
int OrderedNameDictionaryHandler::FindEntry(Isolate* isolate, HeapObject* table,
|
||||
Object* key) {
|
||||
int OrderedNameDictionaryHandler::FindEntry(Isolate* isolate,
|
||||
HeapObjectPtr table, Object* key) {
|
||||
if (table->IsSmallOrderedNameDictionary()) {
|
||||
int entry =
|
||||
SmallOrderedNameDictionary::cast(table)->FindEntry(isolate, key);
|
||||
@ -1008,7 +1008,7 @@ int OrderedNameDictionaryHandler::FindEntry(Isolate* isolate, HeapObject* table,
|
||||
: entry;
|
||||
}
|
||||
|
||||
Object* OrderedNameDictionaryHandler::ValueAt(HeapObject* table, int entry) {
|
||||
Object* OrderedNameDictionaryHandler::ValueAt(HeapObjectPtr table, int entry) {
|
||||
if (table->IsSmallOrderedNameDictionary()) {
|
||||
return SmallOrderedNameDictionary::cast(table)->ValueAt(entry);
|
||||
}
|
||||
@ -1017,7 +1017,7 @@ Object* OrderedNameDictionaryHandler::ValueAt(HeapObject* table, int entry) {
|
||||
return OrderedNameDictionary::cast(table)->ValueAt(entry);
|
||||
}
|
||||
|
||||
void OrderedNameDictionaryHandler::ValueAtPut(HeapObject* table, int entry,
|
||||
void OrderedNameDictionaryHandler::ValueAtPut(HeapObjectPtr table, int entry,
|
||||
Object* value) {
|
||||
if (table->IsSmallOrderedNameDictionary()) {
|
||||
return SmallOrderedNameDictionary::cast(table)->ValueAtPut(entry, value);
|
||||
@ -1027,7 +1027,7 @@ void OrderedNameDictionaryHandler::ValueAtPut(HeapObject* table, int entry,
|
||||
OrderedNameDictionary::cast(table)->ValueAtPut(entry, value);
|
||||
}
|
||||
|
||||
PropertyDetails OrderedNameDictionaryHandler::DetailsAt(HeapObject* table,
|
||||
PropertyDetails OrderedNameDictionaryHandler::DetailsAt(HeapObjectPtr table,
|
||||
int entry) {
|
||||
if (table->IsSmallOrderedNameDictionary()) {
|
||||
return SmallOrderedNameDictionary::cast(table)->DetailsAt(entry);
|
||||
@ -1037,7 +1037,7 @@ PropertyDetails OrderedNameDictionaryHandler::DetailsAt(HeapObject* table,
|
||||
return OrderedNameDictionary::cast(table)->DetailsAt(entry);
|
||||
}
|
||||
|
||||
void OrderedNameDictionaryHandler::DetailsAtPut(HeapObject* table, int entry,
|
||||
void OrderedNameDictionaryHandler::DetailsAtPut(HeapObjectPtr table, int entry,
|
||||
PropertyDetails details) {
|
||||
if (table->IsSmallOrderedNameDictionary()) {
|
||||
return SmallOrderedNameDictionary::cast(table)->DetailsAtPut(entry,
|
||||
@ -1048,7 +1048,7 @@ void OrderedNameDictionaryHandler::DetailsAtPut(HeapObject* table, int entry,
|
||||
OrderedNameDictionary::cast(table)->DetailsAtPut(entry, details);
|
||||
}
|
||||
|
||||
int OrderedNameDictionaryHandler::Hash(HeapObject* table) {
|
||||
int OrderedNameDictionaryHandler::Hash(HeapObjectPtr table) {
|
||||
if (table->IsSmallOrderedNameDictionary()) {
|
||||
return SmallOrderedNameDictionary::cast(table)->Hash();
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ int OrderedNameDictionaryHandler::Hash(HeapObject* table) {
|
||||
return OrderedNameDictionary::cast(table)->Hash();
|
||||
}
|
||||
|
||||
void OrderedNameDictionaryHandler::SetHash(HeapObject* table, int hash) {
|
||||
void OrderedNameDictionaryHandler::SetHash(HeapObjectPtr table, int hash) {
|
||||
if (table->IsSmallOrderedNameDictionary()) {
|
||||
return SmallOrderedNameDictionary::cast(table)->SetHash(hash);
|
||||
}
|
||||
|
@ -709,22 +709,23 @@ class OrderedNameDictionaryHandler
|
||||
Handle<Name> key, Handle<Object> value,
|
||||
PropertyDetails details);
|
||||
|
||||
static int FindEntry(Isolate* isolate, HeapObject* table, Object* key);
|
||||
static int FindEntry(Isolate* isolate, HeapObjectPtr table, Object* key);
|
||||
|
||||
// Returns the value for entry.
|
||||
static Object* ValueAt(HeapObject* table, int entry);
|
||||
static Object* ValueAt(HeapObjectPtr table, int entry);
|
||||
|
||||
// Set the value for entry.
|
||||
static void ValueAtPut(HeapObject* table, int entry, Object* value);
|
||||
static void ValueAtPut(HeapObjectPtr table, int entry, Object* value);
|
||||
|
||||
// Returns the property details for the property at entry.
|
||||
static PropertyDetails DetailsAt(HeapObject* table, int entry);
|
||||
static PropertyDetails DetailsAt(HeapObjectPtr table, int entry);
|
||||
|
||||
// Set the details for entry.
|
||||
static void DetailsAtPut(HeapObject* table, int entry, PropertyDetails value);
|
||||
static void DetailsAtPut(HeapObjectPtr table, int entry,
|
||||
PropertyDetails value);
|
||||
|
||||
static void SetHash(HeapObject* table, int hash);
|
||||
static int Hash(HeapObject* table);
|
||||
static void SetHash(HeapObjectPtr table, int hash);
|
||||
static int Hash(HeapObjectPtr table);
|
||||
|
||||
static const int kNotFound = -1;
|
||||
|
||||
|
@ -1750,7 +1750,8 @@ TEST(OrderedNameDictionaryHandlerInsertion) {
|
||||
Verify(isolate, table);
|
||||
CHECK(table->IsSmallOrderedNameDictionary());
|
||||
CHECK_NE(OrderedNameDictionaryHandler::kNotFound,
|
||||
OrderedNameDictionaryHandler::FindEntry(isolate, *table, *key));
|
||||
OrderedNameDictionaryHandler::FindEntry(
|
||||
isolate, HeapObjectPtr::cast(*table), *key));
|
||||
|
||||
char buf[10];
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
@ -1764,17 +1765,17 @@ TEST(OrderedNameDictionaryHandlerInsertion) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
CHECK_LT(0, snprintf(buf, sizeof(buf), "foo%d", j));
|
||||
Handle<Name> key_j = isolate->factory()->InternalizeUtf8String(buf);
|
||||
CHECK_NE(
|
||||
OrderedNameDictionaryHandler::kNotFound,
|
||||
OrderedNameDictionaryHandler::FindEntry(isolate, *table, *key_j));
|
||||
CHECK_NE(OrderedNameDictionaryHandler::kNotFound,
|
||||
OrderedNameDictionaryHandler::FindEntry(
|
||||
isolate, HeapObjectPtr::cast(*table), *key_j));
|
||||
}
|
||||
|
||||
for (int j = i + 1; j < 1024; j++) {
|
||||
CHECK_LT(0, snprintf(buf, sizeof(buf), "foo%d", j));
|
||||
Handle<Name> key_j = isolate->factory()->InternalizeUtf8String(buf);
|
||||
CHECK_EQ(
|
||||
OrderedNameDictionaryHandler::kNotFound,
|
||||
OrderedNameDictionaryHandler::FindEntry(isolate, *table, *key_j));
|
||||
CHECK_EQ(OrderedNameDictionaryHandler::kNotFound,
|
||||
OrderedNameDictionaryHandler::FindEntry(
|
||||
isolate, HeapObjectPtr::cast(*table), *key_j));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user