Reviewers: Yang,
Message:
PTAL #9
Description:
Dictionary::DeleteProperty() handlified.
Please review this at https://codereview.chromium.org/250023002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+13, -39 lines):
M src/objects.h
M src/objects.cc
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
a788361d561db40897ea4541f812d2b8f900af8b..ca3a9feeba82c1c571abc7446dd667d65a5ecfe7
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -725,7 +725,8 @@ Handle<Object>
JSObject::DeleteNormalizedProperty(Handle<JSObject> object,
PropertyCell::SetValueInferType(cell, value);
dictionary->DetailsAtPut(entry, details.AsDeleted());
} else {
- Handle<Object> deleted(dictionary->DeleteProperty(entry, mode),
isolate);
+ Handle<Object> deleted(
+ NameDictionary::DeleteProperty(dictionary, entry, mode));
if (*deleted == isolate->heap()->true_value()) {
Handle<NameDictionary> new_properties =
NameDictionary::Shrink(dictionary, *name);
@@ -14924,28 +14925,13 @@ Dictionary<SeededNumberDictionary,
SeededNumberDictionaryShape, uint32_t>::
SeededNumberDictionaryShape,
uint32_t>::SortMode);
-template Object*
-Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
- int, JSObject::DeleteMode);
-
template Handle<Object>
Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
- Handle<Dictionary<NameDictionary, NameDictionaryShape, Name*> >,
- int,
- JSObject::DeleteMode);
-
-template Object*
-Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
- DeleteProperty(int, JSObject::DeleteMode);
+ Handle<NameDictionary>, int, JSObject::DeleteMode);
template Handle<Object>
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
- DeleteProperty(
- Handle<Dictionary<SeededNumberDictionary,
- SeededNumberDictionaryShape,
- uint32_t> >,
- int,
- JSObject::DeleteMode);
+ DeleteProperty(Handle<SeededNumberDictionary>, int,
JSObject::DeleteMode);
template Handle<NameDictionary>
HashTable<NameDictionary, NameDictionaryShape, Name*>::
@@ -15855,31 +15841,21 @@ Handle<Derived> Dictionary<Derived, Shape,
Key>::EnsureCapacity(
}
-// TODO(ishell): Temporary wrapper until handlified.
template<typename Derived, typename Shape, typename Key>
Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
- Handle<Dictionary<Derived, Shape, Key> > dictionary,
+ Handle<Derived> dictionary,
int entry,
JSObject::DeleteMode mode) {
- CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
- dictionary->DeleteProperty(entry, mode),
- Object);
-}
-
-
-template<typename Derived, typename Shape, typename Key>
-Object* Dictionary<Derived, Shape, Key>::DeleteProperty(
- int entry,
- JSReceiver::DeleteMode mode) {
- Heap* heap = Dictionary::GetHeap();
- PropertyDetails details = DetailsAt(entry);
+ Factory* factory = dictionary->GetIsolate()->factory();
+ PropertyDetails details = dictionary->DetailsAt(entry);
// Ignore attributes if forcing a deletion.
if (details.IsDontDelete() && mode != JSReceiver::FORCE_DELETION) {
- return heap->false_value();
+ return factory->false_value();
}
- SetEntry(entry, heap->the_hole_value(), heap->the_hole_value());
- DerivedHashTable::ElementRemoved();
- return heap->true_value();
+ dictionary->SetEntry(
+ entry, *factory->the_hole_value(), *factory->the_hole_value());
+ dictionary->ElementRemoved();
+ return factory->true_value();
}
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
a61eed2b55fb3f9eb191aaa518b3f658349867dd..e870ffd4a6222295d2460bcb07285b167f203ee7
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4017,10 +4017,8 @@ class Dictionary: public HashTable<Derived, Shape,
Key> {
void CopyValuesTo(FixedArray* elements);
// Delete a property from the dictionary.
- Object* DeleteProperty(int entry, JSObject::DeleteMode mode);
- // TODO(ishell): Temporary wrapper until handlified.
static Handle<Object> DeleteProperty(
- Handle<Dictionary> dictionary,
+ Handle<Derived> dictionary,
int entry,
JSObject::DeleteMode mode);
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.