Revision: 21838
Author: [email protected]
Date: Fri Jun 13 12:12:42 2014 UTC
Log: Keep maps when resetting elements.
[email protected]
Review URL: https://codereview.chromium.org/335553004
http://code.google.com/p/v8/source/detail?r=21838
Modified:
/branches/bleeding_edge/src/elements.cc
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.cc
=======================================
--- /branches/bleeding_edge/src/elements.cc Tue Jun 3 08:12:43 2014 UTC
+++ /branches/bleeding_edge/src/elements.cc Fri Jun 13 12:12:42 2014 UTC
@@ -1436,9 +1436,7 @@
}
if (new_length == 0) {
- // If the length of a slow array is reset to zero, we clear
- // the array and flush backing storage. This has the added
- // benefit that the array returns to fast mode.
+ // Flush the backing store.
JSObject::ResetElements(array);
} else {
DisallowHeapAllocation no_gc;
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Thu Jun 12 15:08:33 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h Fri Jun 13 12:12:42 2014 UTC
@@ -2738,6 +2738,9 @@
GetHeap()->EmptyFixedTypedArrayForMap(this);
ASSERT(!GetHeap()->InNewSpace(empty_array));
return empty_array;
+ } else if (has_dictionary_elements()) {
+
ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_slow_element_dictionary()));
+ return GetHeap()->empty_slow_element_dictionary();
} else {
UNREACHABLE();
}
=======================================
--- /branches/bleeding_edge/src/objects.cc Fri Jun 13 09:59:39 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Fri Jun 13 12:12:42 2014 UTC
@@ -4793,28 +4793,9 @@
void JSObject::ResetElements(Handle<JSObject> object) {
- if (object->map()->is_observed()) {
- // Maintain invariant that observed elements are always in dictionary
mode.
- Isolate* isolate = object->GetIsolate();
- Factory* factory = isolate->factory();
- Handle<SeededNumberDictionary> dictionary =
- SeededNumberDictionary::New(isolate, 0);
- if (object->map() == *factory->sloppy_arguments_elements_map()) {
- FixedArray::cast(object->elements())->set(1, *dictionary);
- } else {
- object->set_elements(*dictionary);
- }
- return;
- }
-
- ElementsKind elements_kind = GetInitialFastElementsKind();
- if (!FLAG_smi_only_arrays) {
- elements_kind = FastSmiToObjectElementsKind(elements_kind);
- }
- Handle<Map> map = JSObject::GetElementsTransitionMap(object,
elements_kind);
- DisallowHeapAllocation no_gc;
- Handle<FixedArrayBase> elements(map->GetInitialElements());
- JSObject::SetMapAndElements(object, map, elements);
+ Heap* heap = object->GetIsolate()->heap();
+ CHECK(object->map() != heap->sloppy_arguments_elements_map());
+ object->set_elements(object->map()->GetInitialElements());
}
--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.