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

Unified Diff: src/objects.cc

Issue 335553004: Keep maps when resetting elements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: simplified as suggested Created 6 years, 6 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/elements.cc ('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 bdfa23cde59d32626192b08ec182f5e2784550e6..545d681e825b39f581d76bf5da1fb6a96957ac07 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4857,28 +4857,9 @@ void JSObject::TransformToFastProperties(Handle<JSObject> object,
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());
}
« no previous file with comments | « src/elements.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698