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

Unified Diff: src/objects.cc

Issue 249723004: Dictionary::Add() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/objects.h ('k') | src/runtime.cc » ('j') | 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 86baab160370c9e06b21d466122d15213f35de64..5c10f54aefb793f895b45f64597109e6fb4e9dda 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -667,8 +667,8 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object,
store_value = object->GetIsolate()->factory()->NewPropertyCell(value);
}
- property_dictionary = NameDictionary::AddNameEntry(
- property_dictionary, name, store_value, details);
+ property_dictionary = NameDictionary::Add(
+ property_dictionary, *name, store_value, details);
object->set_properties(*property_dictionary);
return;
}
@@ -1942,7 +1942,7 @@ void JSObject::AddSlowProperty(Handle<JSObject> object,
}
PropertyDetails details = PropertyDetails(attributes, NORMAL, 0);
Handle<NameDictionary> result =
- NameDictionary::AddNameEntry(dict, name, value, details);
+ NameDictionary::Add(dict, *name, value, details);
if (*dict != *result) object->set_properties(*result);
}
@@ -4641,7 +4641,7 @@ void JSObject::NormalizeProperties(Handle<JSObject> object,
Handle<Object> value(descs->GetConstant(i), isolate);
PropertyDetails d = PropertyDetails(
details.attributes(), NORMAL, i + 1);
- dictionary = NameDictionary::AddNameEntry(dictionary, key, value, d);
+ dictionary = NameDictionary::Add(dictionary, *key, value, d);
break;
}
case FIELD: {
@@ -4650,7 +4650,7 @@ void JSObject::NormalizeProperties(Handle<JSObject> object,
object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate);
PropertyDetails d =
PropertyDetails(details.attributes(), NORMAL, i + 1);
- dictionary = NameDictionary::AddNameEntry(dictionary, key, value, d);
+ dictionary = NameDictionary::Add(dictionary, *key, value, d);
break;
}
case CALLBACKS: {
@@ -4658,7 +4658,7 @@ void JSObject::NormalizeProperties(Handle<JSObject> object,
Handle<Object> value(descs->GetCallbacksObject(i), isolate);
PropertyDetails d = PropertyDetails(
details.attributes(), CALLBACKS, i + 1);
- dictionary = NameDictionary::AddNameEntry(dictionary, key, value, d);
+ dictionary = NameDictionary::Add(dictionary, *key, value, d);
break;
}
case INTERCEPTOR:
@@ -14973,9 +14973,9 @@ template int
Dictionary<NameDictionary, NameDictionaryShape, Name*>::
NumberOfElementsFilterAttributes(PropertyAttributes);
-template MaybeObject*
+template Handle<NameDictionary>
Dictionary<NameDictionary, NameDictionaryShape, Name*>::Add(
- Name*, Object*, PropertyDetails);
+ Handle<NameDictionary>, Name*, Handle<Object>, PropertyDetails);
template MaybeObject*
Dictionary<NameDictionary, NameDictionaryShape, Name*>::
@@ -14985,13 +14985,19 @@ template int
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
NumberOfElementsFilterAttributes(PropertyAttributes);
-template MaybeObject*
-Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::Add(
- uint32_t, Object*, PropertyDetails);
+template Handle<SeededNumberDictionary>
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
+ Add(Handle<SeededNumberDictionary>,
+ uint32_t,
+ Handle<Object>,
+ PropertyDetails);
-template MaybeObject*
+template Handle<UnseededNumberDictionary>
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
- Add(uint32_t, Object*, PropertyDetails);
+ Add(Handle<UnseededNumberDictionary>,
+ uint32_t,
+ Handle<Object>,
+ PropertyDetails);
template MaybeObject*
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
@@ -15030,16 +15036,6 @@ int HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
FindEntry(uint32_t);
-Handle<NameDictionary> NameDictionary::AddNameEntry(Handle<NameDictionary> dict,
- Handle<Name> name,
- Handle<Object> value,
- PropertyDetails details) {
- CALL_HEAP_FUNCTION(dict->GetIsolate(),
- dict->Add(*name, *value, details),
- NameDictionary);
-}
-
-
Handle<Object> JSObject::PrepareSlowElementsForSort(
Handle<JSObject> object, uint32_t limit) {
ASSERT(object->HasDictionaryElements());
@@ -15480,8 +15476,8 @@ Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell(
isolate->factory()->the_hole_value());
PropertyDetails details(NONE, NORMAL, 0);
details = details.AsDeleted();
- Handle<NameDictionary> dictionary = NameDictionary::AddNameEntry(
- handle(global->property_dictionary()), name, cell, details);
+ Handle<NameDictionary> dictionary = NameDictionary::Add(
+ handle(global->property_dictionary()), *name, cell, details);
global->set_properties(*dictionary);
return cell;
} else {
@@ -15960,20 +15956,17 @@ Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut(
template<typename Derived, typename Shape, typename Key>
-MaybeObject* Dictionary<Derived, Shape, Key>::Add(
+Handle<Derived> Dictionary<Derived, Shape, Key>::Add(
+ Handle<Derived> dictionary,
Key key,
- Object* value,
+ Handle<Object> value,
PropertyDetails details) {
// Valdate key is absent.
- SLOW_ASSERT((this->FindEntry(key) == Dictionary::kNotFound));
+ SLOW_ASSERT((dictionary->FindEntry(key) == Dictionary::kNotFound));
// Check whether the dictionary should be extended.
- Object* obj;
- { MaybeObject* maybe_obj = EnsureCapacity(1, key);
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
- }
+ dictionary = EnsureCapacity(dictionary, 1, key);
- return Dictionary::cast(obj)->AddEntry(
- key, value, details, Dictionary::Hash(key));
+ return AddEntry(dictionary, key, value, details, dictionary->Hash(key));
}
@@ -16049,9 +16042,7 @@ Handle<SeededNumberDictionary> SeededNumberDictionary::AddNumberEntry(
PropertyDetails details) {
dictionary->UpdateMaxNumberKey(key);
SLOW_ASSERT(dictionary->FindEntry(key) == kNotFound);
- CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
- dictionary->Add(key, *value, details),
- SeededNumberDictionary);
+ return Add(dictionary, key, value, details);
}
@@ -16060,10 +16051,7 @@ Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry(
uint32_t key,
Handle<Object> value) {
SLOW_ASSERT(dictionary->FindEntry(key) == kNotFound);
- CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
- dictionary->Add(
- key, *value, PropertyDetails(NONE, NORMAL, 0)),
- UnseededNumberDictionary);
+ return Add(dictionary, key, value, PropertyDetails(NONE, NORMAL, 0));
}
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698