Commit 1dddf69f authored by verwaest@chromium.org's avatar verwaest@chromium.org

Allocate a new empty number dictionary when resetting elements

BUG=410332
LOG=y
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/545773003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23727 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 65fa2b49
...@@ -2897,9 +2897,6 @@ FixedArrayBase* Map::GetInitialElements() { ...@@ -2897,9 +2897,6 @@ FixedArrayBase* Map::GetInitialElements() {
GetHeap()->EmptyFixedTypedArrayForMap(this); GetHeap()->EmptyFixedTypedArrayForMap(this);
DCHECK(!GetHeap()->InNewSpace(empty_array)); DCHECK(!GetHeap()->InNewSpace(empty_array));
return empty_array; return empty_array;
} else if (has_dictionary_elements()) {
DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_slow_element_dictionary()));
return GetHeap()->empty_slow_element_dictionary();
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
......
...@@ -4411,9 +4411,15 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, ...@@ -4411,9 +4411,15 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
void JSObject::ResetElements(Handle<JSObject> object) { void JSObject::ResetElements(Handle<JSObject> object) {
Heap* heap = object->GetIsolate()->heap(); Isolate* isolate = object->GetIsolate();
CHECK(object->map() != heap->sloppy_arguments_elements_map()); CHECK(object->map() != isolate->heap()->sloppy_arguments_elements_map());
object->set_elements(object->map()->GetInitialElements()); if (object->map()->has_dictionary_elements()) {
Handle<SeededNumberDictionary> new_elements =
SeededNumberDictionary::New(isolate, 0);
object->set_elements(*new_elements);
} else {
object->set_elements(object->map()->GetInitialElements());
}
} }
......
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var a = [];
a[10000] = 1;
a.length = 0;
a[1] = 1;
a.length = 0;
assertEquals(undefined, a[1]);
var o = {};
Object.freeze(o);
assertEquals(undefined, o[1]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment