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

Side by Side Diff: src/objects.cc

Issue 15837006: Make (Object.)observed Arrays use SafeRemoveArrayHoles during sort (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/array.js ('k') | test/mjsunit/harmony/object-observe.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 13737 matching lines...) Expand 10 before | Expand all | Expand 10 after
13748 } 13748 }
13749 13749
13750 13750
13751 // Collects all defined (non-hole) and non-undefined (array) elements at 13751 // Collects all defined (non-hole) and non-undefined (array) elements at
13752 // the start of the elements array. 13752 // the start of the elements array.
13753 // If the object is in dictionary mode, it is converted to fast elements 13753 // If the object is in dictionary mode, it is converted to fast elements
13754 // mode. 13754 // mode.
13755 MaybeObject* JSObject::PrepareElementsForSort(uint32_t limit) { 13755 MaybeObject* JSObject::PrepareElementsForSort(uint32_t limit) {
13756 Heap* heap = GetHeap(); 13756 Heap* heap = GetHeap();
13757 13757
13758 ASSERT(!map()->is_observed());
13758 if (HasDictionaryElements()) { 13759 if (HasDictionaryElements()) {
13759 // Convert to fast elements containing only the existing properties. 13760 // Convert to fast elements containing only the existing properties.
13760 // Ordering is irrelevant, since we are going to sort anyway. 13761 // Ordering is irrelevant, since we are going to sort anyway.
13761 SeededNumberDictionary* dict = element_dictionary(); 13762 SeededNumberDictionary* dict = element_dictionary();
13762 if (IsJSArray() || dict->requires_slow_elements() || 13763 if (IsJSArray() || dict->requires_slow_elements() ||
13763 dict->max_number_key() >= limit || map()->is_observed()) { 13764 dict->max_number_key() >= limit) {
13764 return PrepareSlowElementsForSort(limit); 13765 return PrepareSlowElementsForSort(limit);
13765 } 13766 }
13766 // Convert to fast elements. 13767 // Convert to fast elements.
13767 13768
13768 Object* obj; 13769 Object* obj;
13769 MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(), 13770 MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(),
13770 FAST_HOLEY_ELEMENTS); 13771 FAST_HOLEY_ELEMENTS);
13771 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 13772 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
13772 Map* new_map = Map::cast(obj); 13773 Map* new_map = Map::cast(obj);
13773 13774
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
15633 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 15634 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
15634 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 15635 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
15635 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 15636 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
15636 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 15637 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
15637 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 15638 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
15638 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 15639 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
15639 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 15640 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
15640 } 15641 }
15641 15642
15642 } } // namespace v8::internal 15643 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/array.js ('k') | test/mjsunit/harmony/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698