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

Unified Diff: src/objects.cc

Issue 545773003: Allocate a new empty number dictionary when resetting elements (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « no previous file | 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 24f32df6ac89b7ca34d5b6a06b034b4fb1caa2a3..7b942ffd26582945a78a589de3bbe6e7a3e528ef 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4411,9 +4411,15 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
void JSObject::ResetElements(Handle<JSObject> object) {
- Heap* heap = object->GetIsolate()->heap();
- CHECK(object->map() != heap->sloppy_arguments_elements_map());
- object->set_elements(object->map()->GetInitialElements());
+ Isolate* isolate = object->GetIsolate();
+ CHECK(object->map() != isolate->heap()->sloppy_arguments_elements_map());
+ 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());
+ }
}
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698