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

Unified Diff: src/objects.cc

Issue 249883003: Dictionary::AtPut() 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/objects-inl.h » ('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 0df564b9eaf5ced4671579b9d8fa196a3e43daef..86baab160370c9e06b21d466122d15213f35de64 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -14898,13 +14898,13 @@ template Handle<NameDictionary>
Dictionary<NameDictionary, NameDictionaryShape, Name*>::
New(Isolate* isolate, int n, PretenureFlag pretenure);
-template MaybeObject*
+template Handle<SeededNumberDictionary>
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
- AtPut(uint32_t, Object*);
+ AtPut(Handle<SeededNumberDictionary>, uint32_t, Handle<Object>);
-template MaybeObject*
+template Handle<UnseededNumberDictionary>
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
- AtPut(uint32_t, Object*);
+ AtPut(Handle<UnseededNumberDictionary>, uint32_t, Handle<Object>);
template Object*
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
@@ -15937,29 +15937,25 @@ Object* Dictionary<Derived, Shape, Key>::DeleteProperty(
template<typename Derived, typename Shape, typename Key>
-MaybeObject* Dictionary<Derived, Shape, Key>::AtPut(Key key, Object* value) {
- int entry = this->FindEntry(key);
+Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut(
+ Handle<Derived> dictionary, Key key, Handle<Object> value) {
+ int entry = dictionary->FindEntry(key);
// If the entry is present set the value;
if (entry != Dictionary::kNotFound) {
- ValueAtPut(entry, value);
- return this;
+ dictionary->ValueAtPut(entry, *value);
+ return dictionary;
}
// 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);
- Object* k;
- { MaybeObject* maybe_k = Shape::AsObject(this->GetHeap(), key);
- if (!maybe_k->ToObject(&k)) return maybe_k;
- }
+ Handle<Object> k = Shape::AsHandle(dictionary->GetIsolate(), key);
+ // TODO(ishell): Figure out if it is necessary to call AsHandle() here.
+ USE(k);
Yang 2014/04/24 06:24:39 Yeah this seems weird to have.
PropertyDetails details = PropertyDetails(NONE, NORMAL, 0);
- return Dictionary::cast(obj)->AddEntry(
- key, value, details, Dictionary::Hash(key));
+ return AddEntry(dictionary, key, value, details, dictionary->Hash(key));
}
@@ -15983,6 +15979,19 @@ MaybeObject* Dictionary<Derived, Shape, Key>::Add(
// Add a key, value pair to the dictionary.
template<typename Derived, typename Shape, typename Key>
+Handle<Derived> Dictionary<Derived, Shape, Key>::AddEntry(
+ Handle<Derived> dictionary,
+ Key key,
+ Handle<Object> value,
+ PropertyDetails details,
+ uint32_t hash) {
+ CALL_HEAP_FUNCTION(
+ dictionary->GetIsolate(),
+ dictionary->AddEntry(key, *value, details, hash),
+ Derived);
+}
+
+template<typename Derived, typename Shape, typename Key>
MaybeObject* Dictionary<Derived, Shape, Key>::AddEntry(
Key key,
Object* value,
@@ -16063,10 +16072,7 @@ Handle<SeededNumberDictionary> SeededNumberDictionary::AtNumberPut(
uint32_t key,
Handle<Object> value) {
dictionary->UpdateMaxNumberKey(key);
- CALL_HEAP_FUNCTION(
- dictionary->GetIsolate(),
- dictionary->AtPut(key, *value),
- SeededNumberDictionary);
+ return AtPut(dictionary, key, value);
}
@@ -16074,10 +16080,7 @@ Handle<UnseededNumberDictionary> UnseededNumberDictionary::AtNumberPut(
Handle<UnseededNumberDictionary> dictionary,
uint32_t key,
Handle<Object> value) {
- CALL_HEAP_FUNCTION(
- dictionary->GetIsolate(),
- dictionary->AtPut(key, *value),
- UnseededNumberDictionary);
+ return AtPut(dictionary, key, value);
}
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698